Handling disaster recovery and geographic distribution with Nginx

Davide Cerbo
4 min readSep 28, 2019

Clustering a microservice, or a web application, in a single datacenter can help us in performance and availability, but what’s happens when our users are distributed worldwide, or there is a disaster and our data center isn’t more available?

TL;DR: Jump directly to the Demo section!

So, we decide to serve our application from the closest datacenter to the user, to improve network latency, database load, and in general performance, and, moreover, we will use the other datacenter as a backup when the principal datacenter isn’t available, in order to have high availability (HA), also in case of a disaster recovery.

In the image above, devices on West Central US will contact Backend One Principal in the datacenter on the left, while devices in South East Asia will be redirected on Backend Two Principal in the datacenter on the right. When datacenter in West Central US isn’t more available the load balancer will redirect requests to the datacenter in South East Asia, and vice versa.

What about data?

The data are replicated between datacenter using well-known replication mechanism provided by databases like Cassandra, MongoDB and so on, so it isn’t our business. To simplify transactions and locks on data, we can decide to…

--

--

Davide Cerbo
Davide Cerbo

Written by Davide Cerbo

Open-space invader, bug hunter and software writer

No responses yet