Connection Pooling — reusing database connections. Caching — storing query results.
Connection Pooling:
Connection Pooling:
App → [Pool: 10 connections] → DB
Request 1 → Connection 1
Request 2 → Connection 2
Request 3 → Connection 1 (reused)
(Connections recycled)
Caching:
Caching:
App → Cache (Redis) → DB
Query 1: Cache miss → DB → Store in cache
Query 2: Cache hit → Return cached
(Results reused)
Key differences: