There are a range of web caching software options designed to help speed up your website or app. In this post, we focus on two of the major ones.
Varnish Cache is a powerful front end accelerator or caching HTTP reverse proxy that lets users cache both static and dynamic content leading to much faster page load times (300-1000x times). It is mainly used to cache content in front of a web server. In addition to its speed, Varnish Cache is popular for the flexibility of its programming language, Varnish Cache Configuration Language (VCL). VCL allows developers to specify request handling rules and set specific caching policies giving them a lot of control over what and how they cache.
Varnish was designed for content-heavy dynamic websites as well as APIs, and is used accordingly by sites such as Wikipedia, online newspapers including The New York Times, and social media sites like Facebook and Twitter.
Nginx is an older caching option; its first iteration was released in 2004. It is an open source web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. Nginx has a reputation for speed and efficiency, particularly in relation to handling concurrent applications, making it popular with some of the world’s most popular websites, including one-third of the Fortune 50 companies and 5 of the 10 largest tech firms. Compared to Varnish Cache, it is a standalone solution, allowing the running of an entire application. Its commercial version, Nginx Plus, offers various features that the OSS version does not.
How do they Compare?
- Varnish Cache supports ESI while Nginx doesn’t; Nginx supports SSL where Varnish Cache doesn’t
- Varnish Cache is a pure web cache that has more advanced cache-specific features than Nginx; however Nginx can act as a “true” cache server when placed in front of an application server/s
- Varnish Cache has a lot of flexibility, allowing developers to create a more complex caching structure than Nginx
- Varnish Cache has a built-in mechanism that lets you purge content while Nginx OSS does not natively support this (however, Nginx Plus does)
- Nginx is known for its highly efficient serving of static content, particularly when the static files are on the same server as Nginx If you want to avoid additional overhead by introducing new technologies, Nginx might be a better fit
Squid is a caching and forwarding HTTP web proxy that began life as a client-side cache. The most significant difference to Varnish Cache is that Squid is a forward proxy that can be configured as a reverse proxy rather than having been built as one. Squid is older than Varnish Cache and offers more extensive features; however, it offers less flexibility to run policies. Squid is primarily used for HTTP and FTP, but does offer support for several other protocols, including SSL and TLS.
nuster is a new high performance HTTP proxy cache server based on HAProxy to primarily be used to cache and proxy requests to web servers. Its dynamic caching abilities are highly configurable. It offers cache purging. nuster also supports HTTP2. Some benchmark tests (NB run by nuster) have concluded that nuster is almost three times faster than Nginx when both are using a single core, and almost two times as fast as Nginx and three times as fast as Varnish Cache when using all cores.
Which is the Best?
There is no one right answer to the web caching software right for you. Every use-case is different. You have to choose the right one for your website.
Run them all, or any of them on section.io.
For more information on the our modular Edge PaaS, check out our documentation!