The price of the cloud

Hosting ciboulette.net on Heroku : 40 € / months, potato performance

I run an app (ciboulette.net) in the cloud. This app generates about 1000 € / month of revenues. I try to run it in a way that doesn't cost too much, while keeping good performance.

I started by hosting it on Heroku, for free at first, and then with a paid mLab database. The app is built with meteor and therefore needs MongoDB. Heroku quickly got expansive though, the database in particular, at the time I was making much less per month and the hosting was already costing around 40 € / month.

Moving to digital ocean : 30 € / months and great performance

I switched to digital ocean, with a small instance at 5€ per month I could run the app much more smoothly. The lag introduced by having an external MongoDB host was a real problem that was fixed by simply hosting the db on the same machine as the app itself.

I couldn't have made that switch without the help of meteor up, an amazing free tool that helps you deploy meteor apps very easily. I now sponsor the author on GitHub and use their APM service to monitor the performance.

For backups, I just have a cron on my machine that pulls a mongodump every day. If disaster struck, I'd be able to rebuild from that, with only a few hours of data loss. I think that's actually an ok outcome and a risk worth taking.

At some point, my 5€ machine showed her limits though, so I upgraded to something a bit beefier and had to allocate some swap too. It took me a while to understand how to deploy without much downtime also.

My production instance is now a "premium intel" : 2 vCPUs, 4GB ram, 80 GB SSD storage, and costs 28$ / month.

I also have a "space" that has 460 MB of product pictures (similar to S3) out of the 250 GB included in the base 5$/month. This saves me the trouble of backing up those pictures every time I back up my db, keeping the db dumps lean at around 600MB compressed.

Hetzner.cloud would cost 10 € / months for better performance

One limitation I found was that my staging instance needed to be almost as beefy as the production to be able to handle mongorestore workload. I wanted staging to be a playing field that would let my user preview new features on a copy of their data, so I need to push a clone of the db (actually, one of my daily backups) to the staging instance, and that took .. Forever.

I heard that hetzner could be a bit cheaper than digital ocean, so I opened an account there. I was happily surprised, it is indeed better value. My new staging instance has 2 vCPUs, 4GB ram, 40GB SSD and costs me 5.82€/month. This is on par with my production machine at a 76% discount. I'm planning to move production to hezner at some point too. But for now my focus is on developing new features, not squeezing the last euro out of my hosting bill.

I haven't found an equivalent S3 compatible file hosting feature in hetzner yet, so I'm not ready to fully switch.

Benchmarks

In the last year, i've gotten used to reading benchmarks of CPUs on PassMark to have an idea of how powerful a computer really is. This made me realize how underpowered some devices are, and I was curious of how a cloud machine would compare to a real PC.

I picked a test that's very easy to run on any Linux machine and stresses the CPU a little bit, here's how to run it :

sudo apt install sysbench
sysbench cpu run --threads=16
# then look at the line "events per second", higher is better

I then ran this on a variety of machines :

My conclusion is that the price of cloud machines if very high compared to running something on premise, but at the same time, the convenience and stability are worth it.

Taking a look at meteor cloud

My favorite framework has a cloud hosting offering : https://www.meteor.com/cloud

This is how they finance the development of the open source framework, and it shows.

Once you pass the free usage threshold, the pricing looks scary

https://www.meteor.com/cloud/pricing

A "professional" container with 2 GB of ram and 2 "ECU", whatever that is, costs 158 $ / months. Instead of 5$.

Closing thoughts

I should be focusing on getting more customers instead of counting pennies, but here's the gist :

I'll stay in the middle until I need real performance, at which point I'll run a beefy server at home.