SShortSingh.
Back to feed

How a Ryan Gosling Tweet Forced a Flask App to Handle 10,000 Requests Per Second

0
·1 views

A developer's small analytics backend, built with Flask on a 512MB Heroku dyno, collapsed under a sudden surge of 50,000 concurrent users after Ryan Gosling tweeted a link to their side project. The root cause was Flask's default thread-per-request model, which caused unbounded memory growth and repeated out-of-memory crashes on the limited server. The developer rebuilt the system using asynchronous I/O, a bounded SQLite connection pool, and WAL (Write-Ahead Logging) mode to safely manage concurrency without adding hardware. Key architectural constraints included capping connections at 200, setting fast failure timeouts, and offloading non-critical work to the client browser. The redesigned system ultimately sustained 10,000 requests per second on just 8GB of RAM, serving as a practical case study in resource-constrained backend engineering.

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 First Crypto Trading Bot Using Python and Binance API

A software developer built a cryptocurrency trading bot to automate manual trades on Binance, motivated by missing profitable price moves while distracted by other tasks. The bot uses the ccxt Python library to fetch candlestick data and applies a simple mean-reversion strategy, buying when price drops 2% below its 20-period moving average and selling when it rises 2% above. An initial single-script version failed due to missing position tracking, no error handling, and hard-coded order sizes that were sometimes rejected by the exchange. The developer refactored the code into modular functions, added retry logic for network errors, and introduced a position tracker to prevent unintended over-exposure. The key takeaway was that reliable data fetching, clean order execution, and robust error handling matter more than complex trading algorithms.

0
ProgrammingDEV Community ·

AI Agents Aced Lab Tests but Crashed in Production: Lessons from 2026 Failures

In early 2026, a wave of AI agent failures struck production systems in fintech, healthcare, and e-commerce, despite those agents scoring above 97% on internal benchmarks. The root cause was identified as a fundamentally flawed testing paradigm that evaluated agents on curated, predictable inputs rather than the messy, ambiguous queries real users submit. A study by the Agent Reliability Collective found that the average production agent encountered 47 daily input patterns with zero test coverage, and nearly a quarter of those gaps led to harmful outcomes like silent misclassifications or policy violations. One payment agent, PayFlow AI, achieved 94.2% accuracy in testing but misrouted $2.3 million in transactions within three weeks of launch due to query types its test suite had never considered. Experts argue that current evaluation frameworks also fail to account for real-world tool unreliability, such as API errors and expired tokens, which can trigger cascading failures inside an agent's execution loop.

0
ProgrammingDEV Community ·

macOS Sequoia Silently Kills Cron Jobs, Prompting Developer's 97-Line Migration Fix

A developer running an automated income setup discovered that a macOS Sequoia update had quietly disabled the cron daemon, causing all scheduled jobs to stop without any error or alert. Apple has been progressively decoupling cron from user sessions since macOS Ventura, and on Sequoia the daemon can appear installed while not actually running. To fix the issue, the developer wrote a 97-line shell script that reads existing crontab entries line by line and automatically generates the XML-based launchd plist files Apple now recommends for job scheduling. Unlike cron, launchd offers advantages such as automatic restarts, post-sleep job execution, and explicit environment variable injection, but its verbose XML format had previously made manual migration impractical. The script was designed to lower that barrier by automating the conversion process entirely.

0
ProgrammingDEV Community ·

COSMolKit Takes Source-First Approach to Building RDKit-Compatible Rust Chemistry Library

COSMolKit is a Rust-based cheminformatics library designed to be compatible with the widely used RDKit toolkit, validated against its pinned 2026.03.1 release. Rather than using differential output fitting — where mismatches guide iterative patches — COSMolKit derives its implementation directly from RDKit's upstream source code. The project has validated over 2.93 billion matching checks across nearly 2.9 million ChEMBL 37 records, with zero blocking mismatches recorded. Developers argue that corpus-driven heuristic approaches risk hiding entire semantic failure families, making progress hard to estimate reliably. By porting source semantics first and using test corpora only for auditing, COSMolKit aims for deeper, more predictable compatibility with RDKit's chemistry behavior.