Web Hosting Talk







View Full Version : Clients and the CPU: Reasonable limits, monitoring, the whole deal.


HC-Sam
03-30-2007, 01:30 PM
I was basically wondering, how do you all monitor CPU usage of individual clients on your servers? Also, what do you typically think would be a reasonable ratio regarding disk space / bw (cheap resources) as compared to CPU usage? High BW and Space = low CPU usage, moderate BW and Space = more allowance of CPU usage?

A little insight and some software suggestions would be nice.

Thanks :)

-Sam

demowolf
03-31-2007, 08:17 AM
The amount of disk space and bandwidth you provide to your clients doesn't have anything to do with CPU usage. Somebody can load up a hosting account with thousands of images in an Image Gallery, but not use much server CPU. On the other hand, some people may install a tiny little program that literally takes over your CPU and hogs all resources.... without taking up any disk space.

Just some things to think about....

Rob.

HC-Sam
03-31-2007, 02:42 PM
I totally understand that, but typically you see with the big oversellers much more strict CPU usage limits, so there has to be some sort of ratio.

mrzippy
04-02-2007, 07:28 AM
It doesn't matter what is the ratio unless you have the tools to monitor it.

Most web hosting companies use cpanel or direct admin or some other control panel... and none of these give the ability to limit accounts based on cpu or memory utilization.

HC-Sam
04-02-2007, 02:03 PM
I am not talking about having software cut them off, I am talking about having some type of software to monitor them, and I can approach them myself if I notice their CPU usage being higher than it should.

mrzippy
04-02-2007, 02:15 PM
I am not talking about having software cut them off, I am talking about having some type of software to monitor them, and I can approach them myself if I notice their CPU usage being higher than it should.
If there is software to cut them off, then the same software would be able to monitor them..

Like I said.. I don't think the popular control panels include the ability to do this kind of "per account" monitoring in realtime.

HC-Sam
04-02-2007, 02:20 PM
Hm, then how is it done?

Atarim
04-02-2007, 06:33 PM
There are WHM plugins to monitor processes, or server utilities.

mrzippy
04-02-2007, 06:47 PM
There are WHM plugins to monitor processes, or server utilities.
On a "per customer" basis? I don't think so. It is impossible for most cpanel users, since the default install of cpanel runs PHP as "nobody" user...

.. and I don't see how you would be able to allocate/monitor PHP script usage to a specific customer when their scripts are running as "nobody".

I'd love for you to prove me wrong, however.

HC-Sam
04-03-2007, 12:46 AM
I don't mean constantly, I think you are getting the wrong idea. Some hosts say if a script uses x amount of the CPU for x amount of time, we will come get you. That's what I am trying to figure out. I don't want a script to automatically 'cut' people off if they use too much.

mrzippy
04-03-2007, 08:21 AM
No, I have the right idea...

What I'm saying is that with the default install of cpanel (and most other control panels), it is extremely difficult (if not impossible) to tell what account is actually using the cpu.

If you have 100 customers on your server and all of them are running PHP scripts as the "nobody" user... then how would you know who is violating your TOS and who is not?

The only way is to work backwards and try to find out what script is running, trace it back to the home directory, and then deduce the user's account.

It doesn't matter if you do this in realtime or after-the-fact. It is still almost impossible and totally unrealistic way to manage customers using the major control panels.

tweakservers
04-03-2007, 10:00 AM
bluehost.com looks to be having their own custom script to auto suspend an account if it exceed certain CPU limit

http://box21.bluehost.com/highload.html

HC-Sam
04-03-2007, 04:32 PM
If they have got a script running, cant you tell what folder it was ran from, therefore pointing who's account it came from? /user/whoever ... etc.

tweakservers
04-03-2007, 09:10 PM
They have it log into custom log file created at the server side at the /tmp

mheaton
04-04-2007, 02:01 AM
If you use mod_php (As mrzippy said) you can't track it reliably at all. It HAS to run scripts as their own user. Even with that you have to track IO and CPU, not just CPU. It is actually very difficult to do this accurately and effeciently (don't put load on the server just to track cpu). The reason no Cpanels have anything that is good is because it is EXTREMELY os specific and kernel specific. There is no good way to write a userspace application that is generic to do this. Why do you think almost every single host asks the same cpu question over and over. They just can't fix it, all they can do is address the symptoms. Now, that being said, we have this working on Bluehost and Hostmonster but that is one of the few things we have that I don't really share code on. I am not sure how technical you are but if you search around on the linux kernel mailing lists you can find a good start to solving this issue for your clients. You can also track it and instead of just cutting people off you can "slow down" their processes as well as their disk IO priority (ionice is the program IF you are using the right io scheduler in the linux kernel to support ionice). That way everyones processes finish, but the huge pigs don't take the box down with them.

Thanks,