Web Hosting Talk







View Full Version : Limiting user resources


Svenneman
06-05-2002, 05:16 AM
Hi

I would like to know if its possible for the server admin to limit the server resources that should be available to every user.

For instance set every user to use max 10% cpu load and 10% ram or something.

Would this be possible?

Svenneman
06-05-2002, 05:41 AM
I found this:

<VirtualHost xxx.xxx.xxx.x>
ServerAlias www.domain.com domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /home/domain/public_html
RLimitMEM 15728640
(Prevents your account from using more than 15 megs ram.)
RLimitCPU 3
(Prevents any script from operating more than 3 seconds at a time. 3-5 seconds should be sufficeint and prevents script looping. It also kills off bad scripts that continue to run after they should have already stopped of their own accord.)
RLimitNPROC 5
(This prevents your scripts from being run more than 5 times at the exact same time. I have noticed that some scripts actually run multiple instances of themselves although it's not needed. If a site is a busy one, scripts doing this can cause probs for the server. It shouldnt interefere with your site as the odds of more than 5 people hitting the submit button at the EXACT same time is extremely remote.)
BytesLog domlogs/domain.com-bytes_log
User domain
Group domain
ServerName www.domain.com
CustomLog domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/
</VirtualHost>

but that is not really what I'm out for, I want to cap a % usage of the cpu and ram. Is that possible?

MotleyFool
06-05-2002, 06:16 AM
If you are on linux /etc/security/limits.conf

If you are on FreeBSD /etc/login.conf


If you are on windows, I dont know! ;)

<edit>

Also make sure that suEXEC is enabled in Apache

</edit>

Cheers
Balaji

Svenneman
06-05-2002, 06:17 AM
can u limit cpu % usage there?

I thought you only could set the cpu time in minutes! Am I wrong?

MotleyFool
06-05-2002, 06:19 AM
AFAIK, you can set soft and hard limits on CPU time; dont know about %

Svenneman
06-05-2002, 06:23 AM
I knew you could set the cpu time but I need to set a limit in %

babak
06-05-2002, 06:36 AM
hi

For : MotleyFool


How to do I enabel suEXEC in apache?

TNX.
Regard,
Babak

MotleyFool
06-05-2002, 07:47 AM
Babak,

http://www.linuxplanet.com/linuxplanet/tutorials/1445/2/

has a good set of instructions

You can also look at Apache's own documentation at
http://httpd.apache.org/docs

Basically you need to recompile Apache from source with the

./configure --with-suexec option [there are other things you need to put in! ;)]

Cheers
Balaji