Set up Debian Apache web server for 250 users
I have a network of 250 users.
They are simultaneously connected to my Linode 1024 machine.
I've some issue with the apache2 processes,
in some cases the processes are tons and so this causes
that the server goes down.
My /etc/apache2/apache2.conf is:
"
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
"
can you help me with this config?
or what I have to config to prevent the server issue?
thanks in advance!
Alberto
16 Replies
what it causes?
if 50 user request a page simultaneously,
all the user can view that page?
or only 40 can view the page? and 10 can't connect.
> The MaxClients directive sets the limit on the number of simultaneous requests that will be served. Any connection attempts over the MaxClients limit will normally be queued, up to a number based on the ListenBacklog directive. Once a child process is freed at the end of a different request, the connection will then be serviced.
For non-threaded servers (i.e., prefork), MaxClients translates into the maximum number of child processes that will be launched to serve requests.
So if 50 requests come in at exactly the same time then 10 will be queued, however keep in mind requests are fast, even if you can only serve 10 request per second then a MaxClients of 40 = 400 requests per second.
Count, how many memory you need for 150 clients.
1 apache process takes around 20M of memory (look your value in 'top'), so 150*20M = 3000M. You have 1024M. And memory not only for apache. Let's take half memory for apache - 512M, each process eats around 20M, so MaxClients = 512M/20M = 25.6, so in this case MaxClients = 25 should be used.
If apache is only user of RAM (no mysql/mongo/redis/memcache), you can set 1024/20=50 MaxClients.
With MaxClients = 150 your server can start use swap and it will looks like server is down.
@rsk:
With mpm-worker it's less than 500KB per connection, people…
It is acting like mpmprefork and failing like mpmprefork, so I'd be surprised if mpm_worker were being used.
@hoopycat:
@rsk:With mpm-worker it's less than 500KB per connection, people…
It is acting like mpmprefork and failing like mpmprefork, so I'd be surprised if mpm_worker were being used.
quack
@rsk:
Just reminding ya that a switch of MPM might be a good move…
;)
If using PHP, FastCGI should be used with mpm-worker:
@OZ:
If using PHP, FastCGI should be used with mpm-worker:
If using FastCGI, it's probably a good idea to ditch Apache altogether and look into nginx+fpm. There are very few cases where you actually need to use mpm-worker with PHP these days, unless you have some insanely complicated rewrite rules in your .htaccess file. Less than 500 freakin' kilobytes per process? Ha, tell that to lighttpd or nginx.
Lighttpd was annoying to me, to get a "recent enough to make any sense" nginx I'd have to compile it myself.
Apache just works, everything that "ass-umes" apache just works, and while it may not be as "efficient" as other options it still handles average of 50 hits/s with peaks of 250 hits/s (latter's my max clients limit, yeah) with negligible CPU load. shrug
Someone who actually knows what he's doing definitely could make it better.
(or go after the current trend and compile nginx; I prefer supported packages, tyvm.)
Anyway, HERE