Varnish Study Notes
Varnish cache is an open-source high-performance cache server. Compared with the old Squid, Squid has the following advantages.
1: varnish is based on memory cache data, so the processing speed is faster than Squid.
2: varnish supports a higher concurrency and is more stable than Squid.
3: varnish can be managed through ports, but squid does not.
4: the disadvantage of varnish is that if the service is down, all memory data is released.
Varnish's working mode. First, varnish has two processes, one management process, which initializes the worker process, loads and compiles the vcl configuration file, and initializes the data structure. The worker process generates multiple threads: the thread that processes the request, the thread that manages the thread pool, the worker thread, the scheduling thread, and the thread that detects the cache expiration time. Generally, varnish supports two thread pools. Each thread pool has a maximum of 500 working threads and a minimum of five. Therefore, you can concurrently connect to 1000 threads.
The request process of varnish is vcl_recv vcl_pass vcl_pipe vcl_hash vcl_hit vcl_miss vcl_fetch vcl_deliver.