请输入您要查询的百科知识:

 

词条 Varnish (software)
释义

  1. History

  2. Architecture

  3. Performance

     Performance metrics  Metric collection  varnishstat   varnishlog 

  4. Load balancing

  5. Other features

  6. See also

  7. References

  8. External links

{{self-published|date=June 2014}}{{Infobox software
| name = Varnish
| screenshot =
| logo =
| caption =
| developer = Poul-Henning Kamp, Redpill-Linpro, Varnish Software
| latest release version = 6.2.0
| latest release date = {{release date and age|2019|03|25}}[1]
| programming language = C
| operating system = BSD, Linux, Unix
| genre = HTTP accelerator
| license = two-clause BSD license
}}

Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as APIs. In contrast to other web accelerators, such as Squid, which began life as a client-side cache, or Apache and nginx, which are primarily origin servers, Varnish was designed as an HTTP accelerator. Varnish is focused exclusively on HTTP, unlike other proxy servers that often support FTP, SMTP and other network protocols.

Varnish is used by websites including Wikipedia, online newspaper sites such as The New York Times, The Guardian, The Hindu, Corriere della Sera, social media and content sites such as Facebook, Twitter, Reddit, Vimeo, and Tumblr. In 2012, 5% of the top 10,000 sites in the web used the software.[2]

History

The project was initiated by the online branch of the Norwegian tabloid newspaper Verdens Gang. The architect and lead developer is Danish independent consultant Poul-Henning Kamp (a well-known FreeBSD core developer), with management, infrastructure and additional development originally provided by the Norwegian Linux consulting company Linpro. The support, management and development of Varnish was later spun off into a separate company, Varnish Software.

Varnish is free and open source software, available under a two-clause BSD license. Commercial support is available from Varnish Software, amongst others.

Version 1.0 of Varnish was released in 2006,[3][4] Varnish 2.0 in 2008,[5] Varnish 3.0 in 2011,[6] Varnish 4.0 in 2014,[7] Varnish 5.0 in 2016,[8] and Varnish 6.0 in March 2018.[9]

Architecture

Varnish stores data in virtual memory and leaves the task of deciding what is stored in memory and what gets paged out to disk to the operating system. This helps avoid the situation where the operating system starts caching data while it is moved to disk by the application.

Varnish is heavily threaded, with each client connection being handled by a separate worker thread. When the configured limit on the number of active worker threads is reached, incoming connections are placed in an overflow queue; when this queue reaches its configured limit incoming connections will be rejected.

The principal configuration mechanism is Varnish Configuration Language (VCL), a domain-specific language (DSL) used to write hooks that are called at critical points in the handling of each request. Most policy decisions are left to VCL code, making Varnish more configurable and adaptable than most other HTTP accelerators.{{cn|date=May 2018}} When a VCL script is loaded, it is translated to C, compiled to a shared object by the system compiler, and loaded directly into the accelerator which can thus be reconfigured without a restart.

A number of run-time parameters control things such as the maximum and the minimum number of worker threads, various timeouts, etc. A command-line management interface allows these parameters to be modified, and new VCL scripts to be compiled, loaded and activated, without restarting the accelerator.

In order to reduce the number of system calls in the fast path to a minimum, log data is stored in shared memory, and the task of monitoring, filtering, formatting and writing log data to disk is delegated to a separate application.

Performance

While Varnish is designed to reduce contention between threads to a minimum, its authors claim{{Citation needed|date=August 2012}} that its performance will only be as good as that of the system's pthreads implementation.

Additionally, a slow malloc implementation (like the ones in Microsoft Windows's msvcrt[10][11]) may add unnecessary contention and thereby limit performance, hence the general recommendation of running Varnish on Linux or Unix based environments.

Performance metrics

Varnish Cache can speed up information delivery by a factor of several hundred. To ensure proper operation and performance, Varnish exposes metrics that can be monitored in the following areas:[12]

  • Client metrics: client connections and requests
  • Cache performance: cache hits, evictions
  • Thread metrics: thread creation, failures, queues
  • Backend metrics: success, failure, and health of backend connections

Metric collection

Varnish Cache ships with monitoring and logging tools. One of the most used is varnishstat which gives a detailed snapshot of Varnish’s current performance. It provides access to in-memory statistics such as cache hits and misses, resource consumption, threads created, and more.[13]

varnishstat

Running varnishstat from the command line returns a continuously updating list of all available Varnish metrics. If the -1 flag is added, varnishstat will exit after printing the list one time.[14]

Varnishstat can be used as a standalone tool to spot-check the health of the cache. In order to graph metrics over time, correlate with other statistics from across an infrastructure, and set up alerts about any problems that may arise, monitoring services can integrate with Varnish and collect varnishstat metrics.

varnishlog

varnishlog is a tool that can be used to debug or tune Varnish's configuration, as it provides detailed information about each individual request.

Load balancing

Varnish supports load balancing using both a round robin and a random director, both with a per-backend weighting. Basic health-checking of backends is also available.[15]

Other features

Varnish Cache also features:

  • Plugin support with Varnish Modules, also called VMODs[16]
  • Support for Edge Side Includes including stitching together compressed ESI fragments
  • Gzip Compression and Decompression
  • DNS, Random, Hashing and Client IP-based Directors
  • HTTP Streaming Pass & Fetch
  • Experimental support for Persistent Storage, without LRU eviction
  • Saint[17] and Grace[18] modes.

If a server malfunctions and returns 500 errors, Grace mode will ignore expiry headers and continue to return cached versions. Saint mode is for use when load balancing, where a failing server is blacklisted for a quarantine period and excluded from the server pool.

See also

{{Portal|Free and open-source software}}
  • Web accelerator which discusses host-based HTTP acceleration
  • Proxy server which discusses client-side proxies
  • Reverse proxy which discusses origin-side proxies
  • Comparison of web servers
  • Internet Cache Protocol

References

1. ^{{cite web|url=http://varnish-cache.org/#varnish-6-2-0-is-released|date=15 March 2019|title=Varnish Cache 6.2.0 is released}}
2. ^{{cite web|url=http://royal.pingdom.com/2012/07/11/how-popular-is-varnish/|title=How popular is Varnish}}
3. ^"Making Catalyst Sites Shine with Varnish", Dec. 14, 2008
4. ^[https://www.varnish-cache.org/lists/pipermail/varnish-announce/2006-September/000638.html "Varnish 1.0 released", Sep. 20, 2006]
5. ^[https://www.varnish-cache.org/lists/pipermail/varnish-announce/2008-October/000010.html "Varnish 2.0 released", Oct. 15 2008]
6. ^[https://www.varnish-cache.org/lists/pipermail/varnish-announce/2011-June/000670.html "Varnish 3.0.0 released", Jun. 16 2011]
7. ^[https://www.varnish-cache.org/lists/pipermail/varnish-announce/2014-April/000696.html "Varnish 4.0.0 released", Apr. 10 2014]
8. ^"Varnish Cache 5.0", Sep. 15, 2016
9. ^{{cite web|url=https://varnish-cache.org/lists/pipermail/varnish-announce/2018-March/000726.html|accessdate=15 May 2018|date=15 March 2018|title=Varnish 6.0 Released|author=Poul-Henning Kamp}}
10. ^{{cite web|url=http://www.perlmonks.org/bare/?node_id=810307 |title=Re: Why is Windows 100 times slower than Linux when growing a large scalar?}}
11. ^http://locklessinc.com/benchmarks_allocator.shtml
12. ^{{cite web|url=https://www.datadoghq.com/blog/top-varnish-performance-metrics/|title=Top Varnish performance metrics}}
13. ^{{cite web|url=https://www.datadoghq.com/blog/how-to-collect-varnish-metrics/|title=How to collect Varnish metrics}}
14. ^{{cite web|url=https://linux.die.net/man/1/varnishstat|title=varnishstat - Linux man page}}
15. ^{{cite web|url=https://www.varnish-cache.org/wiki/BackendPolling |title=BackendPolling – Varnish |publisher=Varnish-cache.org |date= |accessdate=2014-07-18}}
16. ^{{cite web|url=https://www.varnish-cache.org/vmods |title=VMODs Directory (Varnish Modules and Extensions) | Varnish Community |publisher=Varnish-cache.org |date= |accessdate=2014-07-18}}
17. ^{{Cite web |title=Saint Mode |website=Varnish |url=https://www.varnish-cache.org/trac/wiki/VCLExampleSaintMode}}
18. ^{{Cite web |title=Grace Mode |website=Varnish |url=https://www.varnish-cache.org/trac/wiki/VCLExampleGrace}}

External links

  • {{official website}}
  • [https://www.varnish-software.com/ Official commercial web site]
  • [//www.varnish-cache.org/trac/wiki/ArchitectNotes Notes from the Architect]
  • "You're Doing It Wrong", June 11, 2010 ACM Queue article by Varnish developer Poul-Henning Kamp describing the implementation of the LRU list.
  • Varnish in Layman's Terms
  • Varnish Cache How-To

8 : Reverse proxy|Free proxy servers|Proxy server software for Linux|Unix network-related software|Free software programmed in C|Free web server software|Cross-platform software|Forward proxy

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/16 16:40:58