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

github logo ・1 min read

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.

twitter logo DISCUSS (4)
markdown guide
 

Have you made load-testing scripts in order to check the performance characteristics of your app running a single VM? If it's a REST interface, it should be relatively easy to do. Once you are able to run your app under load, monitor your app to see where you are hitting performance bottlenecks and see if you can fix them by adjusting the app itself. If you've addressed all the bottlenecks, and still are not happy with the performance, then run exactly the same tests with a load-balanced second instance. At that point, you'll know your next move.

 

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?

 

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?

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~

Classic DEV Post from Apr 4

Design Patterns in Java

I thought it would be a fun to write a series of blog posts looking at differen...

Harry Alvin Waidan Kefas profile image
Try to do anything as quick as possible :v

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️