Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically scale up and down Amazon EC2 ubuntu micro instances

I am building a project in which i use amazon EC2 micro instance as a server which is running ubuntu on it. I want that if the resources of this server e.g. RAM to serve the requests are exhausted , it should automatically scale up and down . I have heard of it very often but don't know how to make this instance automatically scalable. I connect to my instance using ssh through command line and i can make it start and stop etc. using AWS Management Console in browser.

like image 251
user1708240 Avatar asked Oct 18 '25 18:10

user1708240


2 Answers

Generally speaking, when you are talking about auto scaling you are dealing with a system that adds more instance in response to more demand, and deleting instance in response to dwindling demand.

I am not saying its impossible to autoscale a single instance, but if you can, its at a minimum going to require the instance to go off-line for a bit while it reconfigures itself and reboots. Usually not an option for a lot of systems.

Much better, imo, to architect your solution to use additional instances when you need more horsepower if possible and delete those instances as they become idle instead of sizing up or down a single instance.

like image 72
E.J. Brennan Avatar answered Oct 20 '25 08:10

E.J. Brennan


You can scale up the over-all Throughput (number of requests per second) as well as speed-per-request of an existing App, up to 80 times to 200 times, by replacing its "blocking (synchronous)" code with a non-blocking (asynchronous / concurrent) code (framework). (See TechEmpower Benchmarks).

Such scaling up will satisfy your needs up to an extended future (and most probably for life-time). It will also reduce your reliance on and cost of DevOps, and will minimize the complexity of administrating different traditional (old-fashioned) approaches like Queues, and third-party services (like for WebSocket).

Question becomes "which Asynchronous Framework" ? We have Netty and VertX frameworks (for Java and Kotlin), Tornado (for Python), Google's Go-lang, Erlang, MS .Net (Core) and Swoole (for PHP), NodeJS (for JavaScript) are fewer popular frameworks.

I choose Swoole (PHP) as it has zero learning curve and is easy to use and understand, with a more reliable (multi-process, multi-threaded) Architecture (specially if compared to NodeJS).

After we scale up the Performance, we are then left with minimal (rare) needs for Scaling-Out Horizontally, which as you know is possible to do dynamically at run time.

like image 40
Fakhar Anwar Avatar answered Oct 20 '25 09:10

Fakhar Anwar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!