C++ Actor Framework 0.18
|
A credit controller that estimates the bytes required to store incoming batches and constrains credit based on upper bounds for memory usage. More...
#include <size_based_credit_controller.hpp>
Public Member Functions | |
size_based_credit_controller (local_actor *self) | |
calibration | init () override |
Returns an initial calibration for the path. | |
calibration | calibrate () override |
Computes a credit assignment to the source after crossing the low-threshold. | |
![]() | |
virtual void | before_processing (downstream_msg::batch &batch)=0 |
Called before processing the batch x in order to allow the controller to keep statistics on incoming batches. | |
virtual calibration | init ()=0 |
Returns an initial calibration for the path. | |
virtual calibration | calibrate ()=0 |
Computes a credit assignment to the source after crossing the low-threshold. | |
Static Public Member Functions | |
template<class T > | |
static auto | make (local_actor *self, stream< T >) |
Static Public Attributes | |
static constexpr int32_t | min_samples = 50 |
Configures how many samples we require for recalculating buffer sizes. | |
Protected Attributes | |
local_actor * | self_ |
int32_t | sample_counter_ = 0 |
Keeps track of when to sample a batch. | |
int32_t | bytes_per_element_ = 0 |
Stores the last computed (moving) average for the serialized size per element in the stream. | |
int32_t | sampled_elements_ = 0 |
Stores how many elements were sampled since last calling calibrate . | |
int64_t | sampled_total_size_ = 0 |
Stores how many bytes the sampled batches required when serialized. | |
serialized_size_inspector | inspector_ |
Computes how many bytes elements require on the wire. | |
bool | initializing_ = true |
Stores whether this is the first run. | |
int32_t | bytes_per_batch_ |
int32_t | buffer_capacity_ |
int32_t | sampling_rate_ = 1 |
int32_t | calibration_interval_ |
float | smoothing_factor_ |
A credit controller that estimates the bytes required to store incoming batches and constrains credit based on upper bounds for memory usage.
|
overridevirtual |
Computes a credit assignment to the source after crossing the low-threshold.
May assign zero credit.
Implements caf::credit_controller.
|
overridevirtual |
Returns an initial calibration for the path.
Implements caf::credit_controller.