Todos los ejemplos

Ejemplos

Un limitador de tasa con token bucket, petición a petición

Una ráfaga de cinco peticiones llega a un cubo de tres tokens: pasan tres, dos reciben un 429, y el cubo se rellena para que un cliente inactivo pueda volver a enviar una ráfaga.

Este video se hizo con la habilidad Diseño de sistemas.

  • 1:05
  • Diseño de sistemas
  • Narrado por Iapetus
  • Inglés

Hecho a partir de un prompt

Design a rate limiter with a token bucket. Show a burst of requests and which ones get a 429.

Transcripción del video

Five simultaneous requests can overwhelm your API unless you control the burst.

You start with a client calling your API directly, but sustained traffic pushes utilization to ninety-five percent.

We insert a token bucket limiter before the API, starting with three tokens and refilling one each second.

Each request spends one token, so five arriving together let three through and reject two with HTTP four twenty-nine.

Why reject instead of queueing? Immediate refusal bounds waiting, and clients should retry later with backoff.

The bucket refills continuously up to its capacity, so an idle client can burst again.

The cost is rejected work, and multiple API replicas must share an atomic bucket per client.

Use this at API entry points: the client sends, the limiter admits, and the API handles accepted work.

Tu tema, dibujado en un minuto, más o menos.

Tus primeros 2 videos son gratis, de hasta 1 minuto cada uno, con marca de agua. No necesitas tarjeta. Producto completo, con todas las voces y estilos incluidos.