Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
9f9e768a
Commit
9f9e768a
authored
Mar 17, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix quantum adjustment for batches
parent
eb4a6823
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
7 deletions
+15
-7
libcaf_core/caf/inbound_path.hpp
libcaf_core/caf/inbound_path.hpp
+3
-0
libcaf_core/caf/policy/downstream_messages.hpp
libcaf_core/caf/policy/downstream_messages.hpp
+2
-4
libcaf_core/src/downstream_messages.cpp
libcaf_core/src/downstream_messages.cpp
+6
-0
libcaf_core/src/inbound_path.cpp
libcaf_core/src/inbound_path.cpp
+4
-3
No files found.
libcaf_core/caf/inbound_path.hpp
View file @
9f9e768a
...
@@ -56,6 +56,9 @@ public:
...
@@ -56,6 +56,9 @@ public:
/// Stores slot IDs for sender (hdl) and receiver (self).
/// Stores slot IDs for sender (hdl) and receiver (self).
stream_slots
slots
;
stream_slots
slots
;
/// Stores the last computed desired batch size.
int32_t
desired_batch_size
;
/// Amount of credit we have signaled upstream.
/// Amount of credit we have signaled upstream.
int32_t
assigned_credit
;
int32_t
assigned_credit
;
...
...
libcaf_core/caf/policy/downstream_messages.hpp
View file @
9f9e768a
...
@@ -94,10 +94,8 @@ public:
...
@@ -94,10 +94,8 @@ public:
static
bool
enabled
(
const
nested_queue_type
&
q
)
noexcept
;
static
bool
enabled
(
const
nested_queue_type
&
q
)
noexcept
;
static
inline
deficit_type
quantum
(
const
nested_queue_type
&
,
static
deficit_type
quantum
(
const
nested_queue_type
&
q
,
deficit_type
x
)
noexcept
{
deficit_type
x
)
noexcept
;
return
x
;
}
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
...
...
libcaf_core/src/downstream_messages.cpp
View file @
9f9e768a
...
@@ -62,6 +62,12 @@ bool downstream_messages::enabled(const nested_queue_type& q) noexcept {
...
@@ -62,6 +62,12 @@ bool downstream_messages::enabled(const nested_queue_type& q) noexcept {
return
!
congested
;
return
!
congested
;
}
}
auto
downstream_messages
::
quantum
(
const
nested_queue_type
&
q
,
deficit_type
x
)
noexcept
->
deficit_type
{
// TODO: adjust quantum based on the stream priority
return
x
*
q
.
policy
().
handler
->
desired_batch_size
;
}
}
// namespace policy
}
// namespace policy
}
// namespace caf
}
// namespace caf
libcaf_core/src/inbound_path.cpp
View file @
9f9e768a
...
@@ -61,6 +61,7 @@ inbound_path::inbound_path(stream_manager_ptr mgr_ptr, stream_slots id,
...
@@ -61,6 +61,7 @@ inbound_path::inbound_path(stream_manager_ptr mgr_ptr, stream_slots id,
:
mgr
(
std
::
move
(
mgr_ptr
)),
:
mgr
(
std
::
move
(
mgr_ptr
)),
hdl
(
std
::
move
(
ptr
)),
hdl
(
std
::
move
(
ptr
)),
slots
(
id
),
slots
(
id
),
desired_batch_size
(
initial_credit
),
assigned_credit
(
0
),
assigned_credit
(
0
),
prio
(
stream_priority
::
normal
),
prio
(
stream_priority
::
normal
),
last_acked_batch_id
(
0
),
last_acked_batch_id
(
0
),
...
@@ -89,7 +90,6 @@ void inbound_path::handle(downstream_msg::batch& x) {
...
@@ -89,7 +90,6 @@ void inbound_path::handle(downstream_msg::batch& x) {
void
inbound_path
::
emit_ack_open
(
local_actor
*
self
,
actor_addr
rebind_from
)
{
void
inbound_path
::
emit_ack_open
(
local_actor
*
self
,
actor_addr
rebind_from
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
slots
)
<<
CAF_ARG
(
rebind_from
));
CAF_LOG_TRACE
(
CAF_ARG
(
slots
)
<<
CAF_ARG
(
rebind_from
));
assigned_credit
=
initial_credit
;
assigned_credit
=
initial_credit
;
int32_t
desired_batch_size
=
initial_credit
;
unsafe_send_as
(
self
,
hdl
,
unsafe_send_as
(
self
,
hdl
,
make
<
upstream_msg
::
ack_open
>
(
make
<
upstream_msg
::
ack_open
>
(
slots
.
invert
(),
self
->
address
(),
std
::
move
(
rebind_from
),
slots
.
invert
(),
self
->
address
(),
std
::
move
(
rebind_from
),
...
@@ -108,7 +108,7 @@ void inbound_path::emit_ack_batch(local_actor* self, long queued_items,
...
@@ -108,7 +108,7 @@ void inbound_path::emit_ack_batch(local_actor* self, long queued_items,
auto
credit
=
std
::
max
((
x
.
max_throughput
*
2
)
auto
credit
=
std
::
max
((
x
.
max_throughput
*
2
)
-
(
assigned_credit
+
queued_items
),
-
(
assigned_credit
+
queued_items
),
0l
);
0l
);
auto
batch_size
=
static_cast
<
int32_t
>
(
x
.
items_per_batch
);
desired_
batch_size
=
static_cast
<
int32_t
>
(
x
.
items_per_batch
);
if
(
credit
!=
0
)
if
(
credit
!=
0
)
assigned_credit
+=
credit
;
assigned_credit
+=
credit
;
CAF_LOG_DEBUG
(
CAF_ARG
(
credit
)
<<
CAF_ARG
(
batch_size
));
CAF_LOG_DEBUG
(
CAF_ARG
(
credit
)
<<
CAF_ARG
(
batch_size
));
...
@@ -116,7 +116,8 @@ void inbound_path::emit_ack_batch(local_actor* self, long queued_items,
...
@@ -116,7 +116,8 @@ void inbound_path::emit_ack_batch(local_actor* self, long queued_items,
make
<
upstream_msg
::
ack_batch
>
(
slots
.
invert
(),
make
<
upstream_msg
::
ack_batch
>
(
slots
.
invert
(),
self
->
address
(),
self
->
address
(),
static_cast
<
int32_t
>
(
credit
),
static_cast
<
int32_t
>
(
credit
),
batch_size
,
last_batch_id
));
desired_batch_size
,
last_batch_id
));
last_acked_batch_id
=
last_batch_id
;
last_acked_batch_id
=
last_batch_id
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment