jupyterhub / systemdspawner

Spawn JupyterHub single-user notebook servers with systemd
BSD 3-Clause "New" or "Revised" License
92 stars 45 forks source link

Add `cpu_weight` config, relates to Systemd's CPUAccounting and CPUWeight #125

Closed ticoneva closed 5 months ago

ticoneva commented 1 year ago

This PR introduces a new configuration option cpu_weight. This sets the systemd property CPUWeight, which causes available CPU time to be sliced in proportion to each user's weight.

This is a follow-up to PR #98.

behrmann commented 1 year ago

I believe but don't know that CPUAccounting and CPUWeight are supported by systemd v245 and later. Do you know that we can assume these to be around in systemd v245?

They are around in that form since at least systemd 241, but my memory is a bit hazy since they might require cgroup v2, which legacy versions of distros might not yet use, but the hybrid cgroup layout should be fine.

consideRatio commented 1 year ago

I made an investigation about the fixme notes in #126 @behrmann, and opened #127 to remove them. What do you think? My conclusion is that we don't need them, because its handled by systemd no matter what.

consideRatio commented 1 year ago

@behrmann I opened https://github.com/jupyterhub/systemdspawner/issues/128 also, thinking maybe cpu_weight shouldn't be added, but that instead we should ensure its easy to pass through CPUQuota config without declaring a new dedicated python based config option in SystemdSpawner.

What are your thoughts about doing that?

yuvipanda commented 5 months ago

Sorry for the much delayed review here, @ticoneva.

I agree with @consideRatio here that we should move towards allowing people to pass through params directly to systemd, instead of special casing them here. With that, I'm going to close this PR.