Limit a processes CPU
I have a VPS with centos and it runs this java program. (A minecraft server.)
It turned out that we were apparently using too much CPU and it was lagging other VPSs. I'm a little confused about that because I thought that we had our own reserved CPU and we couldn't use any more than that.
Anyways I'm looking for a program that can limit a process's CPU, and doesn't do it by killing that process.
There is (generally) no such thing as a reserved CPU in Linux. CPU time slices are scheduled as needed by processes that are ready to run and not blocked on I/O (disc, network, etc). A single-threaded application can only use one CPU at a time. Most processes work at the same priority. However, if you find that one process is using too much CPU resources, then you can either increase its nice factor, or raise its priority number (higher number, lower priority). That will tell the scheduler to give preference to other applications with a lower priority number or lower nice factor (at same priority).
If these servers are running in virtual machines, then often the virtual machine manager has tools to change the priority or nice factor for a particular VM. Most of the time, these operations can be done without restarting the server, or the virtual machine.
if they think your VM is using too much CPU, then on the server side they should be posing a limit on you, rather than having you limit the CPU usage of a particular process