Skip to content
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

Xapi thread classification - part 2 #6154

Open
wants to merge 3 commits into
base: feature/perf
Choose a base branch
from

Conversation

GabrielBuica
Copy link
Contributor

@GabrielBuica GabrielBuica commented Dec 4, 2024

Adds more granurality in the xapi thread classification. Now, an
individual thread can be mapped to the following:

  • {xapi_cgroup}/internal/SM;
  • {xapi_cgroup}/internal/cli;
  • {xapi_cgroup}/external/intrapool;
  • {xapi_cgroup}/external/unauthenticated;
  • {xapi_cgroup}/external/authenticated/{identity};

where {identity} is a {auth_user_sid}/{user_agent}.
Both {auth_user_sid} and {user_agent} strings are sanitized when
making the identity through Identity.make, by allowing only
alphanumeric characters and a maximum length of 16 characters each.

This should allow for proper thread classification in xapi.

Note: Threads calling back into xapi from xenopsd are yet to be classified.

e.g. Cgroup hierarchy based on the new classification
image

BVT: 208947 & BST: 208972

Adds more granurality in the xapi thread classification. Now, an
individual thread can be mapped to the following:

- {xapi_cgroup}/internal/SM;
- {xapi_cgroup}/internal/cli;
- {xapi_cgroup}/external/intrapool;
- {xapi_cgroup}/external/unauthenticated;
- {xapi_cgroup}/external/authenticated/{identity};

where {identity} is a {auth_user_sid}/{user_agent}.
Both {auth_user_sid} and {user_agent} strings are sanitized when
making the identity through `Identity.make`, by allowing only
alphanumenric characters and a maximum length of 16 characters each.

This is only the library change.

This should allow for proper thread classification in xapi.

Signed-off-by: Gabriel Buica <[email protected]>
@GabrielBuica GabrielBuica force-pushed the private/dbuica/feature/perf/tgroups-part-2 branch from fc0da95 to 90b296c Compare December 4, 2024 10:40
Adds unit test for:
- the correct thread classification of `of_creator`;
- sanitation of `Identity.make`.

Signed-off-by: Gabriel Buica <[email protected]>
Classifies the threads at the time of session creation and inside
`do_dispatch`.

This ensures that new threads created by current session/request inherit
the propper classification.

Note: threads created by xenopsd calling back into xapi are yet to be
classified.

Signed-off-by: Gabriel Buica <[email protected]>
@GabrielBuica GabrielBuica force-pushed the private/dbuica/feature/perf/tgroups-part-2 branch from f91bdb1 to 62a903a Compare December 5, 2024 16:49
@GabrielBuica GabrielBuica marked this pull request as ready for review December 5, 2024 17:25
|> Option.map sanitize
|> Option.map (fun user_agent ->
let len = Int.min (String.length user_agent) 16 in
String.sub user_agent 0 len
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to care about collisions? If we consider only the sanitized prefix, we could end up with collisions of the shortened names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think collisions matter that much in this case. If the we end up with the same shortened names they should be under the same classification. The important aspect was to differentiate between auth_user_sids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants