Install varnish:
Yum-y install PCRE * ncurses-devel
Tar-zxvf varnish-2.1.2.tar.gz
CD Varnish-2.1.2
./Configure -- prefix =/usr/local/Varnish/-- enable-dependency-tracking -- enable-debugging-symbols -- enable-developer-Warnings
Make & make install
Varnishd workflow:
Varnishd processes HTTP requests, which are defined by varnish functions.
After the client sends a request to varnishd, varnish receives the request and enters the receive State. According to the VCL function rules, it determines that the request should enter the pass mode (after the backend host responds, it returns the request to the client, do not cache, the client obtains the latest content each time) or pipe mode (returns the cached unchanged content to the client), or enters Lookup (local query, search in the cache ).
When you enter the lookup status, the content will be searched in the cache. If you find the content, it will enter the hit status. If you do not find the content, it will enter the Miss status.
In the pass status, the backend request fetch status is displayed.
In the fetch status, obtain data from the backend and store the cache locally.
In the deliver status, return the obtained data to the client to complete this request.
The discard module automatically calls this module when the cached data expires or the cache space is insufficient.
Receive ------ Pass \ pipe
|
|
| Fetch -----
| Bytes |
|
Lookup --- Miss |
|
| Bytes
Hit ----------- deliver
This article is from the "fate" blog, please be sure to keep this source http://czybl.blog.51cto.com/4283444/1544830
Varnish cache service installation and working principles