مواد پر جائیں

Battle Questions · Gaming

Ten thousand simultaneous battles, decided in under 50ms

A competitive trivia platform where timing is a gameplay mechanic — so the game engine is server-authoritative, sub-50ms at p99, and treats a 500ms discrepancy as a fairness bug rather than a performance one.

10K+simultaneous battles

ایک نظر میں

مدت
43 ہفتے
ٹیم کا حجم
5 افراد
معاہدے کی نوعیت
نئی تعمیر
پروجیکٹ کی قسم
ویب ایپلیکیشن
شعبہ
میڈیا اور تفریح

کن چیزوں سے بنا

صورتحال

مسئلہ

In a game where timing decides the winner, a 500ms difference in when two players receive a question is not a performance problem, it is a fairness problem. On top of that, anti-cheat had to stop answer lookup and bots without punishing legitimate players for being fast.

ہم نے کیا کیا

Every timing decision moved to the server, and every battle became a small in-memory state machine rather than a database transaction.

وہ فیصلے جو اہم تھے

  • Battles live in Redis, not Postgres

    Each battle is a Redis hash driven by Lua scripts for atomic operations. A relational transaction per answer would have made the database the referee, and the referee would have been the slowest participant.

  • Client timings are rejected outright

    Server-authoritative timestamps with synchronised delivery via keyspace notifications. Any protocol that trusts the client's clock is a protocol that rewards tampering with the client's clock.

  • Shadow mode instead of bans

    Statistical timing analysis flags sub-150ms responses and suspiciously low variance; confirmed cheats are matched against each other rather than told. Deterrence took the flag rate from 2.1% to 0.4%.

کیا بدلا

simultaneous battles
10K+simultaneous battles
p99 game engine latency
<50msp99 game engine latency
daily active users
75K+daily active users
cheat flag rate
0.4%cheat flag rate
  • 75K+ — 38-minute average session
  • 0.4% — down from 2.1% in the first month

10,000+ concurrent battles at sub-50ms p99, 75,000+ daily active users averaging 38-minute sessions, and a cheat rate down to 0.4% — at $0.0003 of infrastructure per battle.

استعمال شدہ خدمات

  • Redis-backed game engine with atomic Lua operations
  • Server-authoritative timing and synchronised question delivery
  • Layered anti-cheat with statistical analysis and shadow mode
  • Matchmaking and Elo-adjusted accuracy tracking

ہم کیا مختلف کرتے

ہر منصوبے میں ایسی ایک بات ہوتی ہے۔ اسے شائع کرنا ہی اصل نکتہ ہے — جس کیس اسٹڈی میں کوئی پچھتاوا نہ ہو وہ ثبوت نہیں، تشہیر ہے۔

Game backends have a different performance contract from typical web APIs. Redis Lua scripts, pre-loading and server-authoritative timing are not over-engineering for a trivia game; they are the minimum viable correctness. We would reach for them on day one next time rather than proving the need first.

شروع کرنے کے لیے تیار ہیں؟