Article Title: Build Varnish servers with much higher performance than Squid. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Arnish is a high-performance open source HTTP accelerator, and Verdens Gang, Norway's largest online newspaper, replaced the original 12 SQUIDS with three Varnish.
The performance is better than before.
Varnish's author, Poul-Henning Kamp, is one of FreeBSD's kernel developers. He believes that today's computers are much more complicated than in 1975. In 1975, there were only two storage media
Type: memory and hard disk. However, in addition to primary memory, the memory of the computer system also includes L1, L2 in the cpu, and even L3 cache. The hard disk also has its own cache device, so squid
The architecture of the cache's self-processing of object replacement cannot be optimized by knowing these situations, but the operating system can be informed of these situations. Therefore, this part of work should be handled by the operating system,
This is the design architecture of Varnish cache.
1. Download the source code package for compilation and installation:
Cd/usr/local/src & wget http://nchc.dl.sourceforge.net/s... arnish-1.1.1.tar.gz
Tar zxvf/usr/local/src/varnish-1.1.1.tar.gz
Cd/usr/local/src/varnish-1.1.1
./Autogen. sh
./Configure -- enable-debugging-symbols -- enable-developer-warnings -- enable-dependency-tracking
NOTE: If your gcc version is 4.2.0 or later, you can add the -- enable-extra-warnings compilation parameter to get an additional warning when an error occurs.
I am using the source code package. If you are using redhat or centos, you can use the rpm package for installation (rpm download location: http: // sourceforge.net/project/showfiles.php?
Group_id = 155816 & package_id = 173643 & release_id = 533569 ).
2. Create a cache directory:
Mkdir-p/cache/varnish/V & chown-R nobody: nobody/cache
3. Compile the Startup file:
Cd/usr/local/varnish/sbin
Vi start. sh
The content is as follows:
#! /Bin/sh
# File: go. sh
Date-u
/Usr/local/varnish/sbin/varnishd \
-A 10.0.0.129: 80 \
-S file,/cache/varnish/V, 1024 m \
-F/usr/local/varnish/sbin/vg. vcl. default \
-P thread_pool_max = 1500 \
-P thread_pools = 5 \
-P listen_depth = 512 \
-P client_http11 = on \
Note:-a specifies the ip address or hostname of the backend server, just like the originserver of squid when performing revese proxy.
But this can also be written in vcl.
-F indicates the vcl file used.
-S specifies the storage type, file location, and size of the cache directory.
-P is some startup parameters for varnish startup. You can optimize varnish performance based on your machine configuration.
You can use varnishd -- help to view the specific meanings of other parameters.
[1] [2] Next page