Build varnish servers with much higher performance than squid
Source: Internet
Author: User
Set up varnish servers with much higher performance than squid-Linux Enterprise applications-Linux server applications. For more information, see the following. [Author: jackbillow reprint please note the Source: http://www.discuz.net]
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?
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.
4. Compile vcl:
My vcl is as follows:
Backend default {
Set backend. host = "127.0.0.1 ";
Set backend. port = "http ";
}
# I use a machine for testing and the backend is 127.0.0.1: 80. If the varnish machine is separated from the background machine.
Write the ip address or hostname of the corresponding machine.
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