My two ubuntu multi-core processor servers (tomcat and mysql) are usually down. Therefore, I need a way to limit the cpu to 90% to ensure my servers is responsive (then, i can remote via ssh). I found a package in ubuntu, cpulimit. However, it seems not able to set limit for multi-core processors. Any suggestions?
Somewhere along the development of Linux 2.6.x it got a fancy new feature, cpuset. It allows process grouping. With cpuset it's possible to limit not only CPU usage, but also memory usage.
Here is an excellent wiki describing the topic with numerous examples. Should you have any further questions please don't hesitate to ask.
Please also remember that many times if some server process manages to bring your server down, it's not due CPU usage. Most of the time some process eats all the available RAM (and swap), causing a swap storm, which causes your server spending all its time swapping and not getting any real work done. Bear that in mind while configuring your cpuset. :)