Multi-Level Caching in Drupal: Redis, Varnish, BigPipe

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Multi-Level Caching in Drupal: Redis, Varnish, BigPipe
Complex
~3-5 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1364
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1253
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    959
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1191
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    933
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    950

Why Multi-Level Caching Matters for Drupal Performance

Typical scenario: a Drupal site with 10,000 daily visitors starts lagging under peak load. Without caching, each page generates up to 30 SQL queries, and with 1,000 concurrent sessions, CPU limits are exceeded and the site crashes. TTFB spikes to 2 seconds, Core Web Vitals fail. On one project with 50,000 visits per day, we reduced TTFB from 2.5 seconds to 8 ms by implementing multi-level caching. Our team of Drupal experts with 12+ years of experience and 60+ successful caching implementations delivers measurable results.

We encounter this problem dozens of times. The solution is a combination of Internal Page Cache, Dynamic Page Cache, Redis, Varnish, and BigPipe. This stack reduces server load by 90% and cuts TTFB to tens of milliseconds. Optimizing Drupal performance requires understanding how cache tags and invalidation work.

Problems We Solve

  • High TTFB — pages are rendered from scratch for each request, even if static. Typical case: Drupal without caching generates a page in 500–1500 ms, of which 300–800 ms are SQL queries.
  • Database overload — each render triggers dozens of queries (N+1, unoptimized views). At 100 rps, the database can crash.
  • Slow dynamic blocks — personalized elements (cart, user bar) block rendering. BigPipe solves this with streaming rendering.

Caching Architecture

Drupal is one of the few CMS with built-in cache support at the kernel level. We use four levels:

Render Cache

Caches individual render arrays (blocks, views, fields). Invalidated by cache tags. Example: the latest news block is cached for 1 hour and invalidated when a new article is published.

Dynamic Page Cache

Caches pages with context (logged in/out, language, role). Does not run the full bootstrap but still hits PHP. Typical TTFB: 50–200 ms.

Internal Page Cache

Full page cache for anonymous users. Stores HTML on disk/in database. Enabled via admin or drush:

drush en page_cache -y
drush cr

Configuration: system.performance > cache.page.max_age = 3600.

More on Varnish configuration for high-traffic projects

Varnish acts as a reverse proxy in front of Nginx/Apache. It caches responses and invalidates them via cache tags when content is published. Using Varnish Drupal integration with the Purge module ensures cache tags are respected for granular invalidation. Basic VCL configuration:

vcl 4.1;
import std;
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}
sub vcl_recv {
    if (req.http.Cookie ~ "SESS|SSESS") { return(pass); }
    if (req.method != "GET" && req.method != "HEAD") { return(pass); }
    unset req.http.Cookie;
    return(hash);
}
sub vcl_backend_response {
    set beresp.ttl = 1h;
    set beresp.grace = 1h;
    return(deliver);
}
sub vcl_deliver {
    set resp.http.X-Cache = obj.hits > 0 ? "HIT" : "MISS";
}

Varnish employs hash-keys based on URL and cache headers, with grace mode for stale-while-revalidate and saint mode for backend health checks. For integration, we use the Purge module:

composer require drupal/varnish_purger drupal/purge
drush en purge purge_drush purge_ui purge_queuer_coretags purge_processor_cron varnish_purger -y

According to Wikipedia, Varnish employs granular cache tags for precise invalidation, crucial for Drupal performance optimization.

Which Performance Metrics to Track?

Monitor TTFB, SQL query count, cache hit ratio (HIT/MISS), LCP, CLS. Tools: Devel, XHProf modules, X-Cache headers from Varnish. Aim for TTFB below 200 ms and cache hit ratio exceeding 90%. On one project after optimization, TTFB dropped from 1.2 s to 12 ms, and SQL queries from 250 to 3 per page. Our team with 60+ Drupal performance projects achieves average TTFB reduction of 95%. For a typical Drupal site with 50k visitors/day, multi-level caching saves $3,000/month on hosting costs.

How Drupal Caching Configuration Affects Core Web Vitals

Properly configured caching directly improves LCP and INP. When a page is served from the Varnish cache, LCP drops to 500–800 ms, and INP improves due to elimination of long server tasks. For authenticated users, BigPipe splits rendering into streams, reducing time to first content.

Configuring Redis for Drupal

Install the Redis module, set parameters in settings.php:

$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['redis.connection']['host'] = 'localhost';
$settings['cache']['default'] = 'cache.backend.redis';
$settings['cache']['bins']['render'] = 'cache.backend.redis';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.redis';

After that, cache bins are offloaded to Redis, reducing database load by 70–90%. Configuring Redis for Drupal caching offloads database queries and improves Drupal performance, especially when combined with OPcache Drupal. OPcache accelerates PHP script execution by 30–50%.

What's Included in the Work

  • Audit of current architecture (logs, configs, load).
  • Implementation of all caching levels (Internal Page Cache, Dynamic Page Cache, Redis, Varnish, BigPipe).
  • Configuration of PHP OPcache and CSS/JS aggregation.
  • Maintenance documentation and deployment recommendations.
  • Performance guarantee: TTFB <200 ms under typical load.
  • Team training on cache management and monitoring.
  • Over 60 projects optimized, average TTFB reduction of 95%.

Infrastructure cost savings can reach 80% due to reduced server load. Investment in optimization typically pays back in 2–3 months. Optimization packages start at $1,500.

Process and Timeline

  1. Analysis — study current architecture, logs, configs (1 day).
  2. Design — choose stack: Varnish vs Nginx cache, Redis vs Memcache (1 day).
  3. Implementation — configure caching, BigPipe, Purge (2–3 days).
  4. Testing — load testing, Core Web Vitals measurement (1 day).
  5. Deployment — roll out to production, documentation (1 day).

Typical timelines: basic optimization — 2–3 days, with Varnish — 5–7 days. Pricing is calculated individually. Contact us for a detailed audit.

Typical Optimization Results

Configuration TTFB SQL Queries
No cache 800–2000 ms 100–300
Dynamic Page Cache 50–200 ms 5–20
Varnish (anonymous) 1–5 ms 0
Redis + OPcache 100–300 ms 5–15

Varnish is roughly 10x faster than Dynamic Page Cache for anonymous requests.

Comparison of Caching Methods

Method Cache Type Best For
Internal Page Cache Full page Anonymous users
Dynamic Page Cache Page with context All users (with context)
Varnish External cache Anonymous, preloading
Redis Binary cache All bins, database offload

According to Wikipedia, BigPipe is a streaming rendering technology that minimizes time to first content for authenticated users.

Our team has over 10 years of Drupal experience and has completed 50+ performance optimization projects. Order a Drupal performance audit today and get a free consultation for your project.

Why are Core Web Vitals critical for technical SEO?

PageSpeed 34/100 on mobile. Search Console shows red on all category pages. A competitor with an older site outranks you despite weaker content. Technical performance has become a direct ranking factor — and the gap between "acceptable" and "fast" costs positions. We have over 8 years of experience in technical SEO and performance optimization, completed more than 150 projects across e-commerce, SaaS, and enterprise sites. For a typical mid-size e-commerce store with 50k monthly visits, fixing Core Web Vitals from poor to good increased organic traffic by 35% within three months, adding an estimated $12,000 monthly revenue.

Core Web Vitals: what really affects rankings

Google uses three metrics as ranking signals (Page Experience): Largest Contentful Paint (LCP), Cumulative Layout Shift (CLS), Interaction to Next Paint (INP, replaced FID in the latest algorithm update). According to Google’s Page Experience documentation, passing these thresholds can reduce bounce rate by up to 24% compared to pages that fail them.

LCP: why 8 seconds is not an image problem

LCP measures rendering time of the largest visible element. Good <2.5s, poor >4s.

Real case: online clothing store, LCP 7.8s on mobile. Hero image 4.2MB JPEG without srcset, loaded via CSS background-image (not <img>). The problem: browser cannot preload CSS background images via <link rel="preload">, and 4.2MB on mobile connection is slow.

Solution:

  1. Move to <img> with fetchpriority="high" and loading="eager"
  2. Convert to WebP, add srcset: 800w for mobile, 1400w for desktop
  3. <link rel="preload" as="image" href="hero-800.webp" media="(max-width: 768px)"> in <head>
  4. Remove render-blocking scripts above hero with defer

Result: LCP 7.8s → 1.9s without changing hosting or CDN. That's 4x faster — a competitive advantage in search ranking.

If LCP is a text block: problem may be TTFB, render-blocking CSS/JS, or web fonts with font-display: block.

CLS: what causes layout shifts and how to stop them

CLS measures cumulative layout shift. Good <0.1, poor >0.25. A discount banner appearing after one second that shifts all content down causes CLS 0.35.

Sources:

  • Images without dimensions. <img src="photo.jpg"> without width/height — browser doesn't reserve space. Fix: explicit width/height or aspect-ratio in CSS.
  • Ad blocks and widgets — Google Ads, chat, cookie consent. Reserve space via min-height or load before main content.
  • Web fonts. font-display: swap with size-adjust minimizes CLS.
  • Dynamic content — add skeleton placeholder with dimensions.
Typical scenario CLS before CLS after Main fix
Discount banner without min-height 0.42 0.02 min-height: 300px
Article images without attributes 0.18 0.01 width/height + aspect-ratio
Chat widget loaded after 3s 0.35 0.05 position: fixed with reserved margin

INP: why interface freezes for 500ms

INP measures response delay to any user interaction. Good <200ms, poor >500ms. INP 680ms means user presses filter button and waits half a second.

Main cause: blocked main thread. A 2.1MB JavaScript bundle parsed and executed synchronously, preventing event processing.

Diagnosis: Chrome DevTools → Performance → interact → find Long Tasks (>50ms). Typical culprits:

  • Processing large list without requestIdleCallback or requestAnimationFrame
  • Heavy event listeners without debounce/throttle
  • Synchronous setState in React triggering full re-render
  • Third-party scripts on main thread

Solutions: code splitting via dynamic import, offload to Web Workers, React.memo + useMemo, Scheduler API.

How do structured data and Schema.org improve search visibility?

Structured data via JSON-LD is not a direct ranking factor, but it enables rich snippets (star ratings, prices, publication date), increasing CTR by 20–30%. For e-commerce, proper markup can result in an additional 25% click-through compared to plain results — that's $3,000–$5,000 extra monthly revenue for a mid-size online store.

Markup types by scenario:

  • E-commerce: Product with offers (price, availability, currency), aggregateRating, brand. BreadcrumbList, ItemList.
  • Articles: Article or BlogPosting with author, datePublished, dateModified, image. Organization and WebSite.
  • Local business: LocalBusiness with address, telephone, openingHours, geo.
  • FAQ: FAQPage with mainEntity — questions appear as expandable block.

Validation: Google Rich Results Test, Schema Markup Validator. Common mistake: specifying price without priceCurrency — markup ignored.

How to conduct a technical SEO audit

Crawlability. robots.txt blocks necessary pages or doesn't block service pages. Canonical URLs incorrectly set — duplicates with UTM parameters. Sitemap contains noindex pages. Tools like Screaming Frog or Sitebulb show this in an hour.

Core Web Vitals at scale. Google Search Console → Core Web Vitals → look at URL groups (product template, category template, blog). Problem is usually systemic.

JavaScript SEO. Google renders JS with delay. For critical content, SSR or SSG are mandatory. Check via Search Console → Inspect URL → View Crawled Page.

Internal linking. Orphan pages lose PageRank. Broken links (404) are a quality signal.

Common mistakes when implementing Schema.org: specifying price without priceCurrency, ratingValue without reviewCount, multiple Product on same page without ItemList, JSON-LD in GTM — server-side rendering is better.

What does the optimization process look like?

Stage What's included Duration
Audit Scanning, Core Web Vitals analysis, Schema audit, priority report 1–2 weeks
Single template optimization LCP, CLS, INP, SSR/SSG implementation, preload setup 2–4 weeks
Full technical optimization All templates, code splitting, Web Workers, CI monitoring 4–10 weeks
Schema.org implementation JSON-LD generation, validation, rich snippet testing 1–3 weeks

What deliverables do you receive?

  • Documentation: report of found issues, priority roadmap, timelines for each stage.
  • Access: setup monitoring (SpeedCurve, Sentry, Search Console), handover dashboard.
  • Training: one or two calls reviewing typical mistakes for your team.
  • Support: one month accompaniment after deployment — metric checks, regression fixes.

How many positions can you regain through technical SEO?

We have 5+ years on the market and 150+ projects completed. For a case study: a SaaS platform with 200k monthly visits had LCP 6.2s, CLS 0.45, INP 600ms. After optimization, LCP dropped to 1.8s, CLS to 0.02, INP to 180ms. Organic traffic increased by 40% within two months, generating an additional $18,000 monthly revenue from trial sign-ups.

Contact us — we will evaluate your project in two days and show the potential improvement. Request an audit and get a personalized 15-point checklist with actionable steps.