DEV Community

Harry Alvin Waidan Kefas
Harry Alvin Waidan Kefas

Posted on

Backend App is Done, Published using single instance of VM, A Guide to Scale?

So here's the thing. There is a backend application that contained REST API service. It was already deployed in a VM instance.

Horizontal Scaling

In order to enable the backend app to serve more connections, is load balancing (instantiate new instances and config NGiNX) the only thing possible?

Vertical Scaling

Alternative way to enable the backend app to serve more connections, is upgrading the instance spec the only thing possible?

Other Scaling

Is there something other than horizontal or vertical scaling in order to enable this backend app to serve more connections?

Something like refactor code to be more efficient by add or change something in the code?

P.S.

I appreciate any kind of thoughts about this topic.

Top comments (3)

Collapse
 
harryawk profile image
Harry Alvin Waidan Kefas

No, I haven't actually. What I know about load-testing is just running Apache Benchmark (or any other similar tools) command and I haven't done it.


and see if you can fix them by adjusting the app itself

Is this one talking about refactor the code in order to get better performance? I see.

So, the thing you were trying to say was we need to adjust the code until it performs best and then increase the load-balanced instances and do the instance addition until it meets our performance expectation?

Thus, if the performance in a single instance is enough then it wouldn't needed any horizontal or vertical scaling?

Collapse
 
johnfound profile image
johnfound

The name is "optimization". Optimize your code in order to get the best possible performance.

Also, what means "enough performance"? It is never "enough" just like that.

What if someone shares a link to your site on some of the social networks? Can your back-end serve several hundred thousand visitors daily on a single VM?

Thread Thread
 
harryawk profile image
Harry Alvin Waidan Kefas

Also, what means "enough performance"? It is never "enough" just like that.

What i meant by "enough" was "tolerated by the users" without considering any unexpected exploitation of the backend (like exposed endpoints, exposed third-party apps, etc).

What if someone shares a link to your site on some of the social networks? Can your back-end serve several hundred thousand visitors daily on a single VM?

What if, we monitor the instance on the go and just increase the instance when the requests served exceeded the instance limit? Is this the best idea to minimize the cost of server rental?

Anyway, thanks for leaving your thoughts~