Estimate the gateways you need for 5 million concurrent users.
Sketch your own answer first, then compare it with the one below.
A strong answer
If one gateway holds about 100,000 idle connections, 5 million users need about 50 gateways, plus spare capacity for a crash and for peak load.
Check the other limits too. Keepalives every 30 seconds on 5 million connections are about 170,000 small messages a second. Memory per connection and buffers usually set the cap, not CPU.
Sources
- Ian Fette, Alexey Melnikov (2011). RFC 6455: The WebSocket Protocol.