Varnish

The number 1 caching technology for superfast websites and applications

The speed and stability of your web servers is crucial for optimal user experience. Fortunately, there is a solution that ensures the stability and speed of your servers at all times: caching, i.e. storing frequently requested static content.

Varnish is the most widely used caching technology (and, in many cases, also the most recommended).

  • Ensuring fast and stable servers
  • Optimal user experience for your web application
  • Easy implementation
Cloud back-up

What is Varnish?

Varnish is a unique form of caching. It caches entire web pages to make a website faster. Varnish captures the HTTP traffic destined for the web application and serves cached pages to the visitors. This way, the application is no longer overloaded and stability is guaranteed.

In addition to Varnish, there are other caching technologies, such as Redis, OPcache and APCu.

What is Varnish?

Fun fact: Varnish was originally built as a custom solution to speed up the Norwegian online newspaper www.vg.no, and it is now used by millions of websites worldwide.

Would you like to learn more about how Varnish works and its benefits?

The benefits of Varnish

The benefits of Varnish are obvious: it ensures the speed, stability and performance of your web application.

Varnish can handle a large number of simultaneous connections and uses very little memory. Varnish's CPU usage is also very low. Varnish only focuses on caching and offers few other features. This makes the architecture very efficient.

Varnish caches entire pages to reduce the load on the server. The fact that the cached items are stored in RAM makes this system remarkably fast.

A single Varnish server delivers outstanding performance:

  • 800,000 requests per second
  • Throughput of 200 Gbps
  • Latency of less than one millisecond
E-book
Lightning-fast sites with Varnish
Lightning-fast sites with Varnish
Download this e-book

How does Varnish work?

Varnish acts as a web server (between the user and the web application) and communicates via the HTTP protocol. This way, HTTP traffic is not directly sent to the web application but is diverted to Varnish instead.

How does Varnish cache the data?

Unlike other caching technologies, Varnish caches entire web pages. Since these pages are cached separately, they do not have to be requested from the server when the web page is visited again, making the page much faster to display.

When a user wants to access a web page that has not yet been cached, Varnish will connect to the web application and forward the original request. The HTTP output of the requested web page that the web application forwards is stored in Varnish.

This information remains cached as long as the Time To Live has not expired. This Time To Live (TTL) is determined by the "Cache-Control" header. This header is part of the web application's HTTP response and is used by Varnish to determine how long the web page may be cached.

When are the data cached and when are they not?

Varnish will only return cached web pages if it is certain that the content is not private. When authentication is required or a cookie is used, the response is only suitable for the user in question and not for the rest of the visitors. In this case, Varnish will not cache the specific web page.

It is not always necessary to cache a web page. The web application can decide that a page should not be cached.

In addition, Varnish has some internal rules that determine when to cache the data and when not to cache them:

Varnish can decide to bypass the cache and still send the request to the web server. Even if the requested web page is stored in the cache.

Would you like to get started with Varnish?

What is Varnish Configuration Language (VCL)?

VCL is a special programming language that can be used to configure the caching behaviour of Varnish.

VCL can be used for the following tasks:

  • Inspecting HTTP requests and responses
  • Manipulating HTTP requests and responses
  • Determining the cache behaviour
  • Selecting the desired web server
  • Determining the TTL of objects
  • Possible communication with external systems
  • Tailoring of synthetic HTTP responses

The VCL code is contained in a VCL file located on the Varnish server.

Implementing Varnish

Without Varnish, a user's request will be sent directly to the web application. When implementing Varnish, a Varnish server will come in between.

Theoretically, if you want to enable Varnish, all you need to do is make sure that the "www" DNS record of your domain name points to the Varnish server. If your application complies with the HTTP caching rules, the rest will not cause any problems. Getting started with Varnish is just that simple.

In practice, you need to check carefully how your web application handles HTTP:

  • Are there certain parts of web pages that should not be cached?
  • Are there certain parts of web pages that can be cached, even if they use cookies?
  • Are there any cookies that need to be deleted in order for the cache to work correctly?
  • Are certain cache variations possible based on cookies?
  • Does the web application use Cache-Control headers to determine the TTL?

In specific situations, some objects must be explicitly removed from the cache.

Just think, for example, of the front page of a news site. When there is breaking news, the news site cannot wait for the TTL of the cached content to expire. The pages in question must therefore be removed from the cache immediately.

For this, you can count on VCL.

Common platforms such as WordPress, Drupal, Joomla and Magento offer VCL templates that take the behaviour of the framework in question into account.

Get the most out of Varnish… and your application

Combell's experts have learned all there is to know about Varnish. Together with you, we look for the best solution for your specific application. We are also at your disposal for other caching solutions. As an extension to our web hosting packages or as a tailored solution to optimise the performance of your application.

Do you need an efficient Varnish solution?

FAQ

Varnish is a unique form of caching. It caches entire web pages to make a website faster. By storing a temporary copy of a web page, the computer no longer needs to regenerate the data.
Varnish can handle a large number of simultaneous connections and uses very little memory. Varnish's CPU usage is also very low.

This is how Varnish guarantees:
  • Fast loading times
  • A stable website
  • Optimal user experience
.
When a user wants to access a web page, Varnish connects to the web application and forwards the original request. The HTTP output of the requested web page forwarded by the web application is stored in Varnish.

Varnish stores entire web pages in the cache (in RAM). This way, they no longer need to be requested from the server when the web page is visited again. This ensures that the page is displayed much faster.

Rely on our Varnish experts

Rely on our Varnish experts

For years, Combell has been committed to achieving fast loading times and optimal user experience by means of caching solutions, including the popular Varnish.

Together with you, we look for the best solution for your website or application. Our experienced specialists are responsible for selecting and implementing the best caching solution.

Rely on our Varnish experts

Awards

Smart Business Awards Hosting & Domain Names 2017
ISPGids
Twinkle Awards Hosting & Domain Names 2016
Webhosters.nl