Skip to content

util/acct: implement a new hierarchical accounting system #398

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

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

dvdhrm
Copy link
Member

@dvdhrm dvdhrm commented May 9, 2025

This is a replacement for util/user.[ch]. It is written in Rust, but
exposes a C API that can be used by dbus-broker.

The new accounting system uses the acct_* namespace to ease the
transition and avoid naming conflicts. Furthermore, the system is
written in Rust and relies on the new build-system support for Rust
code (see #392).

Note that this is a single commit on top of #392. Once the Rust support is merged, this rebase is not necessary, anymore. Also note that this only introduces the accounting system as an alternative, it does not disable the old one, yet.

The accounting system works with the same algorithm as the previous
flat-accounting model, but extends it to a 2-layered hierarchy. The
algorithm is adopted to support an arbitrarily nested hierarchy, but the
code will only expose 2 layers:

  1. As before, all users are assigned a flat resource limit that they get
    full control over. But when user boundaries are crossed, a quota is
    applied to guarantee fair resource sharing. The algorithm used is
    still the fairdist, but the allocators were improved on.

  2. Beneath the user quotas, a new layer is introduced. Rather than users
    claiming resources, now all operations originate from an Actor.
    These always operate on behalf of a user, but allow us to distinguish
    different actors of the same user. A new resource tracing system is
    now added analog to the user quotas. It operates above the quotas and
    ensures we can semi-protect individual actors of the same user (which
    was not possible before). We do not provide a fully fair policy on
    this level, however, since no privilege boundaries are crossed.
    Instead, this provides a semi-fair policy which is a lot more
    lenient, but still allows us to protect against failing clients.

@dvdhrm dvdhrm force-pushed the pr/acct branch 2 times, most recently from a8b3401 to 0bc75cc Compare June 18, 2025 13:38
This is a replacement for `util/user.[ch]`. It is written in Rust, but
exposes a C API that can be used by dbus-broker.

The new accounting system uses the `acct_*` namespace to ease the
transition and avoid naming conflicts. Furthermore, the system is
written in Rust and relies on the new build-system support for Rust
code.

The accounting system works with the same algorithm as the previous
flat-accounting model, but extends it to a 2-layered hierarchy. The
algorithm is adopted to support an arbitrarily nested hierarchy, but the
code will only expose 2 layers:

1) As before, all users are assigned a flat resource limit that they get
   full control over. But when user boundaries are crossed, a quota is
   applied to guarantee fair resource sharing. The algorithm used is
   still the `fairdist`, but the allocators were improved on.

2) Beneath the user quotas, a new layer is introduced. Rather than users
   claiming resources, now all operations originate from an `Actor`.
   These always operate on behalf of a user, but allow us to distinguish
   different actors of the same user. A new resource tracing system is
   now added analog to the user quotas. It operates above the quotas and
   ensures we can semi-protect individual actors of the same user (which
   was not possible before). We do not provide a fully fair policy on
   this level, however, since no privilege boundaries are crossed.
   Instead, this provides a semi-fair policy which is a lot more
   lenient, but still allows us to protect against failing clients.

Signed-off-by: David Rheinsberg <[email protected]>
@dvdhrm dvdhrm marked this pull request as ready for review June 23, 2025 12:36
@dvdhrm dvdhrm merged commit 4882a0c into bus1:main Jun 23, 2025
36 checks passed
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.

1 participant