AppFog – A Developer’s Best Friend? – Part 3

In the first two parts of this series, I highlighted how easy AppFog is to setup and some of the slick functionality that AppFog offers. This third part will cover a couple of neat AppFog tricks I’ve seen.

Cloning Your App
Once you have your app up and running on AppFog, you are able to clone it. There would be a variety of reasons to do this, but two that stick in my head are: offer higher availability (which I’ll touch on shortly) or providing different levels of service for different types of customers. Perhaps I would want my paying customers on a more powerful instance at, while the free customers are on a less powerful and less costly instance at

Cloning an app is fairly straightforward. You select the infrastructure you want to clone it to, specify a new subdomain, and press Clone App.

AppFog - Cloning Your App
AppFog – Cloning Your App

I decided to clone my test app from RackSpace to HP, and it went really smoothly.

Downloading Application Code for ericbrandel2
Registering App Clone
Uploading Application Code to ericbrandel5
Getting List of Services to Clone
Provisioning Service mongodb-is-fun to mongodb-is-fun-ericbrandel5
Exporting Data from mongodb-is-fun
Importing Data to mongodb-is-fun-ericbrandel5
Retrieving App Info
Starting Cloned App
Waiting For App to Start

As you can see, it also cloned the MongoDB database that I had attached to my app, and imported the data into the new MongoDB install. That is nice, but you will still have to handle data replication and consistency between the two if you want to go that route. It also does not clone any external add-ons that you may have configured.

Load Balancing and High Availability
Now, you can also use this to provide Load Balancing and High Availability for your apps. AppFog actually wrote up an example of how to do this on their blog. I won’t get into any extra detail here, as they do a pretty good job of explaining it, but essentially you clone your app to multiple data centers, and then setup HAProxy on an external server (they recommend Linode). You will still have issues to deal with, but this is pretty simple compared to other options.

PHP Workers
I stumbled across this while looking for other information on StackOverflow. There are some limitations to PHP, and one of them is the inability to really run code on the server for data processing and other tasks, in a clean and non-kludgey way. This may still be a bit of a hack, but I think it’s better than a lot of other options, especially since it isolates itself away from the rest of your code and services. It’s pretty straightforward, so take a look at it over on StackOverflow.

And that’s the final post in this little series on AppFog. There are, however, some more posts in the works that will be utilizing AppFog, since I am really enjoying working with it. Look for those to come soon.

This entry was posted in Cloud, PaaS, PHP, Web Development and tagged , , , , , , . Bookmark the permalink.

One Response to AppFog – A Developer’s Best Friend? – Part 3

Leave a Reply

Your email address will not be published. Required fields are marked *