Kwissle

My real-time quiz battle game Kwissle.com

Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Photos

Photoalbum, both old and new.

Twitter

Follow me on Twitter

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 
Linux

Nginx vs. Squid


16th of March 2009

We all know that Nginx is fast and very lightweight. We also know that Squid is very fast too. But which one is fastest?

In an insanely unscientific way I added some rewrite rules to my current Nginx -> Squid -> Zope stack so that for certain static content, Nginx could go straight to the filesystem (where the Zope product holds the static stuff) to bypass the proxy pass. Then I did a quick and simple benchmark with ab comparing how to get a 700 bytes GIF image:

 squid: 2275.62 [#/sec] (mean)
 nginx: 7059.45 [#/sec] (mean)

Let's not focus too much on the numbers because at these high ranges so many other factors are important. I ran the tests several times and indeed it goes up and down by a factor of 500-1000 #/sec. However the interesting thing here is that Nginx is faster. Squid is already very fast since it serves straight from RAM and it's built for speed but the problem I have with Squid is Squid itself. It's yet another thing that can go wrong and it costs CPU and memory.

This is just the first of many thoughts in this direction. At the moment I can't throw out Squid because it's used to cache certain HTML pages for short periods in my Zope sites. But what I've learned today is that Squid can easily be discarded if you can get it right with Nginx.



Comment

Ash Berlin - 26th March 2009  [«« Reply to this]
You should look at Varnish for replacing your caching needs. http://varnish.projects.linpro.no/
Ryan Malayter - 12th January 2010  [«« Reply to this]
Nginx now includes proxy_cache. Haven't done any full benchmarks (micro-benchmarks like ab don't tell you much about real-world performance). But we replaced Squid anyway, just to simplify the stack. It "feels" faster, probably because of the reduced latency.
http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache
Peter Bengtsson - 12th January 2010   [«« Reply to this]
Interesting. So with nginx we can no do basic load balancing, proxy caching, static serving and dynamic proxying. It's catching up with apache in features but with speed.
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.