Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Docker "Nice" or CPU limit options

Featured Replies

This is a different Q separate from my last message.

 

I have installed Sparkly's HandBrake Docker just to use the HandBrakeCLI interface to convert files placed in a watched folder.

 

I set up the watched folder and the folder monitoring script and then used docker commit to formalize the change in the image. 

 

This is working well, but while the docker is running handbrake, all of the CPU for the server is consumed by the conversion process.  I would prefer if it could be throttled back to 50 or 75% to leave time for other server activities.

 

I thought first about Nice, but in my reading, running Nice within a Docker restricts the processes *within* the docker, which would result in the docker as a whole running as much CPU as it wants, no different from now.  I believe that it is not possible to run Nice on the docker container itself, or am I wrong there?  Is that what --cap-add SYS_NICE is all about? (Manual says 'Raise process nice value (nice(2), setpriority(2)) and change the nice value for arbitrary processes.' but not sure what arbitrary processes means here.)

 

I've also seen the option to launch the docker with a CPU restriction, i.e.

docker run --cpuset="0" ...

  but Nice would be... nice. 

 

Also, if there is a special docker run command, is there a way to edit the default autostart or restart script?

 

I'd appreciate any advice you have.

 

Dennis

 

 

-cpuset is deprecated

You need to use -cpuset-cpus="0,1" and that would be the correct way to prevent one container from hogging all the resources

  • Author

-cpuset is deprecated

You need to use -cpuset-cpus="0,1" and that would be the correct way to prevent one container from hogging all the resources

 

Thanks.  I had trouble at first because -cpuset-cpus works on docker run not docker start, for reasons I can't understand.  However using the docker run -cpuset-cpus="0,1" ... command the container installed and my cpu% is running between 60 and 80% with mover running, and handbrake is getting the job done too.

 

it would be great to have nice too.

 

Thanks

 

Dennis

 

  • Author

Isn't CPU quota constraints doing the same thing as nice?

https://docs.docker.com/reference/run/#cpu-quota-constraint

 

I don't think it's the same.  The CPU quota throttles the usage (in their example " Set this value to 50000 to limit the container to 50% of a CPU resource.") rather than prioritizing processes.  My understanding of nice is that a process will burn 100% of all CPUs until there is a competing process with a higher priority, at which time the high-priority process runs and the nice process is slowed. When the high priority process is completed, the nice process goes back to being unthrottled.  Maybe I'm giving nice too much credit, but that's how I've always  understood it.

 

The --cpu-quota looks to be similar to the --cpuset-cpus suggested above that allocate one or a few cores to a process, it's just time managed instead of processor number managed.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.