A Chat About Cloud Computing & PHP Development In The Cloud

A Small Intro..

Cloud Computing & PHP Development

Whenever we talk about web development nowadays, there has to be an awareness or at least an interest towards cloud computing. We, as PHP Developers, should be aware of what development in the cloud has to offer and how we can leverage it to stay in the game. To this end, I bring forward a small interview with the Pro Cloud Computing guy, I named Vito Chin! Let’s hear and learn from his pro experience and advice..

PHP Development & Cloud Computing – Let’s hear about it!

PHP Development in the Cloud was published in 2011. To dramatise a little bit, I will like to think of the period as a time where a lot of individuals and organisations were in the middle of the exodus away from physical boxes and mainframes to the cloud. Nowadays, the “cloud” seem to be more of a norm than the exception, especially in start-ups. Many large organisations I know of are also looking at utilising the cloud to tackle some of the (mostly scale and performance related) challenges they face.

In the bigger scheme of things though, there are still a lot of things that needs to be iron out on the technical, user engagement and business level. Take for example the case of Tienlon Ho with Google. This highlights one of the less considered areas of SaaS: ownership, continuity and responsibility. On the technical front, there are quirky issues such as IP legacies (inheriting the reputation and legacy GET requests from rouge IP users). I am not saying there isn’t a resolution for these matters currently but that there is more room for the evolution of these matters towards a consensus that makes for a better ecosystem for everyone.

In the meantime, when you’re on the cloud, (i.e. as a SaaS user or hosting your software on a PaaS or have a virtual server on IaaS), a good background on the cloud will help. The book will be useful as it goes through some of the limitation of cloud-based solutions as it is currently. It also takes you through a plethora of stuff you can do on the cloud, from IaaS, to PaaS to SaaS. It will be suitable for anyone that is interested in using, developing or hosting software on the cloud.

>> Could you share your experience with PHP in The Cloud?

The one word I will use to describe PHP in the cloud if you’re deploying to an IaaS environment is: scalability. When I first started coding commercially, scaling means either going through the online server catalogue to acquire a new blade server, load balancer, etc or for projects with hosting companies, it means there will be some calls made and probably some documents to sign, etc. Additional computing resources takes anything from an hour to a week or more to acquire. Some of you may have the luxury of these being taken care of by dedicated administrators, but even this takes some time.

With IaaS such as Linode or AWS, it takes a few minutes. PaaS will even scale automatically if your software’s requirement is sufficiently run-of-the-mill to run on a PaaS. I might sound like an old man to younger readers here but I still find this transformation of computing resource from hardware to software very liberating.

>> Is there a different mindset/approach to be adopted when developing in the cloud?

Yes. Always bear in mind you have a lot more computing resources in your hand, which gives you more options with the architecture of your software. For example, lets say I am given a hard requirement that 500000 objects are to be analysed within 1 minute. Before the cloud, things does seem more daunting and cumbersome. There are more things to think about, i.e. does it make economic sense to get 3 blade servers and a dedicated message queue server to spread the work? Maybe I should write this in C so that the processing is more efficient so I can save on the number of servers, etc. A lot of these details are quite a put-off especially at times where quick delivery and idea proofing is the main focus.

Taking the availability of an elastic cloud into perspective, things become much simpler and I am able to jump closer to the task at hand. Servers to boost computing resources? We can trigger instantiation on the fly. Running out of database connections? The DB server can be easily updated. The point is, the cloud makes it so cheap and convenient for me to obtain these resources. This alters my attitude and ultimately my approach towards the architecture of software I design.

>> Pitfalls?

Sessions. This applies to non-cloud environment as well, but cloud instances made a load-balanced setup so prevalent and much closer to the software engineer that it is worth mentioning. When using sessions where requests are directed to different elastically instantiated web servers, you’ll need to ensure that the sessions are stored within a storage that is common to all web servers.

Configuration. Use a tool like Puppet on your servers, otherwise the management of configuration on your many server instances will quickly get out of hand.

Evaluate a PaaS offering carefully before adopting it as your deployment environment. Check that the versions of PHP, extensions and all other dependencies are compatible with your application’s requirement. Also, find out how frequently they update their packages and analyse how your application will be affected by these updates.

>> Best cloud platform you recommend using?

I keep finding myself using IaaS such as AWS and Linode, which are great and very practical for small and large projects alike. When a project is small and in development, I like to dabble around the environment a lot so having infrastructure level control is essential. On larger projects, we’ll usually spin off different instances for integration, testing, staging and production. IaaS is great for these things.

If I were to use a PaaS for some reason, I think I’ll go for Orchestra.

>> PHP Libraries/framework that you recommend using for PHP in the cloud?

Gearman is a useful framework for applications that needs to distribute work around. There are different reasons to do this. For example, you may want to allow the user to trigger some big-data analysis via a non-blocking GET request. Or you may want to farm out a piece of work that is best done within a C setting via your PHP front-end. Applications that will require Gearman are usually the kind of applications that you will run to run on a cloud. A PECL extension for Gearman is available.