Dear Lazyweb


Dear Lazyweb, I would like to tell a linux box that no one process or user can ever have more than a certain percentage of CPU, either in time or cores. So far as I can tell, pam_limits (configured under /etc/security/limits.conf) will let me limit memory, open files, processor time (from login to force-quit-all, per user login, in seconds) or open file handles, but what I would ideally like is something that lets me manage fractions of available resources over a certain period of time.

Limiting every process on a system to no more than 75% or so of memory with pam_limits goes a surprisingly long way towards keeping a system responsive enough manage when a single process goes berzerk, but what I’d really like to do is to guarantee that over a floating window of a couple of seconds (ten? thirty? In a perfect world, I would choose…) that no process be able to take more than some percentage of the CPU time available in that window.

Is there a way to do that? I don’t see anything in pam_limits or the schedulers that do…


  1. Posted August 1, 2009 at 5:42 pm | Permalink

    Don’t believe such a thing exists. Only thing I saw was a commercial VPS hosting system from Ensim more than eight years ago, which looks to be discontinued. I think that problems achieving exactly what you’re looking for are responsible for people moving to virtual machines (one rogue non-root app goes crazy and eats resources, the system can’t be logged into / administered, needs hard reboot).

    If you want to spend money, seems to indicate VMWare finally figured out how to do it.

    Haven’t tried it, but Wikipedia claims OpenVZ can do it too.

  2. mhoye
    Posted August 1, 2009 at 9:06 pm | Permalink

    Yeah, unfortunately VMWare isn’t an acceptable solution for me, because I’m trying to manage machines that are already virtualized.

    VMWare is great in a lot of other areas (not the least of which are VMotion a their web interface, which are both awesome) but that’s not going to work.

  3. Mike Richters
    Posted August 1, 2009 at 9:40 pm | Permalink

    I certainly don’t know of any trick for doing that, but it does sound like a great idea at first blush.

    In fact, if you do find a way to do it, that would so be the pants!