io_queue: Bandwidth limiter
io_queue: Bandwidth limiter

The limiter re-uses shared token bucket to rate-limit the priority
class. The token bucket is configured with the given bandwidth
converted into blocks/sec. Limit and threshold are hard-coded with
some hopefully sane defaults.

The token bucket is one-bucket and auto-releases its tokens. This
is done because there's no "consumer works slower than we expect"
problem here. Even if disk slows down the node-wide limiter will
handle it.

Next, the rate is updateable via API call. When changed, only the
token bucket rate changes, limit and threshold remain the same.

Finally, the throttling is done is a "lazy" manner. Each time a
request is dispatched it accounts itself in the token bucket and if
the tokens deficiency appears on it, the request continues dispatch
but the class in question is unplugged from disk, so next requests
will come after tokens replenish. Unlike RL-sched-side tokens, here
they are replenished by timer.

Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@scylladb.com>

syuu1228/seastar,avikivity/seastar,scylladb/seastar,avikivity/seastar,scylladb/seastar,syuu1228/seastar,syuu1228/seastar,scylladb/seastar,avikivity/seastar