Test manual scaling solution

Overview

ℹ️ Information: Manual Scaling is performed by explicitly adjusting the Desired capacity parameter of your Auto Scaling Group. After modifying this value and confirming the update, the ASG will automatically launch or terminate EC2 instances to match your specified capacity.

Test Environment Setup

Once your Auto Scaling Group is created, the service automatically launches an EC2 instance according to your configuration. To verify this deployment:

  1. Navigate to the EC2 Console
  2. Select Load Balancer
  3. Choose the Resource map - new tab

Auto Scaling Group Initial State

ℹ️ Information: You should observe the Target Group linked to two targets - your original EC2 instance and the new instance created by the Auto Scaling Group.

Configuring the Load Test

Now we’ll configure the load testing application downloaded earlier:

  1. Open the application, right click to Test Plan > Add > Threads (Users) > Thread Group Auto Scaling Group Initial State
  2. Configure the following settings:
    • Name: Load Test
    • Number of Threads (users): 20000
    • Ramp-up period (seconds): 100
    • Loop count: Infinite
    • Duration (seconds): 600 seconds
    • Click Specify Thread lifetime
    • Startup delays: 0second

Load Test Configuration

  1. We right click to Load Test > Add > Sample > HTTP Request

URL Configuration

  1. Return to fcaj-alb the copy DNS Name Starting the Load Test

  2. Type DNS Name you copied, paste into Server name or IP

Starting the Load Test

  1. We set the frequency for each request:

    • Right click to Load Test > Add > Timer > Constant Timer
    • Thread Delay: 1000 ms URL Configuration URL Configuration
  2. View details of each successful or failed request: Right click to Load Test > Add > Listener > View Result Trees. Starting the Load Test Starting the Load Test

  3. Summary of speed and error rate: Right click to HTTP Request > Add > Listener > Summary Reports Starting the Load Test Starting the Load Test

  4. Finally, press Ctr + S key to save file before we starting test Starting the Load Test

  5. In the tool bar, press Start button Starting the Load Test

Monitoring Instance Performance

While the test is running, return to the AWS Management Console:

  1. In the EC2 Console, select both EC2 instances in the target group
  2. Click on the Monitoring tab to observe performance metrics

Initial Performance Metrics

💡 Pro tip: Focus on these five key metrics to understand your application’s performance under load:

  • CPU Utilization (%): Shows processor usage
  • Network in (bytes): Measures incoming traffic
  • Network out (bytes): Measures outgoing traffic
  • Network packets in (count): Shows incoming packet count
  • Network packets out (count): Shows outgoing packet count

ℹ️ Information: The charts display one line per selected instance. Selecting multiple instances allows you to compare their performance simultaneously, helping you understand how the Load Balancer distributes traffic.

Manually Scaling Down the ASG

To simulate cost optimization during off-peak hours:

  1. Navigate to your Auto Scaling Group details page
  2. Note the current setting: Desired capacity = 1
  3. Click Edit to modify the capacity

ASG Initial Configuration

  1. In the Group size dialog, set both Desired capacity and Min desired capacity to 0
  2. Click Update to apply the changes

Scaling Down Configuration

  1. Navigate to the Activity tab to monitor the scaling action

Scaling Down Configuration

⚠️ Warning: While the instance is being terminated, you should pause your load testing application to avoid potential errors.

ℹ️ Information: The ASG will automatically terminate an instance based on your updated configuration. After a few minutes, returning to the Load Balancer’s Resource map will show only one remaining target.

Scaled Down Resource Map

💡 Pro tip: Remember to restart your load testing program after the scaling operation completes to continue your testing.

Observing Notification and Performance Impact

  1. After scaling down, you’ll receive an email notification from Amazon SNS: SNS Notification

  2. Return to the EC2 Console to observe the impact on your remaining instance: Single Instance Metrics

Conclusion

⚠️ Warning: This demonstration uses simple GET requests, but real-world applications typically involve more complex operations that consume significantly more CPU resources and may experience more dramatic performance impacts during scaling events.

🔒 Security Note: While manual scaling provides direct control over your infrastructure costs, it requires human intervention and monitoring, which can lead to delayed responses during unexpected traffic spikes. Consider implementing automated scaling policies for production workloads to maintain both performance and security.