Exploring Kaavo Autoscaling With A Real-World Demo

Filed in by Wade Minter | April 8, 2010 2:40 pm

Rackspace Cloud partner Kaavo[1] knows that being able to autoscale your cloud applications is important. They also know that it can be a little tough to wrap your head around how to get this autoscaling working, so they’ve put together a fully-functional three-tier (load balancer, app server, database server) demo application to demonstrate it. This demo application is available to any Kaavo user, so it’s easy to go in and get your hands dirty.

Kaavo offers free 30-day demo accounts to its IMOD system. Just visit the Kaavo site and look for the “Sign-up for free trial” link.

Once you log into your IMOD account, you’ll see a list of available templates. These are packaged definitions that will set up environments for you. We’re going to to look at the “Linux php-colab 3tier-For-Rackspace” template. That will set up our three-tier architecture, and will install and run the phpCollab project collaboration application as well, so we’ll have a real-world product in place by the end.

Click on that option in the templates list, and you’ll see an XML file appear on the right. Kaavo uses XML to define these environments and control what they can do. A more user-friendly interface to handle common cases is in the works, but you can control nearly any aspect of the deployment from this XML file.

Template Selected[2]

Each of the tiers is defined in a tier section in the XML. You can specify the order in which the tiers are displayed and the order in which they are started. Handy, of course, if your application needs its database online before the web servers attempt to talk to it. You can also specify command actions that will run as each server in that tier comes online. For example, in the above screenshot, you can see that in the web_tier (where the load balancer lives), there are several actions that run. We’ll take a look at how those actions are defined shortly, but the names should be pretty self-explanatory.

Tier Definition[3]

Scrolling down the XML, we can see the actual Cloud Servers that make up this tier. We can see that there should be a minimum of one and maximum of two load balancers running at any given point in the autoscaling cycle, and we should start up with 1. We’re using Cloud Server image 187811 (CentOS 5.4), and flavor 1 (256MB server). Those can be adjusted to taste. The other two tiers are set up in a similar manner, though in the db_tier you can see an example of having different server types within one tier.

Multiple Server Types[4]

Next in the XML, we see the actions defined. These are the scripts that will be run on the specified servers to perform the actions that we want. Some of the actions can be executable scripts, and some can just be raw files (config files and the like) that aren’t run. Below, we see both types in the screenshot below – one will install some RPMs, the other just sets up the MySQL cluster manager config file. Note that the execute attribute is set to “true” on the script, and “false” on the config file. Note also we’re specifying the path and filename.

MySQL Manager Actions[5]

There is also variable substitution available in these actions. In this action, we can see variables (parameters) set statically in the XML file, as well as ones dynamically generated (the IP addresses of the ndbd servers).

Parameter Substitution[6]

Finally, at the bottom of the file, there are event handlers, to run actions when states change, such as tiers are scaled up or down.

Ok, enough XML, let’s see how it works. At the top of the XML listing, fill in a system name and hit Deploy System. You’ll see that system listed under My Systems on the left. Click on that to see a diagram of your system and its tiers. You’ll notice that it’s “unconfigured” – you need to go into each system type and choose the Rackspace Cloud account to run them under, as well as adjusting images and flavors.

Edit Configuration[7]

Once all systems are configured, you should see the initial configuration (number of servers, etc) as you defined in the XML. Now you can press the “Start System” button and wait. You’ll see spinners pop up in the display as servers are configured in the order that you specified. Enjoy the emails notifying you of the new servers that are being started. We’ll wait.

Grab a snack while you wait.[8]

All done? Great! You should now have green lights and “Running” labels beneath all servers. If you click the blue triangle on your load balancer to get the Public IP, and open a web browser to that http://your-ip/phpCollab, you should see phpCollab! You can also go to http://your-ip/balancer-manager to see the Apache load balancer in action.

Now let’s throw some load at it. Click the “Event” button in IMOD, and choose the app-tier-overloaded event. This simulates what happens when load gets too high. You should immediately see another app server added to the mix. Visit the balancer-manager URL to see that the new server has been added to the mix.

Add Load[9]

If you’d like to play with the scaling parameters, configure the events through the IMOD UI. You’ll want to do this before starting the system, so that your changes are persisted.

Adjusting Events[10]

Now, feel free to play around with the system, add traffic, modify the XML, enjoy! Remember, you have 30 days to run the system through its paces and figure out how Kaavo can help you leverage the power of the Rackspace Cloud.

  1. Kaavo: http://tools.rackspacecloud.com/applications/kaavo/
  2. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_1_template_selected.png
  3. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_2_app_tier_definition.png
  4. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_3_multiple_server_types.png
  5. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_4_mysql_manager_actions.png
  6. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_5_parameter_substitution.png
  7. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_6_edit_configuration.png
  8. Grab a snack while you wait.: http://www.youtube.com/watch?v=vfDXlgmKFyU
  9. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/kaavo_7_add_load.png
  10. [Image]: http://c0179631.cdn.cloudfiles.rackspacecloud.com/Kaavo-IMOD-Configure-Event.png

Source URL: http://www.rackspace.com/blog/exploring-kaavo-autoscaling-with-a-real-world-demo/