Seastar
High performance C++ framework for concurrent servers
Public Member Functions | List of all members
seastar::fair_queue_ticket Class Reference

Detailed Description

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)
 
fair_queue_ticket operator+ (fair_queue_ticket desc) const
 
fair_queue_ticket operator- (fair_queue_ticket desc) const
 
fair_queue_ticketoperator+= (fair_queue_ticket desc)
 
fair_queue_ticketoperator-= (fair_queue_ticket desc)
 
bool strictly_less (fair_queue_ticket rhs) const
 
 operator bool () const
 
float normalize (fair_queue_ticket axis) const
 

Constructor & Destructor Documentation

◆ fair_queue_ticket()

seastar::fair_queue_ticket::fair_queue_ticket ( uint32_t  weight,
uint32_t  size 
)

Constructs a fair_queue_ticket with a given weight and a given size

Parameters
weightthe weight of the request
sizethe size of the request

Member Function Documentation

◆ normalize()

float seastar::fair_queue_ticket::normalize ( fair_queue_ticket  axis) const
Returns
the normalized value of this fair_queue_ticket along a base axis

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.

Parameters
axisanother fair_queue_ticket to be used as a a base vector against which to normalize this fair_queue_ticket.

◆ operator bool()

seastar::fair_queue_ticket::operator bool ( ) const
explicit
Returns
true if the fair_queue_ticket represents a non-zero quantity.

For a fair_queue ticket to be non-zero, at least one of its represented quantities need to be non-zero

◆ operator+=()

fair_queue_ticket& seastar::fair_queue_ticket::operator+= ( fair_queue_ticket  desc)

Increase the quantity represented in this ticket by the amount represented by desc

Parameters
descanother fair_queue_ticket whose weight and size will be added to this one

◆ operator-=()

fair_queue_ticket& seastar::fair_queue_ticket::operator-= ( fair_queue_ticket  desc)

Decreases the quantity represented in this ticket by the amount represented by desc

Parameters
descanother fair_queue_ticket whose weight and size will be decremented from this one

◆ strictly_less()

bool seastar::fair_queue_ticket::strictly_less ( fair_queue_ticket  rhs) const
Returns
true if this fair_queue_ticket is strictly less than rhs.

For a fair_queue_ticket to be considered strictly less than another, both its quantities need to be less than the other. Note that there is no total ordering between two fair_queue_tickets

Parameters
rhsanother fair_queue_ticket to be compared to this one.

The documentation for this class was generated from the following file: