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:
We could support negative integers, but this would only work while Pebble is running as root (or with the relevant permissions), and are there actually cases where the service should be prioritised over Pebble itself?
We could do absolute values rather than relative. This is probably clearer to understand but (assuming that we aren't going to allow a nice value lower than Pebble itself) would need to handle errors where the priority isn't possible.
This could also be done for exec checks, but it seems like those ought to be prioritised as highly as Pebble can.
We could allow changing the ionice category but I'm not sure if there's utility with idle and I don't think we would want to allow real-time.
The default nice level for one-off commands should probably be 0 rather than whatever Pebble is running at.
Maybe the default nice level for services should also be 0 rather than whatever Pebble is running at.
If we do this, then it would also make it easier for Juju to run Pebble with lower nice & ionice values, which seems appropriate.
I believe it would be useful if Pebble consumers could ask Pebble to adjust the nice/ionice level of exec'd processes. For example:
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:
Considerations:
idle
and I don't think we would want to allowreal-time
.If we do this, then it would also make it easier for Juju to run Pebble with lower nice & ionice values, which seems appropriate.