Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon EC2 Auto Scaling test

I created an Amazon EC2 Auto Scaling group, where it should have at least 1 server all the time.

  1. Add up 2 servers when CPU utilization passes beyond 80%

  2. Terminate 2 servers when CPU utilization comes down less then 30%

Challenge here is, How should I increase/decrease CPU utilization? I cannot connect to any instance or use CLI since I am in Office system / restricted AWS access.

Is there a way to test this despite of these restrictions?

like image 819
Abdul Salam Avatar asked Mar 06 '23 01:03

Abdul Salam


2 Answers

There is a way to stress test an instance or container (assuming it is Linux based) using Stress, a package that is designed to crank up the CPU for a specified amount of time and then bring the CPU percentages down after the specified amount of time. It has other parameters to customize the testing.

My personal favorite tool for testing system response and DR is to use Netflix's ChaosMonkey. It is an open source project, backed by Netflix that is designed to test fault tolerance. Using it in production comes down to personal preference, but it is a tool for testing systems.

like image 192
Justin Rice Avatar answered Mar 15 '23 16:03

Justin Rice


If you want to test the "real" situation, then you will need a way to generate load on the system.

This could be artificial load (eg triggering a program that does calculations, just to spin the CPU) or a real-world simulation of actual activities that you system will perform.

There is no need to test whether Amazon EC2's Auto Scaling actually works — there would be issues shown on the AWS Status Page if that were the case — so I presume you just wish to test your own configuration. In this case, you should really be testing a real world scenario, such as simulating a quantity of simultaneous users doing typical activities that users would perform.

If you do any other form of testing (such as fake increasing of CPU load), you're not really testing the real situation in which you want Auto Scaling to perform, so the results of your test won't actually be useful.

For example, it might be that your application runs into memory issues or single-threading issues way before it hits any CPU limits. That would be something you'd really like to know before throwing real users at your system.

like image 23
John Rotenstein Avatar answered Mar 15 '23 15:03

John Rotenstein