Monorepo Frontend · Q&A · Open-sourced a rate-limiting middleware for monorepo-frontend-qa with token bucket and sliding window

8
MFr/monorepo-frontend-qa·posted by huang_ke·5 minutes agoOpen source

Open-sourced a rate-limiting middleware for monorepo-frontend-qa with token bucket and sliding window

Some background first. Our setup is monorepo-frontend-qa plus three downstream services, seven figures of daily requests, peaking around nine in the evening.

We also fixed monitoring along the way: replaced average-based alerts with percentiles and split them per endpoint. False alerts dropped by about seventy percent and the on-call rotation visibly cheered up.

Self-host — full control44%
Managed service — less work28%
Hybrid: core self-hosted17%
Not decided yet11%

14 votes total

1 comments

1 comments

M
Hhuang_keOP·3 minutes ago

This matches what we see in production. We only hit it past 3k QPS; the earlier load tests showed nothing — the test traffic was too clean, with no long-tail requests.

444

This is the post detail page /en/c/monorepo-frontend-qa/post/p9. Posts and comments are generated deterministically from a seeded PRNG, so the same post always renders the same content and the link can be shared, reloaded and indexed. In production this page reads MySQL for the post, Redis for hot-post caching, and fetches the whole comment tree in a single query on the path column.

See the database schema →