Simultaneous connection The mechanism of 'voice call service' Discord 'exceeding 2.6 million people
Discord is a voice call service for gamers, boasting very high popularity such as collecting more than 130 million users worldwide due to its ease of use. Although the number of simultaneous connections of voice calls reaches more than 2.6 million people, Discord is developed by a very small number of engineers . A part of the technology that enables you to operate a huge service with just 40 people and over 2.6 million simultaneous connections is revealed on the official blog.
How Discord Handles Two and Half Million Concurrent Voice Users using WebRTC
Discord supports a number of platforms including Web applications that run on browsers such as Chrome, Firefox, Edge, native apps on Windows, macOS, Linux, and smartphone applications running on iOS and Android. In order to reuse the same code as much as possible on multiple platforms, the technology called WebRTC is the key. This WebRTC is one of the specifications of HTML 5, it can be used not only in all browsers but also as a native library for incorporation into applications.
When using WebRTC with web application, it is necessary to follow WebRTC implementation of browser, but for other than web application such as Windows application and smartphone application, Discord customized WebRTC library can be used. It is said that Discord customizes and uses the following points.
- Avoiding " ducking " in Windows - Ducking is the function that Windows detects voice call and automatically lowers the volume of other applications.
· Implementing your own volume control
· It enables you to detect sound and share sound and video of the game together
· Reduced bandwidth and CPU usage during silence
· Even if the focus is far away from the application, you can use "push-to-talk" to deliver audio only while pressing the send button
· Sending non-voice information such as "Who will give priority"
The customized WebRTC seems to have to do a laborious work of frequently updating it to the latest state in accordance with the update of the original WebRTC, but in order to provide the service to the gamer, It is a certain work.
Well, at the back end of Discord, three services, "Discord Gateway", "Discord Guilds" and "Discord Voice", are mainly running. The first Gateway service is a service that is always connected when a user is starting Discord, and is used to receive online status, messages, and so on. The Guilds service is a service for allocating a server that provides Voice service to " servers " in Discord. When you try to start a voice call, "We are waiting for end point" is displayed first, but it seems that the Guilds service is looking for the best voice server.
On the Voice server, a transfer component called SFU used for exchanging voice and a signal component managing that SFU are in motion. It is said that the signal component can immediately continue service without dropping the packet by SFU reconstruction immediately when SFU crashes. Also, if the voice server itself goes down, another voice server is assigned, but the state of the call such as who is on which channel is managed by the Guilds service, so the same as when it is down It seems to be able to connect to a new Voice server while keeping state.
The above three services are designed to be scalable in the horizontal direction and in fact Discord uses more than 30 data centers over 13 regions of the world, of which more than 850 sounds The server is up and running. The number of simultaneous connection of Discord's voice call exceeds 2.6 million people, and that traffic is 220 Gbps, it is processing packets of more than 120 million packets per second.