This week in caching: VCL cookie hygiene, before/after
Cookies quietly destroy hit rate. The teams who fixed it:
— Publisher — analytics cookies (_ga, _fbp) made every request 'unique' to Varnish; stripping them in vcl_recv before lookup took hit rate from 34% to 91%. Same content, just stopped fragmenting the key.
— WordPress — only passing wordpress_logged_in cookies through and dropping the rest meant anonymous traffic finally cached; origin req/s fell ~80% at peak.
— Store — preserving the cart cookie but stripping marketing ones kept commerce working while caching the catalog.
The principle: Varnish caches per cache-key, and unstripped cookies make the key unique per visitor. You're not caching, you're proxying.
Bookmark: varnishlog -g request -i ReqHeader -I Cookie — see exactly which cookies are poisoning your hit rate.
Cache Catch
@CacheCatch
This week in caching: VCL cookie hygiene, before/after
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.