I am trying to get my backend stuff up and running and I am looking into the best way to save money, my app does api request usually between 8:30 am and 8:30 at night, with the morning, lunch and night having huge peaks.
What I planned to do is set up autoscaling instance group on google compute engine, but I ran into trouble in setting it up.
At first I set it up with nginx on a instance, and multiple copies of my vm all load balanced, but that does not help me with peak hours as well as saving money.
So I looked into the autoscaling, the issue I have is, my VM uses docker containers, with 3 running containers, one for nginx, one for couchdb, and one for some other background stuff.
What I tried to do is create a instance-001 that has the base work, all the files, databases, and everything. Once that hits 70% load, it will duplicate itself, and then load balance between the two.
The issue is I cant get it to keep the data, and spin up a duplicate. After setting one instance all up and working, (instance-001), I hit it with some loads, forcing it above 70%, it then spun up two more instances, 002, and 003, both empty clean vms, and then once it went below 70%, and the VM's were being removed, 001, with the actual data was removed, and 003 was left over.
As of right now, I am unsure how to set it up to scale and load balance.
The VM's were just 1CPU 3G machines with a 10GB ssd for testing, and I was following https://www.youtube.com/watch?v=TfbEwfYjKl4
It is slightly outdated as before it allowed you to load from snapshots, which is how I did this before, now it wont.
My biggest thing is what is the best production style setup for scaling a couchdb getup.