Пишем высокопроизводительный rate-limiter на golang
The author recently started learning Go and, as practice, implemented rate-limiting algorithms from an arXiv paper. The article covers building a rate limiter both as a standalone service and as middleware, using an in-memory cache or Redis. It also adds REST and gRPC support, integrates Prometheus, and examines how to achieve atomic operations with minimal latency.
Недавно я познакомился с Golang и в качестве практики решил реализовать алгоритмы rate limiting'а из статьи с arxiv. Сегодня мы рассмотрим написание rate-limiter'а в виде отдельно-стоящего сервиса и в виде middleware, используя in-memory кэш или Redis, добавим поддержку REST и gRPC, подключим Prometheus и поймём как добиться атомарности операций с минимальными задержками. Читать далее