SShortSingh.
Back to feed

Why blind retries in code can cost revenue and crash your platform

0
·4 views

Most software retries failed calls by default, but without deliberate logic, this can silently harm users and systems. For user-facing operations, each retry adds latency that directly impacts revenue — Amazon found every 100ms of added delay costs roughly 0.1% in sales. The right approach is to fail fast on real errors like bad inputs or misconfigurations, reserving retries only for known transient issues such as temporary network timeouts. Background jobs follow a different calculus: retrying at the call level is cheaper than re-queuing an entire job that may have been near completion. Placing retry logic in the correct architectural layer — at the request handler rather than deep in library code — is key to making these decisions effectively.

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 ·

Single-flight caching pattern prevents cache stampede and database overload

A Russian apartment listings platform, podbor-minuta.ru, experienced mass request timeouts when a cached database query expired under heavy traffic, causing up to 200 simultaneous identical queries to overwhelm the connection pool. The phenomenon, known as a cache stampede, occurs when a cache key expires at the same moment many requests arrive, each independently triggering the same expensive computation. The team resolved this by implementing a single-flight caching pattern, where the first request to find a missing cache key creates a shared in-flight promise that all concurrent callers await together. This ensures only one database query is executed per key at any given time, regardless of how many requests arrive simultaneously. After the fix, the same traffic load that previously drained the connection pool now produces just one database query per hot key instead of hundreds.

0
ProgrammingDEV Community ·

Single-flight caching pattern stops cache stampedes from crashing databases

Engineers at podbor-minuta.ru, a Moscow new-build property monitoring service, encountered repeated HTTP 500 timeout errors under load caused by a cache stampede — a condition where hundreds of simultaneous requests hit an expired cache key and flood the database at once. The root cause was a naive cache-refresh logic that sent every concurrent request to the database independently when a cached value expired, exhausting the connection pool. To fix this, the team implemented a single-flight caching pattern, where only the first request for an expired key triggers a database query while all other concurrent requests wait for the same shared promise. The in-flight promise map is cleaned up in a finally block to ensure the key is released even if the computation fails, preventing deadlocks. After the fix, 200 concurrent requests on a hot key now produce just one database query instead of 200, eliminating connection pool exhaustion entirely.

0
ProgrammingDEV Community ·

Polymarket Cuts Taker Delay to 50ms, Reshaping Bot Trading Strategies

Polymarket reduced its taker delay on crypto markets from 250ms to 50ms on August 17, 2026, continuing a series of rule changes that previously brought the delay down from 500ms. The tighter window leaves market makers almost no time to cancel stale quotes, raising both the opportunity and risk for automated trading bots. Dynamic taker fees introduced in January 2026 remain in effect, with charges reaching up to 1.56% near 50% probability, effectively killing pure latency arbitrage strategies. Experts now recommend building maker bots that post tight two-sided quotes, use WebSocket-only connections, and complete cancel-and-replace cycles in under 40ms. Under the new rules, winning bots are expected to earn returns through maker rebates and tight spreads rather than by taking positions.

0
ProgrammingDEV Community ·

How to Debug Android Chrome Browser Logs from a Windows Laptop Using USB

Developers can debug websites on a physical Android device by enabling Developer Options and USB Debugging in the phone's settings. The device must be connected to a Windows laptop via a data-capable USB cable, with file transfer mode selected and USB debugging authorized on the phone. On the Windows laptop, navigating to chrome://inspect/#devices in Chrome with 'Discover USB devices' enabled allows remote access to the Android browser's DevTools. This setup lets developers inspect console logs, JavaScript errors, network requests, and API responses as they occur on the actual device. If the device appears as 'unauthorized' or 'pending authentication', revoking and re-enabling USB debugging authorizations or using Android Platform Tools' ADB command can resolve the issue.