ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.JQScheduler.ReasonRateLimiting

Description

Ad-hoc rate limiting for the JQScheduler based on reason trails.

Synopsis

Documentation

reasonRateLimit :: Queue -> [JobWithStat] -> [JobWithStat] #

Implements ad-hoc rate limiting using the reason trail as specified in `doc/design-optables.rst`.

Reasons of form `rate-limit:n:REASONSTRING` define buckets that limit how many jobs with that reason can be running at the same time to a positive integer n of available slots.

The used buckets map is currently not cached across selectJobsToRun invocations because the number of running jobs is typically small (< 100).

For testing only

parseReasonRateLimit :: MonadFail m => String -> m (String, Int) #

Parses an ad-hoc rate limit from a reason trail, as defined under "Ad-Hoc Rate Limiting" in `doc/design-optables.rst`.

The parse succeeds only on reasons of form `rate-limit:n:REASONSTRING` where n is a positive integer and REASONSTRING is an arbitrary string (may include spaces).

countMapFromJob :: QueuedJob -> CountMap AdHocReasonKey #

Computes the bucket slots required by a job.

slotMapFromJobs :: [QueuedJob] -> SlotMap AdHocReasonKey #

Map of how many slots are in use for a given bucket, for a list of jobs. The slot limits are taken from the ad-hoc reason rate limiting strings.