Q:

Having backend and database on different data centers

I am developing a web/mobile application and I want to host it on one of the cloud platforms. I want to keep the backend/web application on Heroku and I want to keep the database (PostgreSQL) on DigitalOcean. I am curious if there would be a performance overhead by separating backend and database. Thanks.

A:

Performance is definitely impacted when putting distance between the application and the database, the severity of that impact is dependent on two factors

Speed of connection between application and database.
Frequency of communication between application and database.

If your application isn't very data-reliant, you can get away with this separation without much performance impact... but if your application needs to read/write to the database with every action a user takes you may start to notice the delays.
That said, it's not uncommon to separate like this, though most would suggest you put the two as close together as you can afford to.

