Some background: I’m a solopreneur paying rent with what’s currently a Rails app on Heroku, and I’ve been about two months away from deploying a rewrite in Elixir/Phoenix for the past year.
I’ve got Edeliver deploying to some DigitalOcean droplets, and I’ve been toying with some different options for where/how to host my Postgres.
Options I’ve considered:
- Rolling my own Postgres on another DO droplet
- Continuing to use Heroku Postgres (or some other Postgres as a service, Compose looks like a thing?)
- Just Heroku-ing the whole thing, even though I’d lose some BEAM-y goodness by doing so
I specifically wanted to test #2 (continuing to use Heroku Postgres) to see how much latency “cost” I’d be incurring by having my app servers and DBs not in the same “house”.
My test was seed script that adds about 60,000 rows of test data (roughly representative of one year’s worth of data for a customer of my company). Here are the results:
DigitalOcean droplet (NYC-3) to a DB on localhost
4 minutes and 43 seconds
DigitalOcean droplet to another droplet in the same region
6 minutes and 40 seconds
Digital Ocean droplet to Heroku Postgres
51 minutes and 57 seconds
I wasn’t quite prepared for the magnitude of the difference. If the cost of DBAAS convenience is a tenfold increase in latency for my users, my inclination is to invest my time in running my own database. Would love to hear what choices others have made…