-
Notifications
You must be signed in to change notification settings - Fork 297
XAPI throttling proof of concept #6778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
cplaursen
wants to merge
76
commits into
xapi-project:feature/throttling
Choose a base branch
from
cplaursen:token-bucket
base: feature/throttling
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
5c5a816
rrdp-dcmi: Detect more errors on discovery
psafont e815c5c
CA-420968: compute the amount of physical cores available on a NUMA n…
edwintorok ff659cf
CA-420968: ensure compatibility between NUMARequest.fits and plan
edwintorok 3671ba0
CA-420968: track number of physical cores during a NUMA planning request
edwintorok 5d32507
CA-420968: introduce an explicit name for the current NUMA policy: Pr…
edwintorok b097854
CA-420968: avoid large performance hit on small NUMA nodes
edwintorok 2dbbbd0
[doc] add missing command to xs-trace
gthvn1 2809d72
numa_placement: use Seq instead of List
psafont c1b1311
CP-309847: Make HTTP/80 configurable
62f962b
CP-309847: Make HTTP/80 configurable (#6770)
liulinC 28eeaea
CA-420968: avoid large performance hit on small NUMA nodes (#6763)
edwintorok c57e943
numa_placement: use Seq instead of List (#6772)
edwintorok 4da3c01
CP-31566 define xenopsd fast resume operation
robhoes 88ece89
fixup! CP-31566 define xenopsd fast resume operation
lindig f255a46
increase max supported NVMe request size
lindig 68a7737
increase max supported NVMe request size (#6783)
lindig 58f09ac
CP-31566 define xenopsd fast resume operation (#6780)
lindig bf984c0
[doc] add missing command to xs-trace (#6771)
psafont f905d64
CA-420533: Only clear RestartVM guidance on up-to-date hosts
gangj fb2a1ab
CA-420533: Only clear RestartVM guidance on up-to-date hosts (#6782)
gangj bb705d1
qcow-stream-tool: Add read_headers command
last-genius 5ec13cc
python3: Use pre-parsed cluster allocation data in qcow2-to-stdout
last-genius 15f8088
vhd_tool_wrapper: Make vhd_of_device generic
last-genius 3685968
qcow_tool_wrapper: Read headers of QCOW2-backed VDIs on export
last-genius 8914076
qcow_tool_wrapper: Implement parse_header to determine allocated clus…
last-genius 3387a72
qcow: Only process allocated clusters on export from raw (#6769)
last-genius 2cc325b
opam: add missing dependencies
psafont 8a1e83b
opam: add missing dependencies (#6788)
edwintorok e496d08
rrdp-dcmi: Detect more errors on discovery (#6746)
psafont 949f1dc
CA-420856: Re-read inventory file when resetting network
minglumlu f66d4b6
CA-420856: Re-read inventory file when resetting network (#6789)
minglumlu 7c6ddfe
opam: generate metadata for uuid with dune
psafont a9978f1
opam: generate metadata for uuid with dune (#6790)
psafont a1ff026
libs: remove unused type parameters
psafont 8e21f45
git-blame: ignore another formatting commit
psafont cd50d44
sdk-gen: make code compatible with ocaml 5.4
psafont 862a44b
ocaml: prepare for ocaml 5.4 (#6791)
last-genius 2686b01
CA-421991: Fix QEMU coredumps on XS9
rosslagerwall 654cef3
CA-421991: Fix QEMU coredumps on XS9 (#6793)
robhoes 2e46250
CA-421914: preserve Host.numa_affinity_policy across pool join
edwintorok fb66dfc
CA-421847: set vcpu affinity if node claim succeeded
mg12 994a8dc
CA-421914: preserve Host.numa_affinity_policy across pool join (#6796)
edwintorok 06c1d62
CA-422071: preserve latest_synced_updates_applied and pending_guidanc…
edwintorok bd8c79a
CA-422071: add unit test for Host.create_params
edwintorok b0eaef3
CA-421847: set vcpu affinity if node claim succeeded (#6794)
edwintorok 5b121e2
CA-422071: guard against losing Host field settings on pool join (#6799)
robhoes f8ecfbd
libs: Add token-bucket library
cplaursen e3bd061
rate-limit: Test token bucket
cplaursen 3930feb
rate-limit: Implement bucket tables
cplaursen a3c275f
rate-limit: Create bucket table from xapi globs
cplaursen 85d7bc1
xapi: Add rate limiting to do_dispatch
cplaursen 259816d
xapi rate limiting: Add logging
cplaursen a96c26e
rate_limit: Add rate limiter to xapi initialisation
cplaursen 06d4d7d
Rate limiting: Improve token_bucket documentation
cplaursen 957307e
Rate limiting: token buckets with zero or negative fill rate fail
cplaursen 070f47b
rate-limit: Write unit tests for bucket table
cplaursen 276bc37
rate-limit: Minor fixes to bucket table
cplaursen 0d6fab9
rate-limit: Add readers-writer lock to bucket table
cplaursen 3e63f2c
rate-limit: Handle rate limited requests in FIFO queue
cplaursen b6b0173
rate-limit: Replace readers-writer lock with atomic Map
cplaursen 369f0d2
rate-limit: Clarify token bucket creation docs
cplaursen 028b505
idl: Add Rate_limit datamodel
cplaursen 66b839d
xapi-cli-server: Add rate limit CLI operations
cplaursen 7f3518c
token_bucket: replace mutex with lock-free atomics
cplaursen f7d3d13
xapi_rate_limit: Replace xapi_globs support with datamodel
cplaursen 88a9633
xapi_http: Add rate limiting to all handlers
cplaursen 21728dc
rate-limit: Process requests on original thread
cplaursen a8408b0
Add logging to bucket tables
cplaursen fc6df30
xapi_http: Fix rate limiting wrapper
cplaursen 4b1d7a9
rate-limit: Bypass rate limiting if user agent not registered
cplaursen 65f98e3
rate-limit: Prevent possible double locks when rate limiting
cplaursen 02de0f6
xapi-http: Don't rate limit handlers in the custom rate limit list
cplaursen 5390470
xe: Add rate limit operations
cplaursen 7d17b88
rate-limit: Fix names in records.ml
cplaursen 6f27897
rate-limit: Return receipt immediately for async requests
cplaursen 18c5764
xe: Add rate-limit-destroy operation
cplaursen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||
| (* | ||||||
| * Copyright (C) 2023 Cloud Software Group | ||||||
| * | ||||||
| * This program is free software; you can redistribute it and/or modify | ||||||
| * it under the terms of the GNU Lesser General Public License as published | ||||||
| * by the Free Software Foundation; version 2.1 only. with the special | ||||||
| * exception on linking described in file LICENSE. | ||||||
| * | ||||||
| * This program is distributed in the hope that it will be useful, | ||||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||
| * GNU Lesser General Public License for more details. | ||||||
| *) | ||||||
|
|
||||||
| open Datamodel_types | ||||||
| open Datamodel_common | ||||||
| open Datamodel_roles | ||||||
|
|
||||||
| let lifecycle = [] | ||||||
|
|
||||||
| let t = | ||||||
| create_obj ~name:_rate_limit ~descr:"Rate limiting policy for a XAPI client" | ||||||
| ~doccomments:[] ~gen_constructor_destructor:true ~gen_events:true | ||||||
| ~in_db:true ~lifecycle:[] ~persist:PersistEverything ~in_oss_since:None | ||||||
| ~messages_default_allowed_roles:_R_POOL_ADMIN | ||||||
| ~contents: | ||||||
| ([uid _rate_limit ~lifecycle] | ||||||
| @ [ | ||||||
| field ~qualifier:StaticRO ~ty:String ~lifecycle "client_id" | ||||||
| "An identifier for the rate limited client" ~ignore_foreign_key:true | ||||||
| ~default_value:(Some (VString "")) | ||||||
| ; field ~qualifier:StaticRO ~ty:Float ~lifecycle "burst_size" | ||||||
| "Amount of tokens that can be consumed in one burst" | ||||||
| ~ignore_foreign_key:true ~default_value:(Some (VFloat 0.)) | ||||||
| ; field ~qualifier:StaticRO ~ty:Float ~lifecycle "fill_rate" | ||||||
| "Tokens added to token bucket per second" ~ignore_foreign_key:true | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ~default_value:(Some (VFloat 0.)) | ||||||
| ] | ||||||
| ) | ||||||
| ~messages:[] () | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| module DT = Datamodel_types | ||
| module FieldSet = Astring.String.Set | ||
|
|
||
| let recent_field (f : DT.field) = f.lifecycle.transitions = [] | ||
|
|
||
| let rec field_full_names = function | ||
| | DT.Field f -> | ||
| if recent_field f then | ||
| f.full_name |> String.concat "_" |> Seq.return | ||
| else | ||
| Seq.empty | ||
| | DT.Namespace (_, xs) -> | ||
| xs |> List.to_seq |> Seq.concat_map field_full_names | ||
|
|
||
| let () = | ||
| let create_params = | ||
| Datamodel_host.create_params | ||
| |> List.map (fun p -> p.DT.param_name) | ||
| |> FieldSet.of_list | ||
| and fields = | ||
| Datamodel_host.t.contents | ||
| |> List.to_seq | ||
| |> Seq.concat_map field_full_names | ||
| |> FieldSet.of_seq | ||
| in | ||
| let missing_in_create_params = FieldSet.diff fields create_params in | ||
| if not (FieldSet.is_empty missing_in_create_params) then ( | ||
| Format.eprintf "Missing fields in create_params: %a@." FieldSet.dump | ||
| missing_in_create_params ; | ||
| exit 1 | ||
| ) |
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the idl should mention tokens or buckets at all, instead I would try to communicate the meaning of the parameters in a way that allows users to make a mental model of how rate limiting works:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we shouldn't talk about token buckets and I'll change that. The plan is to assign higher token costs to more expensive calls, e.g. VM create, so we can't simplify to the level of RPC calls, but I'll figure out how to document this for users.