Live prices to 1.5 million screens: binary, latest only
transcript
Send live stock prices as JSON, and you need five times the bandwidth. Same prices. Same screens. Here's how Kite avoids it.
Design for 1 point 5 million open WebSockets. About 50 instruments each. 75 million subscriptions. If 40 percent change every second, that's 30 million packets a second.
JSON repeats every field name. In every single quote. It spells numbers out as text. About 250 bytes a quote. Kite's quote packet? Eleven 4-byte integers at known offsets. Prices in paise. 44 bytes. No names. No text.
Binary: about 12 gigabits a second. JSON: about 60. For exactly the same prices.
But here's the real trick. Each ticker server keeps only the latest packet per stock. Ten ticks in a second become one. Each packet carries the full price, not a change. Once a second, each phone gets one message. About 922 bytes. A phone in a lift stops reading? Past 64 kilobytes, skip it. Remember what it missed.
So why is skipping safe? An old price is worthless once a newer one exists. But order updates never take this road. A skipped price is harmless. A skipped fill is a bug.
Binary, not JSON. And keep only the latest. Prices are snapshots. Send them like snapshots.
Full breakdown in the lecture.