Skip to content

Systemd boot load shaping #7705

Closed
Closed

Description

@DavidePrincipi

Introduce a systemd generator that dynamically creates dependency and rate-limiting logic for lingered application sessions user@UID.service at boot.

Ensure applications (which run as lingered users) start in controlled tiers rather than all at once.

This feature aims to smooth system load during cluster boot, preventing CPU and I/O congestion from simultaneous application startups while keeping the process deterministic and fully integrated with systemd.

Proposed solution

  • Provide a configuration file /etc/linger-shaper.tiers to map applications to their tier, with unlisted apps defaulting to tier-2.
  • Implement the boot logic entirely through systemd drop-ins and helper units, without long-running daemons.
  • Allow future extension for tier auto-assignment from NS8 application metadata.

Support three priority levels:

  • core apps — start first, sequentially.
  • tier-1 apps — start next, in parallel but limited to nproc/2 concurrent sessions.
  • tier-2 apps — start last, with the same parallel limit.

Alternative solution

  • Generate Systemd drop-ins for user@UID.service units. Add After= dependency to shape the load.
  • After= Dependency is generated to start at most nproc/2 chain of units at the same time.
  • Make user@ unit startup blocking, until the user session is fully up.

Additional context

Boot time load recorded by netdata:

Image

See also

Activity

  1. added this to the NethServer 8.7 milestone on Oct 30, 2025
  2. moved this from ToDo to In Progress in NethServeron Nov 13, 2025
  3. DavidePrincipi commented on Nov 13, 2025

    @DavidePrincipi
    MemberAuthor

    DO 2vCPUs

    Without limit-load generator

    Image

    With limit-load (2 CPUs, 1 chain)

    Image
  4. DavidePrincipi commented on Nov 14, 2025

    @DavidePrincipi
    MemberAuthor

    In Testing Core 3.14.0-dev.3

    Run the test on a NS8 leader node hosting many applications and multiple user domain providers. I suggest installing also Netdata to collect high-resolution load and compare the boot-time load with and without the new feature.

    At the end of system boot use the following commands to collect additional information:

    • systemd-analyze shows boot times
    • systemd-analyze plot > image.svg dumps boot service startup sequences and times

    Test case

    • With core stable, reboot the node and collect baseline metrics
    • Update to core to Testing version
    • Reboot the node and check how metrics differ

    We expect the boot load peak is lower with the Testing version, whilst the boot duration is longer.

  5. moved this from In Progress to Testing in NethServeron Nov 14, 2025
  6. mrmarkuz commented on Nov 17, 2025

    @mrmarkuz
    Member

    Test case verified

    Stable core:
    Startup finished in 1.203s (kernel) + 3.315s (initrd) + 12.468s (userspace) = 16.987s
    multi-user.target reached after 11.748s in userspace.

    Image

    Testing core:
    Startup finished in 3.059s (kernel) + 5.196s (initrd) + 4min 8.549s (userspace) = 4min 16.804s
    multi-user.target reached after 15.178s in userspace.

    Image

    With the testing version the load during boot was the halved and the server was reachable. As expected the boot time was longer.

  7. added
    verifiedAll test cases were verified successfully
    on Nov 17, 2025
  8. removed
    testingPackages are available from testing repositories
    on Nov 17, 2025
  9. moved this from Testing to Verified in NethServeron Nov 17, 2025
  10. removed their assignment
    on Nov 17, 2025
  11. DavidePrincipi commented on Nov 18, 2025

    @DavidePrincipi
    MemberAuthor
  12. moved this from Verified to Done in NethServeron Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    verifiedAll test cases were verified successfully

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions