
Queue vs Direct Insert: What Happens When 10,000 Users Hit Your Database at Once
I've run online exam systems before. For a middle school with around 1,000 students, I needed a database server with 4 CPUs and 8GB RAM, plus an app server with 2 CPUs and 8GB RAM. That's a lot of hardware just for 1,000 users. The system worked, but I kept wondering — what if I had 10,000 students? Would I need 10x the resources? So I built two versions of an exam submission system and threw 10,000 concurrent users at them. One used direct database inserts. One used a message queue. Direct insert failed 28% of requests. Queue-based succeeded 99.7% of the time — using way less hardware. The Problem If you've run an online exam system, you know how this goes. Testing with 10 users works perfectly. QA with 50 concurrent users is fine. Then exam day hits with 1,000+ students and you're just hoping the server survives. Running exams for around 1,000 middle school students taught me that you need serious hardware just to handle everyone hitting the system at the same time. They all log in t
Continue reading on Dev.to
Opens in a new tab


