Cloud Zone is brought to you in partnership with:

After teaching math (and a little computer science) for 14 years, Brian changed careers in 2006 with the idea that getting out of his comfort zone would be good. So now he works as a writer and programmer at Microsoft who specializes in PHP and Windows Azure. Brian is a DZone MVB and is not an employee of DZone and has posted 82 posts at DZone. You can read more from them at their website. View Full User Profile

Interview: Maarten Balliauw, Main Contributor to the Windows Azure SDK for PHP

12.14.2011
| 3064 views |
  • submit to reddit

In recent months, I’ve been diving deeply into the how’s and why’s of running PHP applications on the Windows Azure Platform. That has meant becoming intimately familiar with the Windows Azure SDK for PHP, the centerpiece for PHP on Azure. In the spirit of becoming even more familiar with the SDK, I caught up with its main contributor, Maarten Balliauw. Catching up with him was no easy task…Maarten is one busy guy! By following our conversation (below), you will see why.

Brian: For folks who don’t know you, tell us about yourself.

Maarten: I work as a Technical Consultant for RealDolmen, one of the large IT integrators in Belgium. My day to day job consists of coaching people and getting projects rolling from the technical side: setting up ASP.NET MVC architectures, Windows Azure, … As long as it relates to web and is in the .NET space. Windows Azure is one of my favourites for the last three years and I’ve really enjoyed working with the platform so far.

Brian: Interesting. So your focus is largely on Microsoft technologies, yet you’ve written a PHP SDK. You seem to bridge the historically separate worlds of OSS and Microsoft. Would you agree? Do you find that an interesting/difficult/fun/exciting place to be? What have you seen change in recent years? What would you like to see change in the future? (Sorry, that’s lots of questions.)

Maarten: All interesting questions. Like I said earlier, my day-to-day job has been in the .NET space for some 7 years now. Before that, during my studies, I had a side project which was developing PHP websites and web applications for smaller customers. Having PHP around at that time was great: it’s cheap to get started and the language itself is so versatile and rich you can basically do anything with it. Having enjoyed the language so much at that time made me feel I should keep track of what happens in that world to improve my work in the .NET world. And borrowing concepts on that end made me realize a lot of concepts could be borrowed from .NET and brought to the PHP side as well. Those are the after-work projects I’ve been working on: PHPExcel, PHPPowerPoint, PHPLinq, PHPMEF and lately the Windows Azure SDK for PHP, one that grew out of a simple blog post where I showed how you could access Windows Azure storage from PHP.

OSS and PHP is an interesting, fun and exciting space. I wouldn’t even call OSS a space as for any language out there, the OSS space looks different. An interesting observation comes out of a question someone inside Microsoft asked me once: “Can you describe the PHP community?” My answer to that was there is no PHP community. There are thousands. Some focus on the PHP core, some on unit testing, others on the various frameworks and CMS-es, etc. The PHP world is a very scattered place, which makes it even more interesting as inside that community a lot of smart people do their thing and have their opinions that may influence the other communities and eventually even other technologies. The person who asked me this question now knows and fully respects this observation, I’d like to see more of Microsoft grasp this and know they can not get away with targeting “the one PHP developer”. I see it’s getting better, but there’s still work to do there.

Going further on that difference: if you look at the .NET space, there’s probably just two groups: the ones using Microsoft, and the ALT.NET community that also uses Microsoft tools and products but also creates and uses wonderful open-source projects. Microsoft can easily target these two groups.

Brian: Good point about the many PHP communities – definitely important to understand.

I’m curious about what concepts you have “borrowed” from .NET in PHP and vice versa. Can you elaborate?

Maarten: Concepts borrowed from .NET in PHP are the release of PHPLinq and PHPMEF. Both frameworks simulate a language feature in .NET. For example, PHPLinq makes it easy to query *any* datasource using the same syntax, whether objects, arrays, a database or an XML file. This is more than just looping over arrays: if your query, for example, a database, you can use PHP syntax. PHPLinq will translate these queries to SQL statements, even specific for the platform you target. There are examples on my blog.

PHPMEF is a dependency injection container, based on the managed extensibility framework. At the time I wrote it, no alternative that auto-discovers dependencies was available for PHP, although Fabien Potencier of the Symfony framework has now released a similar library. Very happy to see that!

What I borrow from PHP in .NET is a bit less. PHP is such a dynamic language while .NET offers less possibilities of doing things like dynamic invocations, using (or abusing) the magic methods that exists in PHP. I was really happy when .NET 4 introduced the dynamic keyword, which enables you to simulate parts that are equal to PHP’s magic __GET and __SET methods. Really speeds up development!

Brian: Let me switch topics a bit and ask a couple of high-level questions about cloud development.  I know you've written a lot about the benefits of the Azure platform. Are there benefits that are specific to running PHP applications on the Azure platform?

Maarten: Absolutely. Windows Azure is not just VM’s hosted somewhere or an easy way to deploy your application. It’s a well-thought out and well-designed cloud system where any application will definitely live more reliably than in other places. The fact that things like load balancing come for free, the fact there’s a lot of other platform components like the CDN that you may (or may not) use will makes it a one-stop shop for small to very large applications that you want to give a reliable home.

Brian: What about “designing for the cloud”? Should PHP developers think differently about applications that plan to leverage, for example, elastic scalability in Azure?

Maarten: Yes and no. I think every PHP developer should be aware apps can run on multiple servers anyway: take care of possible session sharing, take care of a distributed file system, … If you take those things into account, any cloud journey will end in success. Things get different when designing large-scale applications: you’ll have to design for failure (nodes can go down), reduce communication overhead between machines, partition or shard data, … All these concepts should also be applied when building very large applications on your own datacenter. I don’t think the difference between regular datacenters and a cloud are big, application wise.

What will always be different is the way you deploy your application and the way you use the platform. Yes, you can distribute storage yourself but why not use the storage service offered by Amazon or Windows Azure? Existing concepts are often offered in a different fashion on cloud platforms and you’ll have to learn that platform. But again, the same is true for any other stack. If you are asked to deploy on an IBM iSeries, you’ll be able to reuse your PHP skills but you’ll have to get familiar with the platform in order to make maximal use of it.

Brian: What got you interested in PHP on Azure? How long have you been working on the Windows Azure SDK for PHP?

Maarten: Pure curiosity. I have been looking at Windows Azure from the first CTP release at  PDC in 2008. A few months later, I had the fun idea to see if I could access storage from PHP. It was just REST, so should be easy, right? It led me through a set of new concepts at that time, a specific security algorithm hidden in the HTTP headers for every request that took a while to puzzle out as there was not much documentation around at that time. Great fun, which resulted in this blog post: http://blog.maartenballiauw.be/post/2009/03/14/Accessing-Windows-Azure-Blob-Storage-from-PHP.aspx

I already had contacts within Microsoft from working on PHPExcel, and I sent them a link to this post. One month after I was working on the Windows Azure SDK for PHP. The SDK has been around for almost two years now. Focusing mainly on storage first, afterwards on management tooling and now on making PHP deployments on Windows Azure easier and quicker. Suggestions on that are very welcomed by the way, as it should be as frictionless as possible, which we know is not completely the case at this time.

Brian: Yes. I’ve found that the SDK nicely takes care of the packaging of an application, but time-to-deploy is a pain point, though that is not the SDK’s fault, right?

Maarten: Right. When developing an application, you don’t want to wait for 15 minutes for your Windows Azure VM to start just to see you have an error somewhere. You want immediate feedback and thus immediate deploys. However, for production, I see no problem with the fact there’s a 15 minute gap. That is after all the strong point of Windows Azure: it’s a fresh VM for every deployment. A stateless VM, reinstalled every time. A guarantee that your PHP application will always start from the same, blank environment and poses no hidden configuration settings left from a previous deployment that may now work against you.

Brian: Interesting point about production vs. development deployments. I know that the Azure team here at Microsoft is looking into ways to improve the development experience.

So that’s a challenge in using the SDK. What have been some of the biggest challenges in building the SDK? Are there parts of the SDK that you are especially proud of?

Maarten: The biggest challenge was that, at the time, the API references were not well documented. Figuring out the APIs involved a lot of HTTP sniffing and sending mails around within Microsoft to know how to, for example, form the authentication header.

One part I’m proud of is the underlying framework for creating command-line scripts. You’ve used it in a blog post of yours and concluded with the fact that it was easy to use. It’s something not even related to Windows Azure but definitely something very useful. Another one I’m becoming proud of is something I’m currently working on: having Memcached available in every PHP instance on Windows Azure.

Brian: I did find that the underlying framework for the command line scripts made it very easy to extend the tools. And, I can see on your blog that you are making steady progress on Memcached support. Why wouldn’t PHP developers use the Azure Caching Service?

Maarten: Azure Caching Service currently is not exposed as a REST service but uses a Microsoft proprietary protocol. Therefore, I think Memcached offers a good alternative which enables you to use a distributed caching layer, a much requested feature on any cloud platform. It gives you caching across all nodes, will allow for storing sessions in memory and distributed across instances, etc.

Brian: What work still needs to be done on the SDK? Is there any "low hanging fruit" that new contributors could pick?

Maarten: A lot. I would like to see support for every component in the Windows Azure platform. That means service bus, access control (a very, very interesting one by the way!), caching (as I already mentioned), and more. Also, I’ve heard a lot of people asking for easier PHP deployments and I would like to see some feedback on what that should ideally look like. I think one thing that many PHP devs will like is full support for the access control service, so if you know SAML, WS-Trust, OAuth and PHP, we’ve got work for you!  Other low hanging fruit may be smoothening some rough edges here and there: the API is mostly a 1:1 interface on the REST API which is sometimes not really naturally structured.

Brian: You sometimes post tips and tricks (or "hidden gems") on your blog. Are there any "hidden gems" (or just cool features that are not widely known) in the SDK that you haven't written about? What are they?

Maarten: Not really, I try to make them all public. However, there are some interesting ones not really in the SDK itself, but rather in the Windows Azure platform. Like I said earlier, I’m working on getting Memcached up in a reliable fashion. I’m doing that by leveraging the startup tasks, basically small “bash” (although Powershell on Windows Azure) scripts that can fire up some background processes on your PHP instances in Windows Azure. You can do anything in there, so it’s definitely worth looking at Powershell to do those things.

Brian: Can you elaborate on the Powershell support?

Maarten: For those who don’t know PowerShell: PowerShell is a command-line environment much like the DOS prompt or bash. What’s interesting is that all commands, or “cmdlets” as they are called, are in essence .NET code running. This means adding extra commands is as easy as writing some C# code. The environment itself is also much like a programming language and less like a scripting language: you can use all constructs you know and love in PowerShell. It really feels like, and in essence, is, a crossover between a scripting environment and a programming language.

Using PowerShell on Windows Azure also means you can run a variety of code on your machine whenever it boots. Starting additional services, configuring the OS, etc.

Brian: What's next for you?

Maarten: Planning the Windows Azure SDK vNext and gathering info about what people would like to see in Windows Azure from a PHP perspective. I’d love to see even more adoption as it’s a fun platform to work with once you know it.  Next to that I’ll stay very enthusiastic in PHP and .NET worlds and keep doing what I’m always doing: learning from others, coaching others and spreading enthusiasm in both worlds. There’s a lot of value in looking over the fence and I’ll keep doing that. Whoever chooses to follow me on that: it’s a long fence so plenty of room to look over it together.

Brian: Thanks, Maarten, and good luck!

You can stay up to date on Maarten’s many projects by reading his blog (http://blog.maartenballiauw.be/) or by following him on Twitter (http://twitter.com/#!/maartenballiauw).

 

Source: http://blogs.msdn.com/b/silverlining/archive/2011/10/24/interview-maarten-balliauw-main-contributor-to-the-windows-azure-sdk-for-php-and-much-more.aspx

Published at DZone with permission of Brian Swan, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)