/
Pack Hosting Panel

Varnish statistics

How to determine if varnish and the FPC of your page achieve optimally.


To use the commands in this article we assume you have configured aliases as described in Varnish Basics

Cache hit rate

The cache hit rate is the percentage of requests served by varnish and not your PHP server. The higher this percentage the higher the speed your visitors are serviced with.

Find this percentage by using this command:

$ varnishstat

Uptime mgt:	 0+19:09:45                                                   Hitrate n:            10	         100          236
Uptime child:    0+19:09:46                                                  avg(n):        0.1918        0.2552       0.2491

    NAME                                         CURRENT        CHANGE       AVERAGE        AVG_10       AVG_100     AVG_1000
MGT.uptime                                    0+19:09:45
MAIN.uptime                                   0+19:09:46
MAIN.sess_conn                                   4175060        141.71         60.52         60.62         57.82	    57.82
MAIN.client_req                                  4245300        141.71         61.54         60.62         57.82	    57.82
MAIN.cache_hit                                    938985         42.91         13.61         10.90          9.17		 9.17
MAIN.cache_miss                                  2457485         98.80         35.62         49.11         48.09	    48.09
...
...
...

The Hitrate percentage represents the past n requests. In this example: Last 10 requests: 19,18% last 100 requests: 25,52% Last 236 requests: 24,91%

Whether these percentages are low or high depends mainly on the application itself. A shop for example which has a very high conversion will have a lower percentage. Because of the fact that relatively more people are in the checkout which is not being cached.

Memory usage

To check if varnish uses just enough or too much memory, use the varnishstat command:

We are now looking for the g_bytes en g_space stats.

$ varnishstat

    NAME                                         CURRENT        CHANGE       AVERAGE        AVG_10       AVG_100     AVG_1000
MGT.uptime                                    0+19:09:45
MAIN.uptime                                   0+19:09:46
...
...
SMA.s0.c_bytes                                    43.68G       881.87K       657.40K       781.48K       795.49K      793.00K
SMA.s0.c_freed                                    39.68G       900.86K       597.19K       784.63K       795.83K      793.07K
SMA.s0.g_alloc                                   1000036         74.79           .       999787.76     998530.86    997099.17
SMA.s0.g_bytes                                     4.00G       -18.99K          .            4.00G         4.00G        4.00G
SMA.s0.g_space                                   110.82K        18.99K          .           82.45K        76.96K       62.70K
  • g_bytes Total memory in use
  • g_space Available varnish memory