canonical / pebble

Take control of your internal daemons!
GNU General Public License v3.0
137 stars 52 forks source link

Add (relative) niceness to cli exec and services #367

Open tonyandrewmeyer opened 4 months ago

tonyandrewmeyer commented 4 months ago

I believe it would be useful if Pebble consumers could ask Pebble to adjust the nice/ionice level of exec'd processes. For example:

services:
    svc1:
        override: replace
        command: /usr/bin/somedaemon --db=/db/path [ --port 8080 ]

        # (Optional) Relative niceness level
        # Default is 0 - run with the same level as Pebble itself.
        nice: <positive integer>
        ionice: <positive integer>

This would set the nice/ionice level before running the exec'd process (this might require sys calls).

In addition, for running one-off commands, for example:

$ pebble exec --nice=10 -- sleep 100

Considerations:

If we do this, then it would also make it easier for Juju to run Pebble with lower nice & ionice values, which seems appropriate.

benhoyt commented 4 months ago

Definitely worth considering -- thanks for the idea and suggestions!