Comparison of varnish, squid, Apache, and nginx Cache

Source: Internet
Author: User
Tags varnish

 

1. SquidThe old reverse proxy software has advanced features such as traditional proxy, authentication, and traffic management, but the configuration is too complex. It is currently the most widely used reverse cache proxy server on the internet, working on the CDN of various old users.

2. VarnishIs a new software, simple design, more in line with the current Internet applications, many companies have adopted the varnish software, such as Weibo openapi http://open.t.sina.com.cn.Varnish is based on the memory cache, and the data will disappear after restart.

3. nginxThe reverse proxy cache of nginx is implemented through the proxy_cache module. Currently, this module is still being improved, but many companies have started to use it.

 

 

Some people in the group are always asking what the cache uses, including varnish, squid, Apache, and nginx. what architecture is the cache we use.

1. From these features. Varnish and squid are professional cache services, while Apache and nginx are completed by third-party modules.

2. To use the cache service, we must select a professional cache service, with squid and varnish preferred.

Varnish is more technically advantageous than squid. It adopts the "Visual page cache" technology. In terms of memory utilization, varnish is more advantageous than squid, it prevents squid from frequently exchanging files in memory and disk, and the performance is higher than squid. Varnish cannot be cached on a local hard disk.

There is also a powerful varnish Management port that can be used to quickly and batch clear part of the cache using regular expressions.

Squid's advantage lies in its complete and massive cache technical data and many application production environments (this should be related to Squid's early release ).

3. Talk about nginx. nginx is a buffer made of a third-party module ncache, and its performance basically reaches varnish. However, in the architecture, nginx is generally used as a reverse (there are many static files currently using nginx, concurrent transmission supports up to 20 thousand + ). In a static architecture, if the front-end directly faces the layer-4 load of the CDN active front-end, nginx cache is enough.

4. I think it is acceptable to use local cache to improve the performance of the Apache service, but if Apache is used as the cache service in the system architecture, that's a bit wrong.

---------------------------------------

The following is a review of a student's test data.

I. Test Environment

1. The hardware is a Pentium dual-core device that was bought three years ago. The system is archlinux.

2. When varnish and squid are tested, Apache

3. Five processes are started when Apache is tested. However, as the stress increases, the process increases.

4. During nginx testing, ten nginx processes and 20 PHP-CGI processes were started.

 

5. varnish, squid, and nginx use reverse proxy. That is to say, when accessing images, you must first use the cache Tool

2. Test

1, varnish

[Root @ blackghost bin] #/usr/local/bin/webbench-C 100-T 20 http: // 127.0.0.1: 8080/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
Webbench-simple web benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL open source software.

Benchmarking: Get http: // 127.0.0.1: 8080/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
100 clients, running 20 sec.

Speed = 476508 pages/min, 47258114 Bytes/sec.
Requests: 158836 susceed, 0 failed.

Varnish's cache efficiency hit rate is really high, see:

Varnish

After this access, there is no cache only once, and the efficiency is really high.

2, squid

[Root @ blackghost bin] #/usr/local/bin/webbench-C 100-T 20 http: // localhost: 9000/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
Webbench-simple web benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL open source software.

Benchmarking: Get http: // localhost: 9000/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
100 clients, running 20 sec.

Speed = 133794 pages/min, 7475018 Bytes/sec.
Requests: 44598 susceed, 0 failed.

From the test results, squid is quite disappointing to me. Before the test, I calculated this in my mind. The best cache is varnish, squid, nginx, and Apache, squid is the worst. Later, I looked at the log file and found that under normal circumstances, the ratio of cache to no cache is not. under high pressure, the ratio of cache to no cache is smaller.

3. Apache

[Root @ blackghost conf] #/usr/local/bin/webbench-C 100-T 20 http: // localhost/00/01/rwgowetwvcqaaaaaawhh0rklg81.gif
Webbench-simple web benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL open source software.

Benchmarking: Get http: // localhost/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
100 clients, running 20 sec.

Speed = 160890 pages/min, 15856005 Bytes/sec.
Requests: 53630 susceed, 0 failed.

4. nginx

[Root @ blackghost conf] #/usr/local/bin/webbench-C 100-T 20 http: // localhost: 10000/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
Webbench-simple web benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL open source software.

Benchmarking: Get http: // localhost: 10000/00/01/rwgowetwvcqaaaaaaaawhh0rklg81.gif
100 clients, running 20 sec.

Speed = 304053 pages/min, 30121517 Bytes/sec.
Requests: 101351 susceed, 0 failed.

From the above test results, we can find that varnish> nginx> Apache> squid. I think this result is somewhat different from what you expected, why is squid A Legacy File Cache tool so poor? Squid's hit rate is low. I checked it online. Many people are doing this. This may be related to individual configurations, maybe the real experts can make squid play its best.

Http://www.cnblogs.com/google4y/archive/2011/09/19/2181251.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.