Table of Contents | |||
RightScale Open Source Useful ServerTemplate assets |
|
ServerTemplates published by "RightScale Open Source" consist of assets published by RightScale that do not belong to a standard LTS or Infinity branch. They are typically developed by one of the Professional Services, Technical Support or Sales Engineering teams. As such, they do not go through the more rigorous QA and testing cycles. Support is via the RightScale Community and a Service Level Agreement (SLA) does not apply.
Note: Not all RS Open Source assets are documented on the Support Portal. See the MultiCloud Marketplace for additional RightScale Open Source ServerTemplates.
To launch a server that's specifically designed to test web-based applications by sending simulated real-world traffic.
This tutorial is useful to test a deployment to make sure that its application tier is properly configured to autoscale. In this tutorial you will launch a server that can be used to simulate load in order to trigger your alerts so that you can force an autoscaling event where additional application servers would be launched into the server array. In this example, the 'cpu-idle' metric is used to trigger an autoscaling event.
Although you can add the load tester server to the same deployment that you are testing, you may find it more useful to create a separate deployment (that only contains a load tester server). With this approach you can continue to repurpose the server and test multiple deployments. It will also prevent the deployment that you're testing from being cluttered with unrelated inputs.
Although you can SSH into the load tester server (once it becomes operational) and run one of the sample Siege commands outlined in the ServerTemplate's Info tab, you may find it useful to create a simple RightScript that you can run on the server using the 'Any Script' option. Once you are satisfied with the script's parameters you can clone the ServerTemplate and add it as an operational script to streamline testing.
The following sample code simulates growing user traffic to a specified URI for about 40 minutes (one cycle per minute).
The scripts starts with 50 (5*10) concurrent users making a request for the URI specified by the LOAD_TEST_URI input and increases by 10 users every minute for 40 cycles.
Copy the sample code above and create a new RightScript. Be sure to give it a descriptive name. (e.g. Siege - Load Test CPU) See Create a New RightScript.
Note: There is no need to wait for your server to become operational before completing this step.
#!/bin/bash -ex for i in `seq 5 40`; do /usr/local/bin/siege -c"${i}0" -d2 -t1M $LOAD_TEST_URI done
If you created a RightScript to perform the load test, go to the Scripts tab of the Load Tester Server and run the new RightScript using the 'Any Script' option. You will only need to specify a value for one missing input.
Input Name | Description | Example Value |
LOAD_TEST_URI | Enter the full URI that will receive the load (requests). (e.g. http://www.example.com/test.php) In order to make sure that an application server's CPU is significantly impacted by the load test, be sure to specify a page that requires a lot of CPU to load, such as a file that performs several calculations like generating a thousand unique MD5 strings. (Note: Simple HTML pages do not require a lot of CPU to load.) If you are using RightScale's sample application located in the 'unified_php' branch and want to trigger an alert that's based on a server's CPU load (e.g. 'cpu-idle') point to the 'md5.php' file, which generates 1000 unique MD5 hashes. (e.g. http://www.example.com/md5.php) To generate more than 1000, append the loop directive at the end of the URI. (e.g. http://www.example.com/md5.php?loops=5000)
| text: http://www.example.com/md5.php |
The next step is to monitor the graphs and voting tags.
When the script starts to send load, you will start to see the application tier being impacted. (Navigate to your YourDeployment > YourArray > and note the CPU thumbnail on the Instances tab)
The number of concurrent users will continue to increase and eventually provide enough load onto the application servers until they become overworked and start to vote for a "grow" autoscaling event because they need additional application servers in order to handle the amount of traffic to the site. In this example, the server array is configured to launch two additional instances when the "grow" alert is triggered.
Once the new application servers become operational, they will automatically connect to the load balancing pool and start to take some of the load off of the original application servers. Notice that the two additional application servers provide enough help to make the alert go away. As a result, the original application servers are no longer voting for a scale up action. (rs_vote:dean=none)
Once the script completes its cycles and stops sending load to the application servers (i.e. the spike in traffic ends), the application servers will start to vote for a scale down action. (rs_vote:dean=shrink) As a result, the oldest instance in the array will be terminated because the array is configured to scale down by one. (Resize Down by: 1)
Once all of your tests are completed, you can shutdown the server you ran the Siege load test script from to load up your application servers.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.