How to create a RESTful API that is redundant over multiple providers?

burnedfaceless used Ask the Experts™
I've got a job creating the backend for a mobile app for a company. They will need me to do sysadmin tasks as well.

This app is useless if it can't connect to a server. I need to come up with a redundant setup, ideally over different providers (would like to use Linode and AWS).

I was wondering - what is this called, and how do I set it up? The most similar thing I have done is hosting a database on a separate server - both of those were in the same datacenter. I've read that you do not want the database to accept connections from public IP Addresses.

How do I set this up where there is redundancy over multiple data centers?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
nociSoftware Engineer
Distinguished Expert 2018

It doesn't matter if servers are in one place or scattered around the world. The problem how is state conserved....

If it is like wikipedia and you can copy all data in the background, then you can distribute the files all over the place and only serve them when requested.
If it is a transactional system (bank f.e.) then all Front Ends, need to be able to access a consistent state of the account held...
(It should not matter if the first view is from server 1 and the update is done on server5 and the result is confirmed through server 21) they all should have one persistent vision of the state of the account).
So how well does scaling to access the backend work. Of can those be scattered as well. (ie. non transactional system).
You have 3 challenges, all must be addressed to have redundancy.

The challenge of process Isomorphism
Both back end services must be equivalent in terms of the processes they run.
Your build, patch and deployment processes must result in changes happening in both datacenters. I suggest that you look into tools like Terraform to manage your infrastructure, and use CI/CD automation platforms to push application changes.

The challenge of data Isomorphism
Both back end services must be equivalent in terms of the data they have.
They do not have to be 100% equivalent, but with an RTO and RPO that fit your business requirements.
You need tested backup, restore and replication procedures. Which ones to use really depends on your technology stack.

The challenge of switching over
Will you run in Active/Active mode? Maybe Active/Passive with failover? What are your RTO and RPO?
If running active/active, you need global load balancing. This can be done via smart DNS like Dyn or NS1. For http endpoints, you can use CDN services like Akamai or Fastly, or  load balancing services like Spotinst Multai.
Fractional CTO
Distinguished Expert 2018
No way to guess without more information.

If you must have 100% robustness, run a LAMP Stack with database replication + have a discovery mechanism built into your App to find all IPs + contact any one which is available, like how MX records are contacted by priority to attempt delivering mail to many IPs.

If this is your first time building an Always On App, best to have some long conversations with people who build this sort of App all the time.

100% robustness + 100% exact same data view at every server instance 100% of the time is a fairly complex task.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

nociSoftware Engineer
Distinguished Expert 2018

100% robustness + 100% exact same data view at every server instance 100% of the time is a fairly complex task
.  == impossible...

99% is relatively trivial, 99.99% availability is less so, 99.9999% or 99.99999% if you really want to spend money..., there will allways be a small % at the moment one of the servers or connections to it fail in the middle of an action....   Besides thinking in positive actions, one needs to think of failure modes., What failure modes are acceptable for what time, and what failure need to be attended into what way. (That is where RTO/RPO comes into play)   or the requirements on transaction safety & consistency.


David, can I get some contact information?


David, if you can Skype I can pay a consultant fee. My email is burnedfaceless -at- gmail -dot- com.
David FavorFractional CTO
Distinguished Expert 2018

Just PM'ed you my Skype info.

I can either assist you or point you to someone else better.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial