Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Jun 24, 2011 9:54 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 26, 2011 7:43 am
Posts: 59
Hi,

I am using a 2GB Linode and I need some assistance in fine tunning the apache application. The server is installed with an open source CRM Application called CiviCRM and MySQL is installed on a different server.

This web application will be used by about 1000 users to to begin with and may scale depending on performance and usage.

Can anyone help me fine tune the apache application for this kind of requirement so that i can make best use of the hardware and application itself.

Thanks a lot.
Avinash


Top
   
 Post subject:
PostPosted: Sat Jun 25, 2011 4:16 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
in file /etc/apache2/apache2.conf:
turn off KeepAlive:
Code:
KeepAlive Off

"prefork" is default variant, so find "IfModule mpm_prefork_module" string and edit block:
Code:
<IfModule mpm_prefork_module>
    StartServers          3
    MinSpareServers       3
    MaxSpareServers       5
    MaxClients           85
    MaxRequestsPerChild   4000
</IfModule>

"MaxClients 85" - assuming each PHP process takes ~20M of memory, 85 * 20M = 1700M (so you will have (2048M - 1700M) free memory for cachers, as minimum).

For PHP: install APC.

If you can find good instruction - install nginx in front of apache.


Top
   
 Post subject:
PostPosted: Sat Jun 25, 2011 7:27 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 26, 2011 7:43 am
Posts: 59
Dear OZ,

Thanks so much.

Few clarifications. If I am understanding correctly, does MaxClients value indicate the number of concurrent users using the web service?

This is the prefork module in my httpd.conf. I didn't find apache2.conf file.


<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000


Also, you have mentioned **you will have (2048M - 1700M) free memory for cachers, as minimum)** how is this possible, cox, I have only 2GB RAM on my server.

What is APC?

Apologies for my very basic questions.
Avinash



OZ wrote:
in file /etc/apache2/apache2.conf:
turn off KeepAlive:
Code:
KeepAlive Off

"prefork" is default variant, so find "IfModule mpm_prefork_module" string and edit block:
Code:
<IfModule mpm_prefork_module>
    StartServers          3
    MinSpareServers       3
    MaxSpareServers       5
    MaxClients           85
    MaxRequestsPerChild   4000
</IfModule>

"MaxClients 85" - assuming each PHP process takes ~20M of memory, 85 * 20M = 1700M (so you will have (2048M - 1700M) free memory for cachers, as minimum).

For PHP: install APC.

If you can find good instruction - install nginx in front of apache.


Top
   
 Post subject:
PostPosted: Sat Jun 25, 2011 9:27 am 
Offline
Senior Member

Joined: Sat Mar 12, 2011 3:43 am
Posts: 76
Location: Russia
Avinash.Rao wrote:
This is the prefork module in my httpd.conf. I didn't find apache2.conf file.

I just don't know your OS. Anyway, params are identical in both files, so you can see which numbers you can change.

Avinash.Rao wrote:
Also, you have mentioned **you will have (2048M - 1700M) free memory for cachers, as minimum)** how is this possible, cox, I have only 2GB RAM on my server.

(2048M - 1700M) = 348M of memory. It was expanded just to illustrate.

Avinash.Rao wrote:
What is APC?

http://php.net/manual/en/book.apc.php


Top
   
 Post subject:
PostPosted: Sat Jun 25, 2011 10:37 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 26, 2011 7:43 am
Posts: 59
I am using CentOS 5.6 64-bit.

Thanks again.


OZ wrote:
Avinash.Rao wrote:
This is the prefork module in my httpd.conf. I didn't find apache2.conf file.

I just don't know your OS. Anyway, params are identical in both files, so you can see which numbers you can change.

Avinash.Rao wrote:
Also, you have mentioned **you will have (2048M - 1700M) free memory for cachers, as minimum)** how is this possible, cox, I have only 2GB RAM on my server.

(2048M - 1700M) = 348M of memory. It was expanded just to illustrate.

Avinash.Rao wrote:
What is APC?

http://php.net/manual/en/book.apc.php


Top
   
 Post subject:
PostPosted: Sun Jul 03, 2011 2:21 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 26, 2011 7:43 am
Posts: 59
Hi OZ,

I have studied the Apache Performance Tuning at http://httpd.apache.org/docs/2.2/misc/perf-tuning.html

I have a rough idea of how this works but am yet to understand it completely.

The application is open for about 10,000 users and I am expecting about 350 concurrent users when the application is released. How do i configure apache for this kind of a requirement. I have also upgraded the server to 4GB RAM.

Thanks.


OZ wrote:
in file /etc/apache2/apache2.conf:
turn off KeepAlive:
Code:
KeepAlive Off

"prefork" is default variant, so find "IfModule mpm_prefork_module" string and edit block:
Code:
<IfModule mpm_prefork_module>
    StartServers          3
    MinSpareServers       3
    MaxSpareServers       5
    MaxClients           85
    MaxRequestsPerChild   4000
</IfModule>

"MaxClients 85" - assuming each PHP process takes ~20M of memory, 85 * 20M = 1700M (so you will have (2048M - 1700M) free memory for cachers, as minimum).

For PHP: install APC.

If you can find good instruction - install nginx in front of apache.


Top
   
 Post subject:
PostPosted: Sun Jul 03, 2011 4:37 am 
Offline
Senior Newbie

Joined: Thu May 07, 2009 6:13 am
Posts: 18
It depends on how you're running PHP. For example, if you're running PHP-FPM then configuring Apache is not really where you want to be looking because Apache isn't going to be handling the PHP processes.


Top
   
 Post subject:
PostPosted: Sun Jul 03, 2011 10:41 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 26, 2011 7:43 am
Posts: 59
Does this mean that, apache can be left with the default configuration and we need to fine tune PHP, considering how PHP is configured? I didn't see this mentioned in the Apache fine tuning website and hence the question.


AlexC wrote:
It depends on how you're running PHP. For example, if you're running PHP-FPM then configuring Apache is not really where you want to be looking because Apache isn't going to be handling the PHP processes.


Top
   
 Post subject:
PostPosted: Sun Jul 03, 2011 11:02 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
If apache isn't handling PHP requests then it's memory usage will be considerably lower all it will be doing is handling static files (and in this case I'd switch to mpm-worker over prefork since it's threaded and will use less memory).

Maybe if you told us your setup then we'd be able to give better advise.

What apache MPM are you running?
(run apache2ctl -M | grep mpm to find out)

How are you running php? FPM/Fastcgi/Apache2/CGI(hopefully not)

_________________
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: Sun Jul 03, 2011 11:10 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 26, 2011 7:43 am
Posts: 59
Thanks for the response. I am awaiting response from my developer to provide details of PHP and i will post the details as soon as i receive them.

I couldn't find apache2ctl -M command, its apachectl (without the 2). First few lines of the output..

Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authn_alias_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authn_default_module (shared)
authz_host_module (shared)
authz_user_module (shared)


obs wrote:
If apache isn't handling PHP requests then it's memory usage will be considerably lower all it will be doing is handling static files (and in this case I'd switch to mpm-worker over prefork since it's threaded and will use less memory).

Maybe if you told us your setup then we'd be able to give better advise.

What apache MPM are you running?
(run apache2ctl -M | grep mpm to find out)

How are you running php? FPM/Fastcgi/Apache2/CGI(hopefully not)


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


Who is online

Users browsing this forum: No registered users and 2 guests


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