Snip
High-throughput URL shortener
A REST service that turns long links into 7-character codes and redirects visitors. The interesting part is keeping redirects fast under load: a Redis cache in front of PostgreSQL, click counting moved off the request path, and a load test to measure the difference.
- Python
- FastAPI
- PostgreSQL
- Redis
- Docker
- pytest
- Locust
23xfaster p95 redirects with the cache (300 to 13 ms)
2.2xthroughput, 568 to 1,236 requests a second
93.3%cache hit rate over 147,694 requests