How to select an optimal location for your server?

Optimal location

Why do all the cloud platforms try to reach as many countries as they can? Almost all the cloud service providers have multiple locations. Including all the traditional VPS/Dedicated/Bare Metal providers.

Most probably, You are already selecting proper location for your server. There is a simple rule to follow.

Select a location that is closest to your major traffic source.

For example, If you are getting majority of traffic from India, You should select an indian data center while creating a cloud instance in any platform.

It is same for all the other locations. If you are targetting audience in USA, the data center to select should be in USA.

The closest your server is from your major traffic source, the better!

If you want to know why is this the case, continue reading.

Latency

Latency is the time it takes for data to travel from one point to another on the internet.

Having server and audience on the opposite side of the planet can make your site slower by ~300ms which is 0.3 seconds approximately for 1 request. But a site that opens in 900ms is better than the one opening in 1.2 seconds, right? Also, in practical world, a web browser may make multiple connections with the server. Which means multiple slower requests.

Here is the table showing latency from one location to another for many locations the world.

server location

As you can see, If you are going to target audience from Australia (Sydney), You must have your server location in Sydney or Melbourne, Australia.

You can check latency between two locations by yourself.

What if my audience is world wide?

If you have worldwide audience. There is one thing you HAVE to do to improve the performance of your site world wide.

You can improve the performance of your sites using CDN. CDN helps you serve static elements of your site. It delivers the content of your site from the location closest to the request.

You can serve files like CSS, JS, Images and other static files for your server using CDN. So, If you have world wide audience, You can still serve majority of the requests from optimal server location using CDN. Only the requests for dynamic content reaches your main server.

Conclusion: We are talking about the same latency that you have to manage while playing a multi-player game. If you have 100+ ping/latency with server, You will not be able to play the game properly because the data is taking longer to reach the server and return.

It is very important to select a correct location for your server if you are targetting audience from a specific location. It will largely improve the experience of your users, specially if your site is generating dynamic data for your users (i.e. SaaS or self-hosted). I hope this small piece of content helped you understand how to select an optimal server location. If you have questions, please let me know in the comment section.