Last week, I talked about Ruby and some of the awesome things that you can do with Ruby and iControl together. I also chatted a bit about why that's exciting to me, and gave the first of several examples of Ruby and iControl working together.

This week I'll take a look at the next example in line, the Ruby Web Accelerator Policy Switcher. Why might you want a way to switch policies in an automated fashion you ask? Allow me to illuminate.

Business these days moves at a pretty astonishing speed. Between dynamic content coursing through multiple data centers for a given application, social media driving the increased upload / download of rich, frequently updated content, and the ever increasing tide of new Internet users wading into every corner of the web, businesses have their work cut out for them. Their goal remains the same, of course - to quickly and reliably deliver their content to the users that are demanding it. Whether you're talking about an Oracle app, an Exchange server or a Web Application, this core concept remains the same.

This presents two real core problems, at a high level. 

1.) Make it reliable.   

2.) Make it fast.

Fortunately there are some pretty solid, well-documented ways to solve issue #1.  There are these Application Delivery Controller things you may have heard of.  I highly recommend checking them out...

The second issue is one that is a little bit more complex.  As it turns out, "fast" is a little bit hard to quantify these days.  What most users seem to deem "fast" is really something that's fast AND flexible. It has to be fast at its core to have any hope of turning out the speeds people want when using an application. But there's just not much chance that you can make a single application fast for absolutely every user and use-case out there, unless you're serving extremely simple, static content. Without proper flexibility to adapt to a given user's demands or situation, there's no way that it can be "fast" as far as the user's perception goes, and that's what counts after all. This is where an acceleration system like F5's WebAccelerator comes into play.

WebAccelerator offers not only the vast improvements to performance needed but also gives you some outstanding options for flexibility. This isn't a marketing piece though, so let me get to the point: Policy switching. Performance tuning on the WA is handled via policies that you can tune to different applications or deployment needs. Generally you'd apply one of these policies and tune as necessary. As I've just described though, there's often a need to move and bend while delivering applications, which is where the ability to swap policies becomes crucial.

This is something that you can absolutely do manually on your WA. Just log in, move policies around, apply the changes, and you're off and running.  Let's be realistic though, you're not going to do that. You're not going to do that in any large-scale deployment, and especially not if we're talking about switching them around more than once every few months.  So if only there were a way to perform these changes in an automated fashion.  As if on queue, the Ruby Web Accelerator Policy Switcher steps in to help out.

This example is a bit more simple than last week's, but it's every bit as useful. The idea is a great one - allow users to automate the changing of Web Accelerator policies. This way whether they're trying to stay in front of users' needs or just testing multiple policies, they can do it quickly and easily across multiple systems. That's it, it's that simple. It does so by mirroring the WA policies from one place to another, so you can connect to a BIG-IP with the policies that you want to use in place and mirror them to another system, remove them, etc. Take a peek at the code and it'll become clear pretty quickly I think. Each function is described on the wiki entry as well.

The code is available as before, so take a look, but here's a taste of the create section:

def createPolicy(app_name, local_policy, remote_policy, hosts)
begin
requested_hosts = CommonStringSequence.new
@output.writeln "    Creating #{app_name} WA application policy on BIG-IP 1"
@output.writeln "      with policies #{local_policy} and #{remote_policy}"
@output.writeln "      for hosts:"
hosts.each do |host| 
@output.writeln "        #{host}"
requested_host = "requested_host(domain=>#{host}, destination_pool=>INTERNAL)"
requested_hosts << requested_host
end
@bigipDriver.create(app_name, app_name, local_policy, remote_policy, requested_hosts)
@output.writeln "    Creating #{app_name} WA application policy on BIG-IP 2"
@output.writeln "      with policies #{local_policy} and #{remote_policy}"
@output.writeln "      for the same hosts:"
@bigip2Driver.create(app_name, app_name, local_policy, remote_policy, requested_hosts)

While there are plenty of other ways to do this, I'm really happy to see more ways that people are making use of Ruby and iControl, so this one gets the spotlight today. Any language could have been used, of course, thanks to the iControl API being platform agnostic. Perhaps I should have said "allow me to ramble" rather than "allow me to illuminate", but I think you get the idea. This is another cool example of using Ruby to do iControl type things that can make your life easier.

Get the Flash Player to see this player.