mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
utils: Define DefaultRateLimiterRefillTimeMilliSecs
Firecracker's driver doesn't expose the RefillTime option of the rate limiter to the user. Instead, it uses a contant value of 1000 miliseconds (1 second). As we're following Firecracker's driver implementation, let's expose create a new constant, use it as part of the Firecracker's driver, and later on re-use it as part of the Cloud Hypervisor's driver. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
be1bb7e39f
commit
00a5b1bda9
@ -930,7 +930,7 @@ func (fc *firecracker) fcAddNetDevice(ctx context.Context, endpoint Endpoint) {
|
|||||||
// The implementation of rate limiter is based on TBF.
|
// The implementation of rate limiter is based on TBF.
|
||||||
// Rate Limiter defines a token bucket with a maximum capacity (size) to store tokens, and an interval for refilling purposes (refill_time).
|
// Rate Limiter defines a token bucket with a maximum capacity (size) to store tokens, and an interval for refilling purposes (refill_time).
|
||||||
// The refill-rate is derived from size and refill_time, and it is the constant rate at which the tokens replenish.
|
// The refill-rate is derived from size and refill_time, and it is the constant rate at which the tokens replenish.
|
||||||
refillTime := uint64(1000)
|
refillTime := uint64(utils.DefaultRateLimiterRefillTimeMilliSecs)
|
||||||
var rxRateLimiter models.RateLimiter
|
var rxRateLimiter models.RateLimiter
|
||||||
rxSize := fc.config.RxRateLimiterMaxRate
|
rxSize := fc.config.RxRateLimiterMaxRate
|
||||||
if rxSize > 0 {
|
if rxSize > 0 {
|
||||||
|
@ -25,6 +25,11 @@ const cpBinaryName = "cp"
|
|||||||
|
|
||||||
const fileMode0755 = os.FileMode(0755)
|
const fileMode0755 = os.FileMode(0755)
|
||||||
|
|
||||||
|
// The DefaultRateLimiterRefillTime is used for calculating the rate at
|
||||||
|
// which a TokenBucket is replinished, in cases where a RateLimiter is
|
||||||
|
// applied to either network or disk I/O.
|
||||||
|
const DefaultRateLimiterRefillTimeMilliSecs = 1000
|
||||||
|
|
||||||
// MibToBytesShift the number to shift needed to convert MiB to Bytes
|
// MibToBytesShift the number to shift needed to convert MiB to Bytes
|
||||||
const MibToBytesShift = 20
|
const MibToBytesShift = 20
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user