Skip to content

Commit 84aff72

Browse files
author
Jonathan Visser
committed
Fix markdown formatting for improving-varnish-hit-rate-on-hypernode.md
1 parent 86d2167 commit 84aff72

File tree

1 file changed

+41
-19
lines changed

1 file changed

+41
-19
lines changed

docs/hypernode-platform/varnish/improving-varnish-hit-rate-on-hypernode.md

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
myst:
33
html_meta:
4-
description: Learn how to improve your Varnish cache hit rate on Hypernode by identifying automatic cache purges, analyzing hit/miss patterns, and optimizing URL normalization to boost performance and efficiency.
4+
description: Learn how to improve your Varnish cache hit rate on Hypernode
5+
by identifying automatic cache purges, analyzing hit/miss patterns, and
6+
optimizing URL normalization to boost performance and efficiency.
57
title: Improving Varnish Cache Hit Rate on Hypernode
68
---
79

@@ -17,13 +19,15 @@ This guide takes you step-by-step from verifying that your cache is active to di
1719
## Before You Begin
1820

1921
Typical cache hit rates:
20-
- **Below 10%** → Cache is barely reused
21-
- **30–70%** → Improvement possible (depends on shop type and traffic patterns)
22-
- **Above 80%** → Generally healthy for most shops
22+
23+
- **Below 10%** → Cache is barely reused
24+
- **30–70%** → Improvement possible (depends on shop type and traffic patterns)
25+
- **Above 80%** → Generally healthy for most shops
2326

2427
Keep in mind:
25-
- Staging environments typically have low hit rates
26-
- B2B webshops often have lower hit rates due to personalization
28+
29+
- Staging environments typically have low hit rates
30+
- B2B webshops often have lower hit rates due to personalization
2731
- Recently flushed caches temporarily reduce hit rates until the cache warms up
2832

2933
Cache hit rate should always be evaluated in context. Traffic volume, personalization, and recent deployments directly affect cache reuse.
@@ -32,11 +36,11 @@ Cache hit rate should always be evaluated in context. Traffic volume, personaliz
3236

3337
A low hit rate does not always indicate a problem. It is normal when:
3438

35-
- Traffic volume is low
36-
- The cache was recently flushed
37-
- Most visitors are logged in
38-
- The shop uses heavy personalization
39-
- You are working in a staging environment
39+
- Traffic volume is low
40+
- The cache was recently flushed
41+
- Most visitors are logged in
42+
- The shop uses heavy personalization
43+
- You are working in a staging environment
4044

4145
Investigate further only if traffic is stable, the cache is warmed up, and the hit rate remains consistently low.
4246

@@ -46,7 +50,8 @@ Ensure Varnish is properly enabled on your vhost and configured in your
4650
application (e.g. Magento 2).
4751

4852
For Magento 2, verify:
49-
- That Varnish is enabled on the vhost
53+
54+
- That Varnish is enabled on the vhost
5055
- Varnish is selected as the caching application
5156
- The correct VCL is generated and loaded
5257
- Full Page Cache (FPC) is enabled
@@ -60,10 +65,13 @@ Tip: The [elgentos/magento2-varnish-extended](https://github.com/elgentos/magent
6065
## Step 2 — Check if Pages Are Being Cached
6166

6267
Using `varnishncsa` from the CLI to see in real time which pages are cached and which are not:
63-
```console
68+
69+
```console
6470
varnishncsa -F '%U%q %{Varnish:hitmiss}x'
6571
```
72+
6673
Look for:
74+
6775
- `hit` → Served from Varnish
6876
- `miss` → Served from backend
6977

@@ -75,16 +83,16 @@ curl -I https://yourdomain.com
7583

7684
Review the following headers:
7785

78-
- **`Set-Cookie`**
86+
- **`Set-Cookie`**\
7987
If a Set-Cookie header (such as PHPSESSID) is present, Varnish will typically not cache the response.
8088

81-
- **`Cache-Control`**
89+
- **`Cache-Control`**\
8290
Should **not** contain `private`, `no-store`, or `no-cache`.
8391

84-
- **`Age`**
92+
- **`Age`**\
8593
Indicates how long (in seconds) the object has been cached.
8694

87-
- **`X-Magento-*`**
95+
- **`X-Magento-*`**\
8896
Provides Magento cache/debug information (visible in developer mode).
8997

9098
If most responses return `MISS` (for example in `X-Magento-Cache-Debug` or similar headers), caching is not being reused effectively.
@@ -101,6 +109,7 @@ varnishstat -1 -f MAIN.cache_hit -f MAIN.cache_miss
101109
```
102110

103111
This shows:
112+
104113
- `MAIN.cache_hit` → Cached responses served
105114
- `MAIN.cache_miss` → Requests sent to backend
106115

@@ -113,6 +122,7 @@ varnishlog
113122
```
114123

115124
Look for:
125+
116126
- `VCL_call HIT` → Served from Varnish
117127
- `VCL_call MISS` → Served from backend
118128
- `Age` → Indicates how long (in seconds) the object has been cached.
@@ -125,6 +135,7 @@ Alternatively, reuse the varnishncsa command from Step 2 for live hit/miss monit
125135
### 1. Pages Bypassing Varnish
126136

127137
Some pages are intentionally not cached:
138+
128139
- Checkout
129140
- Customer account pages
130141
- Requests containing `Set-Cookie` headers
@@ -136,6 +147,7 @@ This is expected behavior.
136147
If cache clears happen frequently, cache reuse becomes nearly impossible.
137148

138149
Common causes:
150+
139151
- Stock or pricing integrations
140152
- Magento cron jobs performing full cache purges
141153
- Extensions invalidating excessive cache entries
@@ -149,12 +161,14 @@ flushes.
149161
Tracking parameters create separate cache entries for identical content.
150162

151163
Examples:
164+
152165
- `utm_source`
153166
- `utm_medium`
154167
- `gclid`
155168
- `fbclid`
156169

157170
Example problem:
171+
158172
- /product-x
159173
- /product-x?utm_source=google
160174

@@ -172,6 +186,7 @@ The [elgentos/magento2-varnish-extended](https://github.com/elgentos/magento2-va
172186
Different URL formats fragment your cache.
173187

174188
Examples:
189+
175190
- `/category` vs `/category/`
176191
- `?Color=Red` vs `?color=red`
177192
- Unsorted query parameters
@@ -190,6 +205,7 @@ grep -R "cacheable=\"false\"" app/code vendor
190205
```
191206

192207
If found:
208+
193209
- Verify the block truly needs to be dynamic
194210
- Remove cacheable="false" if unnecessary
195211
- Use AJAX or Customer Data Sections for dynamic content
@@ -204,7 +220,7 @@ Enable developer mode temporarily for debugging purposes:
204220
magerun2 deploy:mode:set developer
205221
```
206222

207-
Or:
223+
Or:
208224

209225
```console
210226
php bin/magento deploy:mode:set developer
@@ -215,25 +231,31 @@ php bin/magento deploy:mode:set developer
215231
### varnishlog
216232

217233
Inspect detailed request handling:
234+
218235
```console
219236
varnishlog
220237
```
238+
221239
Look for recurring MISS patterns on pages that should be cacheable.
222240

223241
### varnishncsa
224242

225243
Show hit/miss per URL:
244+
226245
```console
227246
varnishncsa -F '%U%q %{Varnish:hitmiss}x'
228247
```
248+
229249
Filter for hits:
250+
230251
```console
231252
varnishncsa -F '%U%q %{Varnish:hitmiss}x' | grep hit
232253
```
233254

234255
### Hypernode Insights (If Available)
235256

236257
Use Hypernode Insights to:
258+
237259
- Monitor hit/miss ratios
238260
- Detect purge spikes
239-
- Correlate cache drops with deployments or cron jobs
261+
- Correlate cache drops with deployments or cron jobs

0 commit comments

Comments
 (0)