Seastar
High performance C++ framework for concurrent servers
|
describes a request that passes through the fair_queue.
A ticket is specified by a weight
and a size
. For example, one can specify a request of weight
1 and size
16kB. If the fair_queue accepts one such request per second, it will sustain 1 IOPS at 16kB/s bandwidth.
#include <seastar/core/fair_queue.hh>
Public Member Functions | |
fair_queue_ticket (uint32_t weight, uint32_t size) noexcept | |
fair_queue_ticket | operator+ (fair_queue_ticket desc) const noexcept |
fair_queue_ticket | operator- (fair_queue_ticket desc) const noexcept |
fair_queue_ticket & | operator+= (fair_queue_ticket desc) noexcept |
fair_queue_ticket & | operator-= (fair_queue_ticket desc) noexcept |
bool | operator== (const fair_queue_ticket &desc) const noexcept |
operator bool () const noexcept | |
bool | is_non_zero () const noexcept |
float | normalize (fair_queue_ticket axis) const noexcept |
|
noexcept |
Constructs a fair_queue_ticket with a given weight
and a given size
weight | the weight of the request |
size | the size of the request |
|
noexcept |
The normalization function itself is an implementation detail, but one can expect either weight or size to have more or less relative importance depending on which of the dimensions in the denominator is relatively higher. For example, given this request a, and two other requests b and c, such that that c has the same weight
but a higher size
than b, one can expect the size
component of this request to play a larger role.
It is legal for the numerator to have one of the quantities set to zero, in which case only the other quantity is taken into consideration.
It is however not legal for the axis to have any quantity set to zero.
axis | another fair_queue_ticket to be used as a a base vector against which to normalize this fair_queue_ticket. |
|
explicitnoexcept |
For a fair_queue ticket to be non-zero, at least one of its represented quantities need to be non-zero
|
noexcept |
Increase the quantity represented in this ticket by the amount represented by desc
desc | another fair_queue_ticket whose weight and size will be added to this one |
|
noexcept |
Decreases the quantity represented in this ticket by the amount represented by desc
desc | another fair_queue_ticket whose weight and size will be decremented from this one |
|
noexcept |
Checks if the tickets fully equals to another one
desc | another fair_queue_ticket to compare with |