Architecture Overview

Aevum Encyclopedia employs a five-layer caching strategy that progressively serves content from the fastest available source, minimizing database load and ensuring global consistency.

Request Flow β€” Five-Layer Cache Architecture
πŸ‘€
Client
Browser / App
β†’
🌐
Edge CDN
CloudFlare / Akamai
β†’
⚑
Redis Cluster
In-memory L2
β†’
πŸ–₯️
App Cache
Caffeine / Guava
β†’
πŸ—„οΈ
PostgreSQL
Primary Source
42ms
Avg. Response Time
↓ 18% vs last quarter
97.3%
Cache Hit Rate
↑ 2.1% improvement
142
Edge Locations
↑ 12 new PoPs
99.99%
Uptime SLA
βœ“ On target

Layer 1 β€” Edge CDN

Our edge CDN layer serves 78% of all requests directly from 142 global points of presence. Static assets, rendered article HTML, and API responses are cached at the edge with intelligent TTL management.

ℹ️
Did you know? Aevum's CDN serves an average of 4.2 million requests per second during peak hours, with a global 95th percentile latency of 38ms.

Cache-Control Headers

Resource Type Cache-Control TTL Status
Article HTML (rendered) public, max-age=300, stale-while-revalidate=600 5 min + 10 min stale Active
API JSON responses public, max-age=60, s-maxage=300 1 min (client) / 5 min (CDN) Active
Static assets (CSS/JS) public, max-age=31536000, immutable 1 year Active
Images (lazy-loaded) public, max-age=86400 24 hours Active
Editorial drafts private, no-store, must-revalidate No cache Bypass

Purge Configuration

YAML β€” CDN Purge Rules
# aevum-cdn-purge.yaml
purge_rules:
  article_update:
    pattern: "/api/v2/articles/{id}"
    methods: ["GET", "PURGE"]
    propagation: "immediate"
    soft_purge: true

  category_bulk:
    pattern: "/api/v2/categories/{slug}/**"
    methods: ["GET"]
    propagation: "soft"
    stale_ttl: 300

  global_emergency:
    pattern: "*"
    methods: ["*"]
    requires_approval: true
    cooldown: 3600

Layer 2 β€” Redis Cluster

Aevum's Redis cluster operates across 6 geographic regions with active-active replication, storing serialized article payloads, user sessions, and computed knowledge graph edges.

⚠️
Cache Stampede Protection All Redis keys use probabilistic early expiration with jitter to prevent thundering herd scenarios. When a key is about to expire, there's a 15% chance it gets refreshed 60s early.

Key Naming Convention

Redis Keys
# Article cache keys
aevum:article:{locale}:{id}:full
aevum:article:{locale}:{id}:excerpt
aevum:article:{locale}:{id}:metadata

# Knowledge graph
aevum:graph:{topic}:edges
aevum:graph:{topic}:related

# Rate limiting
aevum:ratelimit:{user_id}:{endpoint}
aevum:ratelimit:global:{endpoint}

# Session data
aevum:session:{token}:data
aevum:session:{token}:preferences

Redis Cluster Topology

Region Nodes Shards Memory Hit Rate Status
πŸ‡ΊπŸ‡Έ US-East (Virginia) 18 16384 512 GB 98.1% Healthy
πŸ‡ͺπŸ‡Ί EU-West (Frankfurt) 18 16384 512 GB 97.8% Healthy
πŸ‡ΈπŸ‡¬ APAC (Singapore) 12 16384 384 GB 96.9% Healthy
πŸ‡―πŸ‡΅ JP (Tokyo) 9 8192 256 GB 97.2% Healthy
πŸ‡ΈπŸ‡¦ ME (Bahrain) 6 4096 128 GB 95.4% Scaling
πŸ‡§πŸ‡· BR (SΓ£o Paulo) 6 4096 128 GB 96.1% Healthy

Cache Invalidation

When an article is edited by a contributor, our invalidation pipeline ensures all cache layers are updated in a coordinated fashion, preventing stale content from being served.

1

Editorial Change Detected

The content pipeline publishes an event to Kafka: article.updated with the article ID, locale, and revision metadata.

2

Local & App Cache Purged

All application servers in the region purge their in-memory caches via a pub/sub signal. Stale entries are immediately invalidated.

3

Redis Key Eviction

Targeted Redis keys matching the article pattern are deleted. Dependent knowledge graph edges are recalculated asynchronously.

4

CDN Soft Purge

A soft purge is issued to all CDN edge nodes. They continue serving stale content for up to 10 minutes while fresh content is fetched on-demand.

5

Warm-up & Verify

Background workers pre-render the updated article and push it to nearby CDN edges. A verification probe confirms freshness across all layers.

βœ…
Average Invalidation Time: 1.2 seconds From editorial save to global cache consistency, the full pipeline completes in under 2 seconds for 99% of updates.

Invalidation Code Example

Python β€” Cache Invalidation Service
class CacheInvalidator:
    async def invalidate_article(self, article_id: str, locale: str):
        """Orchestrate multi-layer cache invalidation."""

Cache API

Aevum exposes a RESTful API for programmatic cache management. Use the X-Api-Key header for authentication.

Purge a Single Article

HTTP
POST /api/v2/cache/purge/article/{id} HTTP/1.1
Host: cache.aevum-enc.com
X-Api-Key: sk_live_...
Content-Type: application/json

{
  "locale": "en",
  "reason": "editorial_update",
  "force_hard_purge": false
}
🚨
Hard Purge Warning Setting force_hard_purge: true bypasses the soft-purge window and immediately removes all cached versions. This may cause a brief spike in database load. Use only in emergency situations.

Monitoring & Alerting

Aevum's caching infrastructure is monitored via a real-time observability stack. Key metrics are tracked through Datadog, with custom dashboards for each cache layer.

r>
Metric Threshold Alert Level On-Call
Cache hit rate drops below 90% < 90% for 5 min P1 β€” Critical Platform Eng
Redis connection pool exhausted > 85% for 2 min P2 β€” Warning Platform Eng
CDN 5xx error rate > 1% for 1 min P1 β€” Critical Infra Eng
Invalidation pipeline lag > 10s for 3 min P2 β€” Warning Content Eng
Memory fragmentation ratio > 1.5 for 15 min P3 β€” Info Scheduled review
πŸ“ž
24/7 Support Line For cache-related incidents, call 1-800-AEVUM-KB or reach the on-call engineer via PagerDuty. Average response time: 4 minutes.