Web Hosting Talk







View Full Version : Limiting Resource


host911
09-21-2002, 12:37 AM
I have one of my clients using toooo much resource which cause the server to slow down or even some time the apache restart every hour. So, I would like to know how can I limit the resource for his account, and when he get over limit his site will stop working,??

Thanks for your help,

priyadi
09-21-2002, 01:00 AM
Use RLimit command on your client's virtualhost block. http://httpd.apache.org/docs/mod/core.html#rlimitmem

Webdude
09-21-2002, 01:05 AM
With hsphere, you can do this per account, but you cant with Cpanel, I dont know about others. Put this in your httpd.conf file close to the top.

RLimitCPU 10 20
RLimitMEM 6291456 6291456
RLimitNPROC 3 5

Of course, change the numbers to what suits you best..Then reload your apache.

host911
09-21-2002, 10:16 AM
Thanks for your replys,
Sorry I didn't say what type of server is, its RH 7.x with CPanel,

mdrussell
09-21-2002, 10:47 AM
Originally posted by Webdude
With hsphere, you can do this per account, but you cant with Cpanel, I dont know about others. Put this in your httpd.conf file close to the top.

RLimitCPU 10 20
RLimitMEM 6291456 6291456
RLimitNPROC 3 5

Of course, change the numbers to what suits you best..Then reload your apache.

If you are setting these as global directives, I suggest you raise them.

Webdude
09-21-2002, 11:55 AM
Me? No, I can set these limits "per account or plan" since each of our clients have their own httpd.conf file since we do virtual servers, and not your normal hosting. Lower cost accounts get lower resources.

DWHS
10-14-2002, 06:53 AM
With hsphere, you can do this per account, but you cant with Cpanel, I dont know about others. Put this in your httpd.conf file close to the top.

Does anyone else know how to set limits per accounts with cpanel or how to look up what the numbers mean in this

RLimitCPU 10 20
RLimitMEM 6291456 6291456
RLimitNPROC 3 5

I have redhat 7.3 p4 1.8 1 gig of ram 150 accounts (average size)

Anyone know what my varibles would be for this apache code sniplet.

Thanks for any help on this

Webdude
10-15-2002, 02:19 AM
RLimitCPU 10 20
10% soft limit on cpu
20% hard limit on cpu time

RLimitMEM 6291456 6291456
Soft/Hard limit of 6 megs of ram (a bit low)

RLimitNPROC 3 5
Limit processes, not very effective....but does work to a certain extent.

People often add these thinking it controls everything, it doesnt. It only controls whatever Apache controls....such as cgi that loads in the browser. CGI run from command line, cron, or other methods wont be controlled.

In Cpanel, there is no way at this time to add these limits "per account" unless you do it manually. The way Cpanel does it...it controls everything. ie:: if one site hits that 6 megs mem limit...it restricts all sites as one...not just the one that pushed things to that limit. It's an overall limit. When you see

RLimitCPU 10 20
RLimitMEM 6291456 6291456
RLimitNPROC 3 5
at the top of your patch fig file, set them to max limits. If your server has a gig of ram....then you should set RLimitMEM to the max bytes in a gig minus a few megs for your hard setting (say -100 megs) and then about - 200 megs for your soft setting. This at least prevents everything combined from going over what physical ram you have available.