SlideShare a Scribd company logo
Debugging your varnish instance
Debugging your Varnish Instance
Varnish Summit, Los Angeles
Federico G. Schwindt
Technical Presales & Engineer
London, UK
fgsch@varnish-software.com
Problems
● Stability
● Functional
● Operational
● Capacity
● Not my problem™
Getting the data
● https://github.com/varnish/varnishgather was born
● Gathers OS,Varnish and companion tools details
● One file per command
Stability
● Crash, panic or something else?
● Check varnishadm panic.show and syslog
● Start from command line
● Install debugging symbols, allow coredumps
● Get your hands dirty
Functional
● Code not reached, wrong logic or expectations
● printf debugging (std.log / std.syslog)
● Enable tracing (param.set vsl_mask +VCL_trace)
● Reproduce with varnishtest
● Check varnishlog
Anatomy of a .vtc
varnishtest "Hello world"
server s1 {
rxreq
expect req.http.msg == "hello"
txresp -body "world"
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
set req.http.msg = "hello";
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.body == "world"
} -run
varnishlog
$ varnishlog -g request
- Begin req 459063 rxreq
- Timestamp Start: 1474493939.499338 0.000000 0.000000
- Timestamp Req: 1474493939.499338 0.000000 0.000000
- ReqStart 1.2.3.4 38780
- ReqMethod GET
- ReqURL /
- ReqProtocol HTTP/1.1
- ReqHeader Host: example.com
- ReqHeader Accept: */*
- ReqHeader Accept-Encoding: gzip
- ReqHeader User-Agent: Mozilla/5.0 (X11; Linux x86_64) ...
- ReqHeader Connection: close
- ReqHeader X-Forwarded-For: 1.2.3.4
- VCL_call RECV
- VCL_return hash
- VCL_call HASH
- VCL_return lookup
- VCL_call MISS
...
Operational
● Low hitrate or high response times
● Inspect headers on the client side
● Use varnishtop
● Increase your EXP with varnishlog
● Understand the waitinglist
Request coalescing
● Automatically enabled for misses
● Only one request at a time goes to the backend
● Other requests for the same object will wait
● Avoids overloading the backend
Capacity
● Inadequate number of threads
● Dataset too big / cache too small
● Monitor varnishstat output
● Did I say varnishlog?
Not my problem
● “It must be the cache” axiom
● Test bypassing Varnish
● Check timeouts
● The truth is on the wire (aka look at tcpdump)
Some examples
● [5-9]xx responses:
○ varnishlog -q 'RespStatus >= 500'
● Misses:
○ varnishlog -q 'VCL_call ~ MISS'
● Timing details:
○ varnishlog -i Timestamp
● Requests taking more than 5 seconds:
○ varnishlog -q 'Timestamp:Fetch[2] > 5.’
● Top requested URLs:
○ varnishtop -i ReqURL
The bottom line
● It is not always the cache
● Not all errors are the same
● Become familiarised with the tools
● varnishlog is the swiss army knife of varnish
Thank you!

More Related Content

PDF
PHP at Density and Scale
PDF
VCL - the logic and logistics
PDF
Structured Testing Framework
PDF
Networking fundamentals
PDF
What is new in Go 1.8
PDF
Reactive by example - at Reversim Summit 2015
PPTX
Ob1k presentation at Java.IL
PDF
Adding replication protocol support for psycopg2
PHP at Density and Scale
VCL - the logic and logistics
Structured Testing Framework
Networking fundamentals
What is new in Go 1.8
Reactive by example - at Reversim Summit 2015
Ob1k presentation at Java.IL
Adding replication protocol support for psycopg2

What's hot (19)

PDF
Skydive 31 janv. 2016
PDF
Skydive 5/07/2016
PDF
Skydive, real-time network analyzer, container integration
PDF
JCache / JSR107 shortcomings
PPTX
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
PDF
Rails hosting
PDF
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
PDF
Improving monitoring systems Interoperability with OpenMetrics
PDF
SRE_Ch12_effective_troubleshooting
PDF
cache2k, Java Caching, Turbo Charged, FOSDEM 2015
ODP
Using Grails to power your electric car
PDF
Performance tests with gatling
PPTX
Containerize ovs ovn components
PPTX
gen_udp and gen_tcp in Elixir
PPTX
OVN DBs HA with scale test
PDF
Perl Instruments
PDF
NYAN Conference: Debugging asynchronous scenarios in .net
PDF
Network Programming With Anyevent
PDF
Managing 600 instances
Skydive 31 janv. 2016
Skydive 5/07/2016
Skydive, real-time network analyzer, container integration
JCache / JSR107 shortcomings
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
Rails hosting
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
Improving monitoring systems Interoperability with OpenMetrics
SRE_Ch12_effective_troubleshooting
cache2k, Java Caching, Turbo Charged, FOSDEM 2015
Using Grails to power your electric car
Performance tests with gatling
Containerize ovs ovn components
gen_udp and gen_tcp in Elixir
OVN DBs HA with scale test
Perl Instruments
NYAN Conference: Debugging asynchronous scenarios in .net
Network Programming With Anyevent
Managing 600 instances
Ad

Viewers also liked (20)

PDF
Debug varnish
PDF
Financial times use case
PDF
How Tesla used Varnish to build their own CDN
PDF
Microservices 2.0
PDF
Varnish access control
PPTX
Trade me use case
PDF
Get started with Varnish
PDF
getting started with varnish
DOCX
RESUME!
PDF
Performance
PDF
Analysing your web traffic with real time statistics
PDF
Do you speak vcl
PDF
Setting up automated tasks
PDF
Stackpath use case
PDF
Massive Storage Engine
PDF
Varnish high availability
PDF
Canadian broadcasting corporation use case
PDF
Pinterest - working with Varnish at scale
PDF
AMedia varnish summit Oslo
PDF
vmod workshop
Debug varnish
Financial times use case
How Tesla used Varnish to build their own CDN
Microservices 2.0
Varnish access control
Trade me use case
Get started with Varnish
getting started with varnish
RESUME!
Performance
Analysing your web traffic with real time statistics
Do you speak vcl
Setting up automated tasks
Stackpath use case
Massive Storage Engine
Varnish high availability
Canadian broadcasting corporation use case
Pinterest - working with Varnish at scale
AMedia varnish summit Oslo
vmod workshop
Ad

Similar to Debugging your varnish instance (20)

PPTX
Debugging varnish
PPTX
Varnish –Http Accelerator
PDF
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
PDF
Varnish Cache
PDF
Supercharging Content Delivery with Varnish
ODP
Accelerate your web app with a layer of Varnish
PDF
Lost in Translation:varnishlog, varnishtest(VUG7)
PDF
Varnish Cache Plus. Random notes for wise web developers
KEY
Introduction to Varnish VCL
PPTX
Varnish
PDF
Do you speak VCL?
PDF
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
PDF
Varnish Web Accelerator
PDF
Varnish - PLNOG 4
PDF
Varnish in action confoo11
PDF
Varnish
PDF
Varnish Cache and Django (Falcon, Flask etc)
PPTX
Starting with varnish cache
PDF
Varnish in action phpday2011
KEY
VCLをTDDで書いてデプロイする
Debugging varnish
Varnish –Http Accelerator
PLNOG 4: Leszek Urbański - A modern HTTP accelerator for content providers
Varnish Cache
Supercharging Content Delivery with Varnish
Accelerate your web app with a layer of Varnish
Lost in Translation:varnishlog, varnishtest(VUG7)
Varnish Cache Plus. Random notes for wise web developers
Introduction to Varnish VCL
Varnish
Do you speak VCL?
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
Varnish Web Accelerator
Varnish - PLNOG 4
Varnish in action confoo11
Varnish
Varnish Cache and Django (Falcon, Flask etc)
Starting with varnish cache
Varnish in action phpday2011
VCLをTDDで書いてデプロイする

More from Varnish Software (20)

PDF
Ask Me Anything on authentication & authorisation in Varnish
PDF
Boozt.com Use Case
PPTX
Akamai connector for varnish
PPTX
Varnish High Availability
PDF
PostNord: Copy On Write
PPTX
Varnish extend
PDF
Streaming with Varnish
PPTX
Edgestash
PPTX
What is new in varnish plus
PDF
Varnish Extend demo
PDF
Varnish extend introduction
PDF
Cedexis introduction
PDF
Secure content caching
PDF
Microservices
PDF
Varnishtest
PDF
Lightning fast with Varnish
PDF
E-commerce use case
PDF
Access control
PPTX
Varnish TLS
Ask Me Anything on authentication & authorisation in Varnish
Boozt.com Use Case
Akamai connector for varnish
Varnish High Availability
PostNord: Copy On Write
Varnish extend
Streaming with Varnish
Edgestash
What is new in varnish plus
Varnish Extend demo
Varnish extend introduction
Cedexis introduction
Secure content caching
Microservices
Varnishtest
Lightning fast with Varnish
E-commerce use case
Access control
Varnish TLS

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PPTX
Machine Learning_overview_presentation.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
Building Integrated photovoltaic BIPV_UPV.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
Machine Learning_overview_presentation.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Dropbox Q2 2025 Financial Results & Investor Presentation

Debugging your varnish instance

  • 2. Debugging your Varnish Instance Varnish Summit, Los Angeles
  • 3. Federico G. Schwindt Technical Presales & Engineer London, UK fgsch@varnish-software.com
  • 4. Problems ● Stability ● Functional ● Operational ● Capacity ● Not my problem™
  • 5. Getting the data ● https://github.com/varnish/varnishgather was born ● Gathers OS,Varnish and companion tools details ● One file per command
  • 6. Stability ● Crash, panic or something else? ● Check varnishadm panic.show and syslog ● Start from command line ● Install debugging symbols, allow coredumps ● Get your hands dirty
  • 7. Functional ● Code not reached, wrong logic or expectations ● printf debugging (std.log / std.syslog) ● Enable tracing (param.set vsl_mask +VCL_trace) ● Reproduce with varnishtest ● Check varnishlog
  • 8. Anatomy of a .vtc varnishtest "Hello world" server s1 { rxreq expect req.http.msg == "hello" txresp -body "world" } -start varnish v1 -vcl+backend { sub vcl_recv { set req.http.msg = "hello"; } } -start client c1 { txreq rxresp expect resp.status == 200 expect resp.body == "world" } -run
  • 9. varnishlog $ varnishlog -g request - Begin req 459063 rxreq - Timestamp Start: 1474493939.499338 0.000000 0.000000 - Timestamp Req: 1474493939.499338 0.000000 0.000000 - ReqStart 1.2.3.4 38780 - ReqMethod GET - ReqURL / - ReqProtocol HTTP/1.1 - ReqHeader Host: example.com - ReqHeader Accept: */* - ReqHeader Accept-Encoding: gzip - ReqHeader User-Agent: Mozilla/5.0 (X11; Linux x86_64) ... - ReqHeader Connection: close - ReqHeader X-Forwarded-For: 1.2.3.4 - VCL_call RECV - VCL_return hash - VCL_call HASH - VCL_return lookup - VCL_call MISS ...
  • 10. Operational ● Low hitrate or high response times ● Inspect headers on the client side ● Use varnishtop ● Increase your EXP with varnishlog ● Understand the waitinglist
  • 11. Request coalescing ● Automatically enabled for misses ● Only one request at a time goes to the backend ● Other requests for the same object will wait ● Avoids overloading the backend
  • 12. Capacity ● Inadequate number of threads ● Dataset too big / cache too small ● Monitor varnishstat output ● Did I say varnishlog?
  • 13. Not my problem ● “It must be the cache” axiom ● Test bypassing Varnish ● Check timeouts ● The truth is on the wire (aka look at tcpdump)
  • 14. Some examples ● [5-9]xx responses: ○ varnishlog -q 'RespStatus >= 500' ● Misses: ○ varnishlog -q 'VCL_call ~ MISS' ● Timing details: ○ varnishlog -i Timestamp ● Requests taking more than 5 seconds: ○ varnishlog -q 'Timestamp:Fetch[2] > 5.’ ● Top requested URLs: ○ varnishtop -i ReqURL
  • 15. The bottom line ● It is not always the cache ● Not all errors are the same ● Become familiarised with the tools ● varnishlog is the swiss army knife of varnish