Working with Different Data Centers (2024)

The servers are divided into several data centers (hereinafter “DCs”) in different parts of the world.A complete list of proxy access points for these DCs may be obtained using help.getConfig:

dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;config#cc1a241e flags:# default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int channels_read_media_period:int tmp_sessions:flags.0?int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction autologin_token:flags.16?string = Config;---functions---help.getConfig#c4f9186b = Config;

In this context, this_dc is the number of the current DC, dc_options is a list of all DCs available at the moment, each of which has an id, ip, and port for establishing a connection. Please note that ip and port may change frequently, based on proxy server load and the user's current location.
Typically, each DC has at least one IPv4 and one IPv6 endpoint available.

To optimize client communication with the API, each client must use the connection to the closest access point for its main queries (sending messages, getting contacts, etc.). Therefore, knowing how to select a DC is required before communicating with the API.

Registration/Authorization

The auth.sendCode method is the basic entry point when registering a new user or authorizing an existing user. 95% of all redirection cases to a different DC will occur when invoking this method.

The client does not yet know which DC it will be associated with; therefore, it establishes an encrypted connection to a random address and sends its query to that address.Having received a phone_number from a client, we can find out whether or not it is registered in the system. If it is, then, if necessary, instead of sending a text message, we request that it establish a connection with a different DC first (PHONE_MIGRATE_X error).If we do not yet have a user with this number, we examine its IP-address. We can use it to identify the closest DC. Again, if necessary, we redirect the user to a different DC (NETWORK_MIGRATE_X error).

Testing Redirects

There are reserved phone number prefixes to test the correctness of the application's handling of redirects between DCs. Read more in User Authorization article.

File Access

A file saved by a user with upload.saveFilePart will be available for direct download only from the DC where the query was executed. That is why each file has a dc_id parameter:

document#8fd4c4d8 flags:# id:long access_hash:long file_reference:bytes date:int mime_type:string size:long thumbs:flags.0?Vector<PhotoSize> video_thumbs:flags.1?Vector<VideoSize> dc_id:int attributes:Vector<DocumentAttribute> = Document;photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;encryptedFile#a8008cd8 id:long access_hash:long size:long dc_id:int key_fingerprint:int = EncryptedFile;userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;

To download the file, an encrypted connection to DC dc_id must be established and used to execute the upload.getFile query.If an attempt is made to download the file over a wrong connection, the FILE_MIGRATE_X error will be returned.

Please note that encryption keys are not copied between DCs; therefore, the process of establishing an encrypted connection is started from the very beginning for each new DC. An issued auth_key can be associated with the current authorized user by using an authorization transfer.

User Migration

During the process of working with the API, user information is accumulated in the DC with which the user is associated. This is the reason a user cannot be associated with a different DC by means of the client. However, in the future, during prolonged communication from an unusual location, we may decide that the user's data must be moved to a different DC. After some time, the data will be copied and the association will be updated. Once this happens, when executing any query transmitted to the old DC, the API will return the USER_MIGRATE_X error. The client will then have to establish a connection with the new DC and repeat the query.

Authorization Transfer

The following methods can be used to eliminate the need for users to enter the code from a text message every time:

auth.exportedAuthorization#b434e2b8 id:long bytes:bytes = auth.ExportedAuthorization;auth.authorization#2ea2c0d4 flags:# setup_password_required:flags.1?true otherwise_relogin_days:flags.1?int tmp_sessions:flags.0?int future_auth_token:flags.2?bytes user:User = auth.Authorization;---functions---auth.importAuthorization#a57a7dad id:long bytes:bytes = auth.Authorization;auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;

auth.exportAuthorization must be executed in the current DC (the DC with which a connection has already been established), passing in dc_id as the value for the new DC. The method should return the user identifier and a long string of random data. An import operation can be performed at the new DC by sending it what was received. Queries requiring authorization can then be successfully executed in the new DC.

Working with Different Data Centers (2024)

FAQs

Does it matter where data centers are located? ›

Choosing a data center location close to major fiber networks is crucial for high-speed connectivity. It allows for faster data transmission and reduces latency, ensuring seamless operations.

What is the connection between two data centers? ›

Data center interconnection refers to physical and virtual data connections between companies and other data centers that enable the rapid exchange of data. Data center facilities can work together by sharing resources and passing workloads between one another.

Why have multiple data centers? ›

A multi-data center strategy ensures that businesses are online 24x7x365 and have easy access to their phone system or important data.

Which factors should you consider when selecting a datacenter? ›

Seven important considerations for your data center selection process are:
  • Location.
  • Reliability.
  • Security.
  • Network Services Capacity.
  • Network Ecosystem and Interconnectivity.
  • Flexibility and Scalability.
  • Emergency Backup.
  • Reputation.
Mar 26, 2024

Are all data centers the same? ›

Data centers can vary widely in terms of size, power requirements, redundancy, and overall structure. Four common categories used to segment types of data centers are onsite data centers, colocation facilities, hyperscale data centers, and edge data centers.

What is combination of multiple data centers called as? ›

These multiple data centers (referred to as multi-data centers) provide a scalable deployment model to support access management requirements for millions of users.

How far apart should data centers be? ›

In general, 75-100 miles distance is recommended as a good starting point for determining the right distance for your DR solution. If your primary data center is in Sterling, VA, is a great place to start. If your primary facility is in Chicago, IL, consider Phoenix, AZ or Houston, TX.

Which protocol is best suited for connecting two data centers together? ›

Multiprotocol Label Switching (MPLS)

In DCI, MPLS is used to create virtual private networks, providing secure and efficient data transport between different data centers.

Why do data centers fail? ›

The most prevalent reason for data center failure is power loss. Power outages can happen at any time. If a major power supply fails, data centers should have backup power sources. The two backup power sources that are most typically used are batteries and generators.

Why are people against data centers? ›

There are air pollution dangers. They take huge quantities of water and electricity. They bring very few jobs. “Just a dozen people, or two dozen people, run a facility that is consuming as much electricity as a small city,” Steven says.

How important are data centers? ›

Why Are Data Centers Important? Data centers store and manage massive amounts of data that organizations rely on for day-to-day operations. Namely, they host the necessary hardware for businesses to run and support their IT environments, such as: Networks.

What is the most ideal place for a data center? ›

It should be in an area that isn't vulnerable to natural disasters and be structurally sound. The location should be chosen with internal staff and end-users in mind. Expertise inside the data center is just as important, if not more important, than the infrastructure. How Far Should Data Centers Be Apart?

Why is location important in data centers? ›

One of the primary reasons why location matters for data centers is infrastructure stability. A reliable and robust infrastructure is essential for uninterrupted data operations. Data centers require a stable supply of electricity to power their servers and systems continuously.

Does IT matter where your data is stored? ›

Physical location plays a very important role in data speeds and latency. For example; Say your company is based in the UK that services customers locally. Storing your data on servers located aboard like the US means that the data must travel across the Atlantic whenever its accessed by your customers.

Where are most data Centres located? ›

The top 20 countries with the most data centers are the United States (5,388), Germany (522), the U.K. (517), China (449), Canada (336), France (315), Australia (306), Netherlands (300), Russia (255), Japan (219), Italy (168), Mexico (166), Brazil (163), India (152), Poland (143), Hong Kong (122), Singapore (99) New ...

References

Top Articles
Latest Posts
Article information

Author: Mrs. Angelic Larkin

Last Updated:

Views: 5861

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Mrs. Angelic Larkin

Birthday: 1992-06-28

Address: Apt. 413 8275 Mueller Overpass, South Magnolia, IA 99527-6023

Phone: +6824704719725

Job: District Real-Estate Facilitator

Hobby: Letterboxing, Vacation, Poi, Homebrewing, Mountain biking, Slacklining, Cabaret

Introduction: My name is Mrs. Angelic Larkin, I am a cute, charming, funny, determined, inexpensive, joyous, cheerful person who loves writing and wants to share my knowledge and understanding with you.