Introducing our development - geo-hosting
Why did we do this?
It is well known that the page loading speed of a site is greatly affected by how far the user is from the server on which this site is hosted.
If users visit the site mainly from one region - the issue of download speed is easily solved - the site is placed on a server that is physically located in this region. But what if the site is visited from several distant regions, or from around the world?
We tried to answer this question by developing our own CDN ( Content Delivery Network, content delivery system ) and providing a new service - geo-hosting .
Geo-hosting involves placing the site on several servers at once, which are located in geographically distant data centers, and organizing the system so that information is given to the user by the server that is geographically closer to it.
How did we do this?
As a first step towards building a content delivery system, we installed 3 servers in data centers in Ukraine, Russia and the USA.
Content is stored on each server. The system works in such a way that the site owner does not need to change the operation of the web application to work with a distributed architecture. Users are provided with cPanel hosting control panel for managing and uploading information to the server.
First of all, it was necessary to find a system that would allow you to copy changes to the file structure of the site data. Moreover, you need to synchronize data in all directions, that is, when changes to the site files are made from anywhere in the geo-hosting. To solve this problem, we chose the Unison program.. It has ample opportunity to copy data simultaneously between multiple servers.
In principle, it was possible not to synchronize the data, but to use one file server to store it and connect any geo-hosting points to this server, however, with this scheme, failure of the file server will lead to the failure of all points in the system. Again, you can make a cluster for the file server, but do not forget about possible delays in the access of the front-end server to our file server with such an organization.
Next, we started to build a DNS system, because it was she who was supposed to help us send the user to the nearest server relative to its geo-location. We use the well-known GeoIP. By installing a special patch using GeoIP, to the DNS system, we can determine, and most importantly, redirect users to the desired (closest to them) server.
That is, it works schematically like this:

An important step in building a CDN is to address the issue of database synchronization. In our geo-hosting we use the master-slave-slave system model, that is, one server is a master, and the other two servers duplicate it. Slave-servers periodically interrogate the master-server for changes in the database. Thus, all changes on the master server are repeated on the slave servers. This creates data redundancy on two servers and thereby achieves high data availability and reliability. An important advantage of this replication, for example, over regular copying, is that we transfer only the changes made over the network each time, and not all the data. The master server writes all changes in the database to the “binary log log”, assigning a number to each operation. When the slave server accesses our main server,
We control this architecture with Zabbix , which is very convenient to use for online server monitoring. With its help, we control the work of both the master and its two replicating servers. Zabbix also monitors the DNS server system, as it is a very important link in the geo-hosting system.
What did we get?
One of our clients kindly agreed to test our development on his site. The results of the work pleased him and us.
The first screenshot shows the results of a survey (from different parts of the world) of a site located on one server in Ukraine:

The second shows a survey of a site that is hosted on three servers in Ukraine, Russia and the USA:

And for clarity, the comparison in the diagram:

What so far has failed?
Make such a solution for multisite accounts. So far, only one site option works - one cPanel account.
Side effects
There is nothing wrong :)
In addition to the main task - increasing access speed, geo-hosting provides several more advantages:
- less vulnerability to DDOS attacks due to the redistribution of the flow of requests to the site, as well as the ability to limit requests from a specific region;
- the load created by the site is distributed between several servers;
We also continue to develop the built system in order to find more and more useful “side effects”.
How to get the?
While you can get it for free for a month - in testing. Then paid - details on the page .
I would also like to note that this proposal is basic, but we will gladly meet the wishes of the client and configure a similar system for VPS and servers, We can also consider placing the site on servers in countries other than the base three - Ukraine, Russia, the USA.