Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Mar 29, 2011 7:33 am 
Offline
Senior Newbie

Joined: Tue Mar 29, 2011 7:26 am
Posts: 7
Hi,
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


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 7:38 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Set MaxClients 150 to around 40, that should help, then watch your ram usage, you maybe able to increase it after that depending on how much ram other processes are using and how much ram each apache process uses.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 7:52 am 
Offline
Senior Newbie

Joined: Tue Mar 29, 2011 7:26 am
Posts: 7
If I set MaxClients to 40
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.


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 8:08 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
From http://httpd.apache.org/docs/2.2/mod/mp ... maxclients

Quote:
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.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Tue Mar 29, 2011 8:26 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
10 will wait for connect.

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.


Top
   
 Post subject:
PostPosted: Sat Apr 02, 2011 10:52 am 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
With mpm-worker it's less than 500KB per connection, people...

_________________
rsk, providing useless advice on the Internet since 2005.


Top
   
 Post subject:
PostPosted: Sat Apr 02, 2011 4:47 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
rsk wrote:
With mpm-worker it's less than 500KB per connection, people...


It is acting like mpm_prefork and failing like mpm_prefork, so I'd be surprised if mpm_worker were being used.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Sat Apr 02, 2011 5:16 pm 
Offline
Senior Member

Joined: Mon Oct 27, 2008 10:24 am
Posts: 173
Website: http://www.worshiproot.com
hoopycat wrote:
rsk wrote:
With mpm-worker it's less than 500KB per connection, people...


It is acting like mpm_prefork and failing like mpm_prefork, so I'd be surprised if mpm_worker were being used.


*quack*


Top
   
 Post subject:
PostPosted: Sat Apr 02, 2011 8:14 pm 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Just reminding ya that a switch of MPM might be a good move... ;)

_________________
rsk, providing useless advice on the Internet since 2005.


Top
   
 Post subject:
PostPosted: Sun Apr 03, 2011 1:15 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
rsk wrote:
Just reminding ya that a switch of MPM might be a good move... ;)

If using PHP, FastCGI should be used with mpm-worker:
http://ru2.php.net/manual/en/faq.instal ... on.apache2


Top
   
 Post subject:
PostPosted: Sun Apr 03, 2011 2:17 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
OZ wrote:
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.


Top
   
 Post subject:
PostPosted: Sun Apr 03, 2011 5:59 am 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Per thread, not per process.
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*

_________________
rsk, providing useless advice on the Internet since 2005.


Top
   
 Post subject:
PostPosted: Sun Apr 03, 2011 6:23 am 
Offline
Senior Newbie

Joined: Wed Jun 16, 2010 4:55 pm
Posts: 10
rsk do you mind sharing your mpm-worker config ?


Top
   
 Post subject:
PostPosted: Sun Apr 03, 2011 11:19 am 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Sure, but it quite sucks. "Works for me good enough", you sure know the deal.
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.

_________________
rsk, providing useless advice on the Internet since 2005.


Top
   
 Post subject:
PostPosted: Sun Apr 03, 2011 12:49 pm 
Offline
Senior Newbie

Joined: Wed Jun 16, 2010 4:55 pm
Posts: 10
And you run this with mod_php ? How about all that "PHP is not thread safe" thingy ?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group