Mysteries of Telegram Data Centers
Unraveling the Mysteries of Telegram Data Centers
Originally analyzed by Coxxs
Telegram utilizes a distributed infrastructure consisting of five distinct data centers, identified in the platform's documentation and source code as DC1 through DC5.
🌐 Global Distribution of DCs
The physical locations of these servers are spread across three primary hubs:
| Data Center | Location | Region |
|---|---|---|
| DC1 | Miami, USA | North America |
| DC3 | Miami, USA | North America |
| DC2 | Amsterdam, Netherlands | Europe |
| DC4 | Amsterdam, Netherlands | Europe |
| DC5 | Singapore | Asia |
How Account Assignment Works
When a user registers, they are permanently linked to a specific DC. This assignment is static; it does not shift based on the user's current GPS location or changes to their phone number.
Note: Connection is strict. If a client attempts to communicate with a DC not associated with that specific account, the server will reject the request and trigger an error, forcing the client to redirect to the correct DC.
📉 The Notorious DC5
Within the Chinese Telegram community, DC5 is a frequent topic of conversation. However, it isn't praised for its efficiency, but rather infamous for its instability.
When DC5 experiences downtime, affected users are trapped in a perpetual "reconnecting" loop. Once service is restored, these users typically migrate to group chats with members of other DCs to vent their frustrations.
🔍 The Case of the "Missing" DC2 and DC3
To satisfy community curiosity, a bot was developed to identify which DC a user is assigned to. The initial findings among a sample of users were as follows:
- +86 (China) numbers Assigned to
DC5(Singapore). - +1 (USA) numbers Assigned to
DC1(Miami). - European numbers Assigned to
DC4(Amsterdam).
Using "big data" (bot logs), the distribution looked like this:
This led to two theories:
DC2 and DC3 are completely empty.- DC2 and DC3 act as "overflow" servers for DC4 and DC1, respectively.
📜 Telegram DC Allocation Rules (As of May 2022)
TL;DR: User assignment to
DC1,DC2,DC4, andDC5is determined by the country code of the registration phone number. These four centers are active and continuously accept new users.
Regarding the "missing" centers:
- DC3: While it once hosted users, it appears that around 2020, existing accounts were migrated to
DC1. It currently accepts no new registrations. - DC2: This center is very much active. For example, users with a German number (
+49) are typically routed here.
Why did the bot fail to find DC2 users?
The bot's detection logic was flawed. To prove this, the author tested three different identification methods:
Detailed Method Analysis
-
Method 1: The Login Attempt By using a phone number destined for
DC2but attempting to connect viaDC1using the MTProto protocol, the server returns aPHONE_MIGRATE_2error. This explicitly tells the client to move toDC2.- Downside: Requires the user's phone number.
-
Method 2: The File/Profile Method Using a third-party client like Plus Messenger, one can view the
dc_idfield within theuserProfilePhotostructure.- Nuance: The DC is only visible after a profile picture is uploaded, as the DC is determined by where the physical file is stored.
-
Method 3: The Web CDN Method The bot used this method by analyzing the source code of:
https://t.me/dctestIf a profile picture URL starts with
cdn4, the bot assumes the user is onDC4. However,DC2andDC3borrow the CDN domains ofDC4andDC1(their regional counterparts). Consequently, allDC2users were misidentified asDC4users.
👻 The Disappearance of DC3
While DC2 users are common globally, DC3 has become a "ghost" center. Even when using the accurate Method 2, DC3 users are nearly impossible to find.
The author identified two potential candidates: @urie** and @flowinglig**. However, deeper analysis using photos.GetUserPhotos suggested that even these users might not truly reside on DC3.
Visual Evidence from the Investigation:
