Multicloud load balancer (Firebase and Digital Ocean)

Viewed 99

I'm currently running my webapp on Firebase Hosting under the free tier, but I am about to start advertising a little bit, meaning I will drive consistently traffic to the website with clear in mind that the conversion rate, aka purchases, will be really low (I'd be happy if 0.1% converts xD).

To avoid incurring in huge cost from Firebase, without a relative return, would it be possible to turn on

1 Load Balancer
1 Instance (small, 5 eur/month)

on Digital Ocean with a replica of the website and drive traffic also there with 1 of the following possible patterns?

  1. 50-50, halving the load on Firebase at the very least
  2. (best, but not sure if possible) hit Firebase Hosting only when Digital Ocean is reaching saturation

Is it feasible in any way? Do you have previous experience on this?

Thank you

1 Answers

It's definitely possible to implement a load balancer like that. But that's a quite involved and advanced project, and I'd seriously consider whether it's worth it for this type of optimization.

From the Digital Ocean docs:

Droplets include free outbound data transfer, starting at 1000 GB/month for the smallest plan. Excess data transfer is billed at $.01/GB.

And for Firebase Hosting:

Free/Spark plan: GB transferred: 10 GB/month

Metered/Blaze plan: GB transferred: $0.15/GB (with the first 10GB/month being non-charged)

If you're going for pure bandwidth cost, it seems that your Digital Ocean droplet is always going to be cheaper. Also: the free quota on Firebase is 100x smaller than the included bandwidth in your Digital Ocean plan. Are you really looking to shed load from Digital Ocean to Firebase for a 1% increase in the quota?

For hosting of static content, I'd recommend finding a single host that has a pricing plan that fits with what you're willing to pay. It's just not worth the overhead of coming up with your own load balancer.

If instead you are looking for a load balancer that somebody else already built (or a tutorial on how to build one), those questions are off-topic on Stack Overflow and are a better fit for your favorite search engine. If you get stuck while implementing the load balancer, post back with the concrete question about where you got stuck.

Related