π Caching Infrastructure
Aevum Encyclopedia's multi-tier caching architecture ensures sub-50ms response times across 2.4 million articles, serving 140+ languages with 99.99% uptime.
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.
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.
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
# 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.
Key Naming Convention
# 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.
Editorial Change Detected
The content pipeline publishes an event to Kafka: article.updated with the article ID, locale, and revision metadata.
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.
Redis Key Eviction
Targeted Redis keys matching the article pattern are deleted. Dependent knowledge graph edges are recalculated asynchronously.
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.
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.
Invalidation Code Example
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
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 }
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.
| 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 | r>
| 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 |