1. 程式人生 > >3 Tips to Boost the Performance of your Varnish Cache

3 Tips to Boost the Performance of your Varnish Cache

TIP #3 : Browser optimization

Browser limits the number of concurrently HTTP requests on the same domain (RFC2616). Of course, you cannot change the client’s browser configuration, but you can work around this limitation.

To override this limit, multiple DNS A entries have to be created: cache-{s}.domain.com

, with s between 1 and 4, to help the browser dealing with numerous requests. This is according to leafletjs.com recommendations.

Let’s override the browser limitation, it can handle it.

For example, an image is about 30ko and could be downloaded in approximately 320ms, which is nearly 3 images per second. Let say we have a standard browser which can handle

6 connections simultaneous.

A = number of images per second in one connectionB = number of connection simultaneous in the browserC = number of subdomains D = number of images per second
A x B x C = D
In this example, a standard browser can display 72 images per second, instead of 18.

This limit can be reached when you fetch a lot of images to display a large mosaic, for instance Google Maps tiles.