Server Monitoring3 min read

    How to Monitor Varnish Cache

    By Dana— Server Monitoring & Linux
    Share

    Overview

    Varnish is a powerful reverse caching proxy used as an HTTP accelerator for content-heavy dynamic websites and APIs. Xitoring's Varnish integration provides comprehensive monitoring of cache performance, backend health, thread pools, and session states — ensuring your caching layer delivers maximum performance.

    What Can It Monitor?

    Cache Metrics

    • Cache Hit — Total cache hits
    • Cache Hit Rate — Percentage of requests served from cache
    • Cache Hit Pass per Second — Requests passed through to backend despite cache
    • Cache Miss per Second — Requests not found in cache

    Backend Metrics

    • Backend Connection per Second — New connections to backend servers
    • Backend Request per Second — Requests forwarded to backends
    • Backend Busy per Second — Backend connection pool exhaustion events
    • Backend Fail per Second — Failed backend connections
    • Backend Unhealthy per Second — Unhealthy backend detections
    • Backend Recycle / Reuse per Second — Connection recycling rates
    • Backend Too Late per Second — Expired backend connections

    Resource Metrics

    • CPU — Varnish process CPU utilization
    • Memory — RAM consumed by Varnish
    • N Expired per Second — Objects expired from cache
    • N LRU Nuked per Second — Objects evicted via LRU (Least Recently Used)

    Session & Thread Metrics

    • Client Request per Second — Rate of incoming client requests
    • Session Connection per Second — New client sessions
    • Session Dropped per Second — Dropped client sessions
    • Threads per Second — Worker thread creation rate
    • Thread Queue Length per Second — Requests queued waiting for threads
    • Threads Created / Failed / Limited per Second — Thread lifecycle events

    ESI Metrics

    • ESI Errors per Second — Edge Side Include processing errors
    • ESI Warnings per Second — ESI processing warnings

    Prerequisites

    None! There are no software prerequisites to enable this integration.

    How to Activate the Integration

    Prefer the panel? You don't need the CLI for this step. In Xitoring, open the server, go to Integrations, choose Varnish, fill in the same details, and click Enable. See enabling integrations from the Xitoring panel. The CLI steps below still work if you script your setup.

    Run the Xitogent CLI:

    xitogent integrate
    

    Select Varnish from the list. Xitogent tests the connection and sets up the rest automatically. Within a minute, graphs and data appear on your server page.

    Setting Up Triggers

    All metrics listed above are available as trigger parameters. Key ones to set up:

    • Cache Hit Rate — Alert when it drops below your target (e.g., 90%)
    • Backend Fail per Second — Catch backend connection failures
    • Session Dropped per Second — Detect client connection issues
    • Thread Queue Length — Alert when requests are queuing for threads
    • N LRU Nuked per Second — Detect cache memory pressure

    Navigate to Triggers on your server page, select Varnish, choose a metric, set your threshold, and configure notification channels.

    Tips

    • Varnish integration requires zero configuration — just select it from the CLI
    • Monitor Cache Hit Rate as your primary KPI — higher is better
    • Set alerts on Backend Fail and Backend Unhealthy to catch origin server issues
    • Watch Thread Queue Length — a growing queue means you need more worker threads
    • Track N LRU Nuked per Second — frequent evictions mean your cache needs more memory
    • Use Session Dropped alerts to detect when Varnish is overwhelmed