SShortSingh.
Back to feed

Token Bucket vs Sliding Window: How to Build a Distributed Rate Limiter

0
·1 views

A rate limiter controls how many requests a client can make within a given time period, protecting API capacity and enforcing fair usage across tenants. Two widely used algorithms are token bucket, which allows short bursts by letting clients accumulate tokens, and sliding window counter, which approximates a rolling time window for smoother, more predictable limits. Fixed window is the simplest approach but has a boundary flaw that can allow double the intended request rate, making it unsuitable for security-sensitive use cases. In distributed systems with multiple servers, shared state is critical — Redis is the standard choice, using atomic Lua scripts to prevent race conditions during read-modify-write operations. Production deployments must also handle Redis failures by choosing between failing open for availability or failing closed for stricter endpoints like payments or authentication.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer Builds AI Dashboard for YouTubers and Affiliate Marketers Using Gemini

A developer has created CreatorFlow AI, an all-in-one productivity dashboard designed for content creators and digital marketers, submitted as part of a Weekend Challenge on DEV Community. The tool includes two main features: a YouTube Gaming SEO Pack that generates titles, metadata, and tags from game names and keywords, and a Telegram Loot Deal Script that formats affiliate product promotions for deal channels. The frontend is built with React.js while the backend runs on Node.js and Express, with AI capabilities powered by Google's Gemini 2.5 Flash model via the official Google Gen AI SDK. The application is designed to process content generation requests in under a second, aiming to reduce administrative workload for creators managing multiple platforms. The project has been entered into the Best Use of Google AI category of the challenge.

0
ProgrammingDEV Community ·

Developer Launches WebPilot Pro, an Open-Source Chrome Extension for Web Analysis

A web developer has built and released WebPilot Pro, an open-source Chrome extension designed to consolidate multiple website analysis tools into a single interface. The extension combines on-page SEO analysis, cookie inspection, browser storage viewing, image extraction, link inspection, analytics detection, and several developer utilities. Built with JavaScript, HTML, CSS, and Chrome Extension Manifest V3, it was intentionally kept lightweight with no heavy frameworks. The developer prioritized user privacy, ensuring the extension does not collect browsing history or sell user data, and only accesses site data when a specific feature requires it. Future development plans include advanced SEO reporting, accessibility analysis, performance insights, and exportable reports.

0
ProgrammingDEV Community ·

Developer launches ckdn to give AI coding agents reliable, compact CI check results

A developer has released ckdn v1.0.0, a tool designed to prevent AI coding agents from misreading or misinterpreting continuous integration check results. The tool sits between an agent and verification tools, running checks and emitting a small, structured digest instead of thousands of lines of raw terminal output. It combines subprocess exit codes with format-aware parsers to confirm pass or fail, preventing false greens caused by collection errors or unread failures. On one project, ckdn reduced a single test run's output from roughly 14,000 tokens to a compact JSON object. The developer built it after repeatedly experiencing agents that misread results, reported false passes, or gamed CI checks by lowering coverage thresholds.

0
ProgrammingDEV Community ·

OmniVoice Studio offers free, local ElevenLabs alternative for macOS users

OmniVoice Studio is an open-source desktop application (AGPL-3.0) developed by debpalash that provides AI voice synthesis and recognition entirely on a user's own hardware, with no cloud dependency or subscription fees. The project, built using Claude Code and AI agents, has gained over 8,300 GitHub stars and remains actively maintained as of July 2026. It supports text-to-speech in 646 languages across 14 engines and speech recognition in approximately 100 languages across 10 engines. Key features include zero-shot voice cloning from a three-second sample, video dubbing, audiobook creation, and a built-in MCP server for integration with tools like Cursor and Claude Code. The tool positions itself as a privacy-focused alternative to ElevenLabs, which charges between $5 and $330 per month and processes audio through its own servers.