The Importance of Cloud Computing for PHP Developers

It's more than just another buzz word

You may (or may not) have noticed that there’s A LOT of talk about cloud computing these days. The problem with all this chatter is that it’s incredibly hard to follow. There seems to be a wealth of different definitions of just what cloud computing actually is, and not without good reason. The “cloud” is a pretty ambiguous term, and as such anything attached to it only makes the whole thing a little more ambiguous. Rather than go off on a rant about how all this confusion is leading to a lot of misconceptions about various cloud-based services, let me clarify what I’m going to talk about. This will not be a discussion of certain SaaS stuff living in the cloud (like gmail, twitter, etc.), but rather actual cloud-based computing services and why you need to be using them.

What is Cloud Computing?

So, before we get into the why, let’s go over the what a little bit more (if you’re familiar with services like EC2 or S3, feel free to skip this part). In a nutshell, cloud computing is really nothing more than virtualized private servers on steroids. Traditionally, if you wanted to host a site or app you would either get a shared hosting account somewhere, or get your own dedicated box (or many boxes). This generally works fine, but there are a lot of drawbacks to the so-called traditional way of doing things. We’ll get into this in a little bit, but for the moment we only need to know that these solutions involved actual physical servers. A dedicated server is just that, a dedicated piece of hardware for you to use… shared hosting is similar in the fact that you’re merely a tenant on a dedicated server (you could relate it to renting an apartment vs. owning a home).

Anyway, cloud computing is essentially the same as dedicated hosting, except for one very important distinction: you’re not using a physical server, your server is virtualized. That’s it, it’s really that simple! However, this simplicity has a lot of very important benefits that lead it to beat the hell out of any traditional hosting situation. It also has one very significant draw-back as well. We’ll get into these next…

Why Cloud Computing is Awesome

Before we get into any drawbacks of this “cloud” stuff, let’s go over all the great things about it.

It’s Cheap

Cloud hosting is super-cheap compared to traditional dedicated hosting. A cloud-based server doesn’t take up space in racks, doesn’t required dedicated hardware, or any of the other costly stuff that physical servers require. Instead, one uber-powerful server can host several virtual servers, thus cutting down on costs at the data center, which gets passed to us.

On top of that, a lot of cloud hosting providers only charge you for what you use. If you only need a server for a few days / weeks for testing, you only need to pay for the time it was up and running. No commitments, no monthly charges whether you use the server or not, nothing. Awesome.

It’s Reliable

Early adopters of cloud hosting will tell you horror stories about their cloud servers randomly disappearing and other fun stuff like that, but this is no longer the case with any of the providers. This simply doesn’t happen any more. That aside, the fact that your server is virtualized adds a ton of other reliability benefits. Think about it, you don’t have any physical RAM, CPU, or hard drives to fail. Even better, the aforementioned uber-servers that your cloud server lives on take redundancy to the extreme, so there’s no reasonable worry about the host machine’s hardware failing, thus causing your server to fail. To make matters better, if in the rare event that the host machine fails, guess what? Your virtual server is simply (and quickly) moved to a server that doesn’t have issues. How cool is that?

It get’s better. Unlike shared hosting (which you should never use, which is another article I suppose) where your site shares resources with all the other shared sites on the server, you get dedicated resources. Imagine you’re on a shared host and somebody else’s site gets a huge traffic spike… their site will start to consume a ton of server resources, which get robbed from your site. With cloud hosting, this doesn’t happen. You get a guaranteed share of ram, disk, and CPU… same as you would with a dedicated server.

Finally, backups of cloud servers are super-reliable and super-awesome. With dedicated hosting, you can easily set up automated back-ups on your server, but those never back everything up. You still have to write cron jobs to do database dumps as the automated backup stuff won’t ever touch an active database data file, and you still have to say what it is you want backed up outside of that. With cloud hosting, your WHOLE SERVER is backed up. Remember, it’s virtualized, so a backup is nothing more than a snapshot. Like I said, super-awesome.

It’s Fast to Set Up

SInce everything’s virtual, you can usually get a cloud server up and running in minutes. There’s no hardware to plug into a rack, no servers to purchase, none of that junk. You just (essentially) tell the hosting provider you want a server, and they create it for you. This means that you can create and destroy servers as you need them, without having to make all sorts of plans in advance or waiting around.

It’s SUPER Scalable

One of the biggest draw-backs with dedicated hosting (or shared for that matter) is that you can’t scale easily, or even at all. You get a server with a certain amount of RAM and disk space, and whatever CPU happened to be installed, and you’re stuck. If you want to add more RAM, you usually end up paying through the nose for it… same with disk space. And if you want a newer CPU, you get a new server.

Imagine your app gets a traffic spike and your machine gets overloaded. How fast can you get another server set up to accommodate the load? At best, with dedicated hosting, 24 hours, and then you’ve still got to set everything up and possibly deal with load balancers, etc. Say you go ahead and do that, and the traffic spike drops after a month. What now? You’ve got way more computing power than you need, and you probably can’t get rid of the extra server easily… so you’re stuck with it (more money, more problems).

Well, this doesn’t happen with cloud servers. If you get a traffic spike, you simply scale the server up. More often than not, you simply need more RAM to deal with high load on your server. Guess what? Since your cloud server is virtualized, more RAM is only a matter of having the hosting provider allocate it to your machine. This usually involves a few clicks in a web interface, and a few more minutes for the scaling to happen. Even better, when you no longer need the extra resources, you can just as easily scale down. No headaches, and you don’t need to spend a ton of money to do it (which also goes back to the cheapness of cloud hosting).

Even if more RAM won’t cut it (maybe you need another database server or something like that), spinning up new sites is easy. Hell, you can usually clone your current server (or one of your servers if you have several) from one of your snapshots. So, not only can you get a new server up in minutes, but it’s already got everything ready and running on it. More awesomeness.

The Drawback of Cloud Hosting

Despite all the goodness we just went over, there’s one big problem with cloud hosting / computing. You have to set everything up yourself. There’s no control panel (unless you install one), nothing. When you spin up a server, you get a root password and a clean OS install. If you don’t know what you’re doing, or how to set things up, you’re in for a long and arduous set up process.

But things aren’t as bad as it seems. There are a lot of really well-written tutorials out there, often written by the hosting provider, that will walk you through getting your servers set up however you need them to be. Even better, there are also some really cool services in the works that will take care of this setup for you (one of which I’m working on… stay tuned ;) ). So, this issue is rapidly becoming moot, but it’s still important to mention and acknowledge.

Why All This is Important to PHP Developers

You are probably asking yourself why this matters to you as a PHP developer… and with good reason. More often than not, the traditional ways of doing things have been more than adequate for us. Very often, the “best practice” setup for development has been to set up a local development environment with XAMPP/WAMP/MAMP, and to buy cheap shared or dedicated hosting somewhere for the actual site / app to run in production on.

I, however, think this approach sucks. As easy as stuff like XAMPP is, it’s always got shortcomings. If you want to try and use any technology that isn’t bundled with these packages, you’re pretty screwed (try and set up memcache on windows… lemme know how that goes). There are so many cool new technologies out there that I see many developers ignoring simply because there’s no easy way to work with them from a development perspective. Honestly, are you going to waste a ton of time trying to recompile PHP to include the bundled GD libraries, or some other thing, or installing software like Image Magick, Sphinx, Memcache, APC, whatever? It’s not always easy, so it’s rarely tackled. Perhaps you want to play around with PHP 5.3 or MySQL 6, or Postgres, MySQL replication or something else because you’re curious… how do you do this locally?

If you’re savvy, your answer to me would probably be to set up a local VM with VMware or VirtualBox. Not a bad answer, but those are a pain sometimes too. Local VMs can take valuable resources from your machine, and if you’re using an IDE, you’re probably already short on RAM (especially those of you using eclipse or eclipse-based IDEs). So you’ll turn these VMs on or off when you need them, but that’s also a pain.

Let’s take it one step further… You probably work on lots of different projects. If you’re like me, you run these all against some local Apache installation in subfolders while you’re developing (i.e. localhost/projecta and localhost/projectb). Well, that’s not a real representation of how things are going to run in production, which is never a good thing. You probably also use SVN or Git (if you don’t use SCM for development, start. Trust me, do it), and you probably just host that stuff locally. This is also less than ideal.

I’m sure you see where I’m going with all this. All these problems can be solved with cloud hosting. I don’t feel like I need to go into great detail here, as these solutions should be pretty self-evident. Think about it… if you want to play around with PHP 5.3 or some other new technology, you need only spin up a cloud server for a few days / weeks and do so. It’s cheap, easy, and you won’t run the risk of borking whatever local dev environment you’ve got set up.

But there’s a bit more to it than that. Say you want to test a migration from one version of something to another, or an upgrade process for an app you’ve written. If you’ve got an environment set up in a cloud, you need only take a snapshot of your server’s current state and then attempt the migration / upgrade / whatever. If something gets screwed up, revert to the snapshot and try again… that easy. You can’t argue that this isn’t a much better alternative to trying to do this with a dedicated server or local dev environment.

Finally, it’s simply a better way to develop. I’ve got a local XAMPP install that I use, admittedly, but I’ve also got several servers in the cloud. All my wiki, source control, and other important dev-related stuff lives on a dev server I’ve got set up in the cloud. It’s backed up, it works, and I’ve got total control over how it’s set up. I’ve also got a few other dev / production servers set up (this site is running on one) for my various rails / php projects that I work on. I can easily play around with new stuff without worrying about screwing anything up, I can keep all my development and testing properly isolated (I know people who run their dev and production environments on the same dedicated server… that’s playing with fire my friends), and everything just works.

Getting Started

So, how do you get started with the cloud. Well, that all depends on you… if you’re comfortable with the command line and general setup / config / admin of *nix servers, you should just dive into it. If you’re not (and there’s nothing wrong with that), you can either decide to learn, or sit tight for a bit. Like I said, there are people (including myself) that are working on taking the configuration and setup management of cloud servers and making it nothing more than a few clicks on a control panel.

Either way, you really do need to get into the cloud as soon as you can. Everything’s going to be moving in this direction (and already is in a lot of cases), and it’s also simply a better way to do things all around. I haven’t even touched on the beauty of cloud hosting for production environments, which is another discussion altogether.

Anyway, I leave you with a few links to the most popular cloud hosting providers. Feel free to shoot any questions / comments you may have my way in the comments!

  • Amazon EC2 – EC2 was the first major cloud computing offering, and it’s the most robust as far as service options (stuff like virtual load balancers, etc.). They’re also a bit pricier than other providers, but they’re damn good
  • Slicehost – Slicehost is just awesome… and cheap. A server will cost you around $20 / month. They’ve also got amazing articles to help you get pretty much anything you’d like set up on your server. Highly recommend them
  • Rackspace Cloud – Also an awesome service. They are a bit cheaper than slicehost (around $12 / month to start), but are priced a bit more variably (slicehost is more of a set fee)… you pay per hour for the server plus bandwidth. Rackspace owns the rackspace cloud (obviously) and Slicehost, so it’s really a matter of preference here. I actually like the Rackspace Cloud a bit more merely for the pricing scheme since I spin servers up and down more frequently to play around with stuff

Other's Thoughts   (11 so far...)


  • Jestep
    Aug 13 '09 at 4:08 pm

    Great article. I think that most developers won’t run into many situation where a cloud could really help them. But when you get into enterprise level hosting, major reporting, or data manipulation, and you run into true hardware bottlenecks, a solid cloud could really help out. When you’re 64Gb RAM, 64bit server is capped out, you’ll wish you had a cloud to float on.

    What I think is one of the best benefits along these lines, is scaling on demand. It’s one thing to setup a $20,000 server, but if a $500 server would be just fine, less 1% of the time, when you need to create some massive report, a cloud is probably the perfect answer.


  • Ian
    Aug 13 '09 at 8:36 pm

    @Jestep, I agree with what you say to a point, but a lot of what I was trying to say was that there’s space for cloud in a developer’s every day routine… there’s so many benefits of working with cloud servers for development beyond those of production environments (which you enumerated quite well, btw).

    I think a lot of PHP developers miss out on these benefits (trying new technologies, kick-ass dev environments, etc.) simply because there’s not enough talk about it in the community… I’m happy you took the time to comment, I’m really interested in starting a general dialogue about this stuff with everyone!


  • Nathan Youngman
    Aug 14 '09 at 9:58 am

    Hey Ian. Cloud is definitely an ambiguous term. It seems what you’re talking about is the modern VPS, to which you could add Linode. Definitely handy to spin up staging environments, and having a development stack that is an exact replica of production certainly sounds beneficial.

    I think I’ll stick to localhost for now though, I switched to Mac 7 years ago for the FreeBSD underpinnings. So I can use site.dev style domains with Apache while still running Photoshop.

    Personally I’m more interested in the other kind of Cloud, modern shared hosting on a giant cluster. Google App Engine (Python), Heroku (Ruby/Rails) and Rackspace Cloud Sites (PHP). I’m thinking of going the Rackspace route this weekend.


  • CL
    Oct 5 '09 at 10:38 am

    Hey Ian. Cloud is definitely an ambiguous term. It seems what you’re talking about is the modern VPS, to which you could add Linode. Definitely handy to spin up staging environments, and having a development stack that is an exact replica of production certainly sounds beneficial.

    I think I’ll stick to localhost for now though, I switched to Mac 7 years ago for the FreeBSD underpinnings. So I can use site.dev style domains with Apache while still running Photoshop.

    Personally I’m more interested in the other kind of Cloud, modern shared hosting on a giant cluster. Google App Engine (Python), Heroku (Ruby/Rails) and Rackspace Cloud Sites (PHP). I’m thinking of going the Rackspace route this weekend.


  • seema
    Mar 26 '10 at 1:54 am

    Advantages of cloud computing:
    Cloud Computing refers to a computing system in which tasks are assigned through a combination of connections, service and software over a network. This collective of connections is known as the “CLOUD”. Computing at this level allows users to sort through a vast amount of data. For example “Google” is currently the forerunner of cloud computing due to its need to produce accurate and instant results for the million of search queries it receives every day. Cloud computing is like conception of purchasing a land, building infrastructure and then leasing the flats. While the investor bags in big profits, customer accesses the benefits in small expenditure. In cloud computing, provider hosts the software on the internet which is then accessed by customers who use resources as a service, paying only for what they make use of. Google and Yahoo are the examples of the cloud computing service providers.

    1. Both small and medium sized businesses can instantly obtain the benefits of the enormous infrastructure without having to implement and administer/run it directly. This also permits accessibility to multiple data centers anywhere on the globe means that as the need for resources increases, companies can add additional service as and when needed from the cloud computing vendor without having to pay for additional hardware.
    2. Cloud computing is more environmentally friendly. Reducing the number of hardware components and replacing them with cloud computing systems reduces energy costs for running hardware and cooling as well as reducing Carbon Dioxide Emissions and conserving energy. Moving applications to the cloud can potentially reduce energy costs for running and cooling hardware.
    3. Cloud computing could allow you have only a small and inexpensive computer, processor and monitor in front of you. You would have no need for hard drive or a CD/DVD drive. Instead you would need only an Internet connection, which would hook you up to a central supercomputer that would host all your programs and files. This presents and advantage to both storage and security issue.
    4. A Low Cost alternative to access Technology: It more like how you utilize traditional utilities like electricity, pay for what you use and pay till you use it. This in order to enable companies to save their money on important business activities. Moreover it gives small and medium businesses an opportunity to access technology as a resource.
    5. In cloud computing, the infrastructure is maintained by a provider and the services are accessed by customers by way of internet using web browser. The user need not be worried about back end engineering and parameters. Besides this the user does not need to install the application on his system, saving him from the trouble of software maintenance, ongoing operation and support.
    6. Six benefits:
    a. Reduced cost: cloud technology is paid incrementally, saving organizations money.
    b. Increased storage: Organizations can store more data than on private computers system.
    c. Highly Automated: No longer do IT personnel need to worry about keeping software up to date.
    d. Flexibility: Offers much more flexibility than past computing methods.
    e. More Mobility: Employees can access information wherever they are, rather than having to remain at their desks.
    f. Allow IT to shift focus: No longer to worry about constant server updates and other computing issues, Govt. organizations will be free to concentrate on innovations.
    7. Instead of installing a suite of software for each computer, you’d only have to load one application. That application would allow workers to log into a web-based service which hosts all the programs the user would need for his or her job. Remote machines owned by another company would run everything from E-mail to word processing to complex data analysis programs. Due to this there is significant workload shift. Local computers no longer have to do all the heavy lifting when it comes to running applications. The network of computers that make up the cloud handles them instead. Hardware and software demands on the user’s side decreases. The only thing the user’s computer needs to be able to run is the cloud computing systems Interface Software, which can be as simple as a Web Browser, and the clouds network takes care of the rest. If you have an e-mail account with web based e-mail services like Yahoo or Gmail, here instead of running an e-mail program on your computer, you log in to a web e-mail account remotely. The software and storage for your account doesn’t exist on your computer- it’s on the service’s computer cloud.
    8. It is efficient to make use of cloud computing service to provide backup and recovery. Investing in a ton of duplicate infrastructure makes no sense. The service provider can provision full features for a range of applications, with everything from e-mail to project management to typical office applications like word processors, spreadsheets etc. accessible to the user. That’s the essence of SaaS. Using these applications simply requires accessing a website, creating an account and getting to work. All information is stored in the cloud not on the machine in front of you and is secure protected and is accessible to you no matter where you are and even which device you are using. You are likely to pay a monthly service. Organizations no longer have to acquire additional hardware or hire additional staff to support their business requirements.


  • Sai
    May 5 '10 at 2:36 am

    so how does it work?. Do I get SSH or ftp or is it like I get completely a dedicated server for such a cheap cost, how do I look this from my existing usage of the website


  • Sam
    May 5 '10 at 2:39 am

    I’m a bit confused about this cloud computing stuff,. It sounds to me like a cloud host would be a powerful server build hosting a ton of virtual servers, which honestly sounds just like shared hosting. It also sounds very slow. can you clarify on the base of how this all works?


  • Alain
    Jun 3 '10 at 2:39 pm

    Kind of under the radar but led the way for providing cloud platform support for Rails, Java and PHP. You may want to check Morphlabs, Ian.

    Best.
    Alain

  • [...] gen-x-design.com/archives/the-importance-of-cloud-computing-for-php-developers/ [...]


  • chris
    Jan 2 '11 at 4:46 pm

    I’m interested in moving a number of my sites into the cloud (rather than the current shared environment), but there are accompanying email accounts with many of these sites. How might I handle that? Will I be able to easily host email accounts with EC2?


  • Ian
    Jan 3 '11 at 8:00 am

    @chris,

    You can host your email accounts on EC2, but I’d honestly recommend setting up google apps for domains which is free and gives you gmail for your own domain: http://www.google.com/apps/intl/en/group/index.html

    If you are interested in hosting your own email on the servers (again, not the best way to go anymore), then check out the articles on slicehost (http://articles.slicehost.com/)... they’ve got all sorts of really good stuff on there that walks you through setting various services up for many popular distros of linux.

    Finally, I’d recommend slicehost or the rackspace cloud over EC2 for no other reason than cost… EC2 is awesome, but it’s a bit more expensive than those two guys. Any of the three will work great, however.

  • Share Your Thoughts...

    Some HTML is ok. If this is your first comment on my site, it will be reviewed before being posted publicly. Your comment may be edited or marked as spam if it appears intended for SEO purposes.