Monday, February 23, 2009

Inside Zend Server: Windows


Inside Zend Server is a series of blog posts which I intend to write on Zend Server (time permitted). As I pointed out in my previous post on Zend Server there are a lot of different constituencies that Zend Server applies to. In this post I will focus on developers and system administrators who are using Windows either for developing or running PHP–based Web applications.

Running high-performance and stable PHP on Windows has always been a serious challenge. So much of a challenge that in 2004 we announced a Zend product called “Zend WinEnabler” which had the sole purpose of delivering stable PHP on Windows. As part of building that product we built a FastCGI plug-in for IIS and Apache, ported our byte-code cache to Windows, and invested considerably into delivering a good experience on Windows. The product was later on streamlined into the Zend Core and Zend Platform offering on Windows. While the stability and performance of these product lines was exponentially better than anything that had existed on Windows before there was still a considerable gap compared to other OSes.

In 2006, Microsoft and Zend announced a technical collaboration to improve the experience of PHP on Windows. As part of this collaboration some of the main accomplishments included Microsoft’s team delivering a FastCGI component for IIS, we worked on performance enhancements to PHP itself, and made additional investments in making sure PHP is a first-class citizen on Windows incl. Microsoft delivering the SQL Server for PHP extension.

Not only have we leveraged all this work in Zend Server but we have put a very big emphasis on making sure it is absolutely the best PHP production environment for Windows.

Also to be clear, the Zend Server Community Edition is not only meant to be useful to developers but also for production. For example, if you want to run a departmental Wiki in production and you don’t care about critical bug and security hot fixes, monitoring, page caching, support, etc. you are still getting production quality bits, native IIS support, a very fast byte-code cache (which we now for the first time include for free) and lots more. Bottom line, you will get performance on Windows better than anything you’ve ever run also with Zend Server Community Edition and not only with Zend Server.

Some of the main Windows-specific benefits you will experience with Zend Server:

- Native MSI installation following Microsoft best practices (constantly reviewed with the MS certification tool). In addition our MSI supports unattended installation for easy mass deployment.

- Native MSI-based hot fixes. This means unlike Zend Core which was using our homegrown update mechanism you will see applied fixes in “Add or Remove Programs” and for regular hot fixes you will be able to use the standard Windows rollback mechanism.

- Automatically enable and configure the Microsoft FastCGI extension on XP, Vista, Server 2003 and Server 2008.

- For Apache users install and enable Zend’s FastCGI extension for best performance and reliability.

- Install SQL Server for PHP extension for out-of-the-box connectivity. Also support MySQL, Oracle, DB2, SQLite and more right out of the gate without needing to download third party drivers.

- Automatically tweak Windows system settings which we found to improve performance in our performance and stress tests. For example, we found that Windows’ MaxUserPort registry entry needed increasing when we ran MySQL benchmarks under stress.

- We test a huge matrix including IIS and Apache on XP, Vista, Server 2003, Server 2008 in their various OS editions (why does MS have to have so many editions for each OS?).

In short, you will not find another solution with the performance, reliability and native integration to Windows as Zend Server. Zend Server CE and Zend Server both enjoy the same foundation which enables this first-class support and also both versions have been subject to a large amount of performance and stress testing. If you were using Zend Core in conjunction with Zend Platform on Windows you will feel approximately an additional 30% performance boost. If you were using something else then you are likely to realize significantly greater performance improvements. And that is before you tune the environment in more detail. Check out the Zend Server reference manual for more detailed performance tips both for Optimizer+ and specifically for IIS.

Side note: Two bonus tips for anyone running on Windows which aren’t directly related to Zend Server are included at the end of this post.

In any case, if you’re on Windows I have no doubt that you will be impressed by Zend Server. Guaranteed!

If you have any questions, comments or benchmarks you’d like to share please email them to me at myfirstname at


Two bonus tips regarding PHP on Windows:

- If you can avoid running your application from a UNC share and host it on your local drive you will get much better performance.

- If you’re on Server 2008 then there’s something called a UAC File Virtualization Filter Driver which we have seen to significantly slow down file system performance and hence also many PHP applications. Best to look this up and if you’re willing to experiment you can turn it off with the following command “C:\>sc config LUAFV start=disabled” (your mileage may vary and it could cause compatibility issues so make sure to read this article first). I believe an easier way to deal with this is to host your application on another partition (e.g. D:) as I believe by default this filter is not enabled for non-C: drives.