Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject:
PostPosted: Thu Feb 24, 2011 9:26 pm 
Offline
Senior Newbie

Joined: Mon Feb 14, 2011 1:04 pm
Posts: 12
exiges wrote:
johnson46 wrote:
Performance improved slightly. Just looking into other ways to reduce the amount of requests per load on the server. Nginx as a reverse proxy might be the solution.


Consider using Squid as a front-end transparent proxy/cache, forwarding dynamic requests to Apache.

Apache processes tend to be large and have lingering closes which can swamp a server.

By letting a front end proxy handle the static stuff, Apache is freed up to do the few (percentage wise) dynamic requests.

On our servers, over 90% of requests to our servers are handled by Squid and never make it to Apache.


I'll look into it. Thanks for the recommendation.

Now that I've had a chance to remove a lot of the bloat left over while on shared hosting, the forum is performing very well.

I'm still looking to scrap apache altogether and replace it with nginx + php-fqm + memcache + apc. The tests so far have exceeded all expectations.

Here is my test set up:

Nginx - No Cache (Still looking for a solution)
PHP-fqm - APC
Vbulletin - Memcache

Wouldn't mind having squid or varnish in front to handle all non cached static requests.

Just glad it wasn't the lower hosting packages being overloaded. I've been a fan of linode and set up for a while now and am pleased with the results.


Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 9:48 pm 
Offline
Senior Member

Joined: Mon Oct 27, 2008 10:24 am
Posts: 173
Website: http://www.worshiproot.com
Don't bother sticking anything in front of nginx. Nginx is perfectly capable of handling static requests _very_ efficiently.


Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 9:57 pm 
Offline
Senior Newbie

Joined: Mon Feb 14, 2011 1:04 pm
Posts: 12
JshWright wrote:
Don't bother sticking anything in front of nginx. Nginx is perfectly capable of handling static requests _very_ efficiently.


I'll test out both scenarios. I assume the following would be optimal:

Varnish --(Static)-> Nginx
Nginx --(Dynamic)-> php-fpm(apc)
Vbulletin -> Memcache


Last edited by johnson46 on Thu Feb 24, 2011 11:04 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 10:49 pm 
Offline
Senior Member

Joined: Mon Oct 27, 2008 10:24 am
Posts: 173
Website: http://www.worshiproot.com
A static request coming in should be handled directly by Nginx.
A dynamic request would be proxied by Nginx to a PHP FastCGI process.


Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 11:03 pm 
Offline
Senior Newbie

Joined: Mon Feb 14, 2011 1:04 pm
Posts: 12
JshWright wrote:
A static request coming in should be handled directly by Nginx.
A dynamic request would be proxied by Nginx to a PHP FastCGI process.


Posted the static order incorrectly :) Meant to put varnish ahead of nginx.


Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 11:05 pm 
Offline
Senior Member

Joined: Mon Oct 27, 2008 10:24 am
Posts: 173
Website: http://www.worshiproot.com
You won't gain anything by putting varnish in front of nginx.


Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 11:07 pm 
Offline
Senior Newbie

Joined: Mon Feb 14, 2011 1:04 pm
Posts: 12
JshWright wrote:
You won't gain anything by putting varnish in front of nginx.


Hopefully not so I have one less server to worry about.


Top
   
 Post subject:
PostPosted: Thu Feb 24, 2011 11:13 pm 
Offline
Senior Newbie

Joined: Mon Apr 07, 2008 6:51 pm
Posts: 6
I would have to agree. nginx is amazingly fast. I use it in front of tomcat on a couple sites to serve static content. I once did a load test using JMeter from my home machine and got several thousand requests per second with no appreciable CPU usage on the machine.


Top
   
 Post subject:
PostPosted: Fri Feb 25, 2011 5:49 am 
Offline
Junior Member

Joined: Wed Feb 09, 2011 7:41 am
Posts: 28
vegardx wrote:
Or - even better - install varnish to serve all static requests and let nginx/apache2 serve dynamic requests. Squid just seems like a bad fix for a small problem.


I wouldn't say it's a "bad fix" if the problem is lack of static content caching. Overkill perhaps as Squid is a very sophisticated bit of software, not just a cache, it can be used as a load balancer, it can be used to map subdomain requests to other ports etc. If you think you may need some of those features in future it may be good to start out with Squid.

For simple caching though, varnish may be the simplest route.


Top
   
 Post subject:
PostPosted: Fri Feb 25, 2011 7:36 am 
Offline
Junior Member

Joined: Wed Feb 09, 2011 7:41 am
Posts: 28
johnson46 wrote:
Here is my test set up:

Nginx - No Cache (Still looking for a solution)
PHP-fqm - APC
Vbulletin - Memcache

Wouldn't mind having squid or varnish in front to handle all non cached static requests.


I've noticed Nginx now has caching, and some say that it's faster than Varnish at serving static content..

http://wiki.nginx.org/NginxHttpProxyMod ... cache_path


Top
   
 Post subject:
PostPosted: Fri Feb 25, 2011 11:15 am 
Offline
Senior Member

Joined: Fri Dec 10, 2010 6:45 pm
Posts: 63
Another reason nginx is best up front is that it handles gzip compression properly.


Top
   
 Post subject:
PostPosted: Fri Feb 25, 2011 11:23 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
What exactly does varnish/squid do that's advantageous to put it before nginx? It caches stuff in memory.

What does the kernel do to disk accesses from nginx if it serves stuff directly? It caches stuff in memory.

So, I doubt there's any real advantage to putting varnish in front of nginx on the same box. Now, if Varnish is on a separate box that does nothing but varnish, sure, that can take some load off. But on the same machine, it's pointless.


Top
   
 Post subject:
PostPosted: Fri Feb 25, 2011 1:13 pm 
Offline
Junior Member

Joined: Wed Feb 09, 2011 7:41 am
Posts: 28
Guspaz wrote:
What exactly does varnish/squid do that's advantageous to put it before nginx? I


None, but there's a good reason for putting it infront of Apache. ( as per OP )

IIRC, nginx can't act as a transparent cache/proxy


Top
   
 Post subject:
PostPosted: Sat Feb 26, 2011 4:28 pm 
Offline
Senior Member

Joined: Mon Oct 27, 2008 10:24 am
Posts: 173
Website: http://www.worshiproot.com
exiges wrote:
IIRC, nginx can't act as a transparent cache/proxy


Sure it can. Running Nginx as a reverse proxy in front of Apache is a rasonably common deployment.


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