How discord manage 300M socket connection

Overview

Discord, the popular platform famous for its complex system of guilds and detailed permissions. how they managed to handle this amount of websocket connections with permissions in mind?

Publish–subscribe Pattern (also kn…


This content originally appeared on DEV Community and was authored by Abdulrahman S.

discord-banner

Overview

Discord, the popular platform famous for its complex system of guilds and detailed permissions. how they managed to handle this amount of websocket connections with permissions in mind?

Publish–subscribe Pattern (also known as Pub/sub)

The Pubsub pattern is a one-to-many relationship that allows to publish specific event/data to multiple subscribers/users at the same time.
This pattern has already been implemented in many technologies such as redis and postgres and much others.

Permissions

The magic behind discord it's the permission system
Most of us may think of permissions as a list of strings.
But actually they are numbers exactly 64 unsigned integers
They use a data structure called bitfields
It's powerful in terms of performance

How Discord uses these technologies?

When you connect to their websocket server, they create a pubsub client and this client subscribes to your friends, servers, groups and other important IDs to send you back updates
But before sending you back anything they check your permissions with the target of X.

The tricks to handle the load

Discord doesn't simply use the mentioned technologies alone
Some of the important tricks they currently use are:

Open-source projects that follow discord philosophy:


This content originally appeared on DEV Community and was authored by Abdulrahman S.


Print Share Comment Cite Upload Translate Updates
APA

Abdulrahman S. | Sciencx (2022-07-15T19:56:29+00:00) How discord manage 300M socket connection. Retrieved from https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/

MLA
" » How discord manage 300M socket connection." Abdulrahman S. | Sciencx - Friday July 15, 2022, https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/
HARVARD
Abdulrahman S. | Sciencx Friday July 15, 2022 » How discord manage 300M socket connection., viewed ,<https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/>
VANCOUVER
Abdulrahman S. | Sciencx - » How discord manage 300M socket connection. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/
CHICAGO
" » How discord manage 300M socket connection." Abdulrahman S. | Sciencx - Accessed . https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/
IEEE
" » How discord manage 300M socket connection." Abdulrahman S. | Sciencx [Online]. Available: https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/. [Accessed: ]
rf:citation
» How discord manage 300M socket connection | Abdulrahman S. | Sciencx | https://www.scien.cx/2022/07/15/how-discord-manage-300m-socket-connection/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.