Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jul 19, 2012 1:25 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
Hi

I have a Linode 1536 serving some web applications. I am fairly pleased with how many hits it can serve (dynamic PHP/MySQL/Apache). I'm looking for some insights on how people increase capacity, in particular how do you manage to use keep-alives without filling up every slot very very quickly. To date I've never had keep-alives turned on for production instances because of this.

Thanks.


Top
   
PostPosted: Thu Jul 19, 2012 1:44 pm 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
jonny5alive wrote:
Hi

I have a Linode 1536 serving some web applications. I am fairly pleased with how many hits it can serve (dynamic PHP/MySQL/Apache). I'm looking for some insights on how people increase capacity, in particular how do you manage to use keep-alives without filling up every slot very very quickly. To date I've never had keep-alives turned on for production instances because of this.

Thanks.


You can run a light weight web server like nginx in front of apache that has keepalives on, it will serve static files itself, and pass php requests off to apache which doesn't have keepalives. There's a number of ways this should increase the number of users you can serve. 1) apache talks to nginx via localhost, so the 3 way handshake and data transfer will be lightning quick, 2) static files are no longer handled by apache which probably has mod_php loaded, which uses a lot of memory.

There's lots of other ways to reduce load, tuning mysql so it handles queries faster, apc for php, probably a 100 other things I don't know of.

Oh, and do some benchmarks with web server load testing software before and after changes so you can see you're going in the right direction.


Top
   
PostPosted: Thu Jul 19, 2012 8:44 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
You can also gain substantial advantage by moving to PHP-FPM (now available out-of-the-box in Ubuntu 12.04 LTS!) and using Apache's mpm-worker. Apache isn't the problem here, mod_php is.

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


Top
   
PostPosted: Thu Jul 19, 2012 8:49 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
hoopycat: Would you say PHP-FPM would be similar in performance increase as using nginx in front of Apache would be? I'd welcome not having the significantly increased complexness of nginx. (KISS)


Top
   
PostPosted: Thu Jul 19, 2012 8:59 pm 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
Am I mistaken that PHP-FPM runs in Apache?


Top
   
PostPosted: Fri Jul 20, 2012 11:37 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
PHP-FPM runs outside of the webserver, I don't think Apache will be as fast as nginx, but you can get most of the advantages while sticking with Apache by switching to PHP-FPM and mpm_worker.

It isn't necessarily any *faster*, though. It'll run at the same speed. The big difference is that you can handle the same load with a lot less memory.


Top
   
PostPosted: Fri Jul 20, 2012 11:49 am 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
Good point... looking to serve more users with less resources :) Thanks all. Will make some VMs and try it all out.


Top
   
PostPosted: Sat Jul 21, 2012 4:57 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
My opinion (with no data to backup my opinion) is if you want to stick with apache and do what hoopycat said, it will be comparable with nginx in terms of number of concurrent users, since serving static files isn't the bottleneck, php is. apache might use more memory to serve static files, but since those files will be served so quick compared to php, it's not an issue.


Top
   
PostPosted: Mon Jul 23, 2012 10:14 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
That's true, although depending on the site, the static files can add up quick. It's not hard to have a few dozen static files served for a single PHP script.


Top
   
PostPosted: Mon Jul 23, 2012 10:58 am 
Offline
Senior Member

Joined: Thu Oct 08, 2009 5:07 pm
Posts: 99
Made good progress using nginx and PHP-FPM on CentOS. Nice caching and load balanced reverse proxy features were easy to figure out.


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


Who is online

Users browsing this forum: No registered users and 3 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