📜 ⬆️ ⬇️

We present our development - geo-hosting

Why did we do this?

It is well known that the speed of loading a page on a site is greatly influenced by how far the user is from the server where the site is located.
If users come to the site mainly from one region - the issue of download speed is easily solved - the site is hosted on a server that is physically located in this region. But what if the site comes from several distant from each other, regions or from around the world?
We tried to answer this question by developing our CDN ( Content Delivery Network, content delivery system ) and providing a new service - geo-hosting .
Geo-hosting means placing the site on several servers at once, which are located in geographically distant data centers, and organizing the operation of the system so that the information is given to the server that is geographically closer to it.

How did we do it?

As a first step to 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 the distributed architecture. Users are provided with a 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 copying changes in 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 any geo-hosting point. To solve this problem, we have chosen the Unison program. It has ample opportunities to copy data simultaneously between multiple servers.
In principle, it was possible not to synchronize the data, but to use one file server for storing them and connect any geo-hosting points to this server, however, with such a scheme, the failure of the file server will lead to the incapacity of all points of the system. Again, you can make a cluster for a 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 in the DNS system, we can determine, and most importantly, redirect users to the desired (closest to them) server.

That is, schematically it works like this:

An important step in building a CDN is to solve 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 with a certain periodicity interrogate the master-server for changes in the database. Thus, all changes on the master server are repeated on the slave servers. In this way, data redundancy is created on two servers and thus high availability and reliability of data is achieved. An important advantage of this replication, for example, before regular copying, is that we transfer only the changes made over the network each time, 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, it reports the number of the last operation it has already performed, and receives all the new changes, counting from this number.
We control this architecture using Zabbix , which is very convenient to use for online monitoring of servers. With it, 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 website. The results of the work pleased both him and us.
The first screenshot shows the results of a survey (from different parts of the world) of a site that is located on the same server in Ukraine:
Survey of a site hosted in Ukraine

On the second - a site survey, which is hosted on three servers - in Ukraine, Russia and the United States:
Survey site, located in Ukraine, Russia and the United States

And for clarity, the comparison in the diagram:

What has not yet succeeded?

Make this solution for multi-site accounts. While it works only for the option one site - one cPanel account.

Side effects

It's okay here :)
In addition to the main task - increasing the speed of access, geo-hosting has several advantages:

We also continue to develop the constructed system in order to find more and more useful “side effects”.

How to get?

While you can get free for a month - in testing. Then charge - the details on the page .

I would also like to note that this proposal is basic, but we are happy to go to meet the wishes of the client and set up 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, USA.

Source: https://habr.com/ru/post/106944/

All Articles