Mike Volodarsky's blog

Formerly the core server PM for IIS 7.0 and ASP.NET, now I run LeanSentry.
UPDATES: New troubleshooting guide released! Fix IIS website hangs →

Making PHP rock on Windows/IIS

********************
UPDATE - 10/30/2006: We have just released the FastCGI Technical Preview for IIS 5.x / IIS 6 / IIS 7.  Read more on my blog post,  and go get it from iis.net.  More blog coverage also on Bill's blog.

********************
UPDATE - 12/31/2006: We have just released the FastCGI Technical Preview 2 for IIS 5.x / IIS 6 / IIS 7.  Read more at Turbo-charge your PHP applications with IIS FastCGI Technical Preview 2.

********************
UPDATE - 09/24/2007: FastCGI GoLive beta for IIS 5.x / IIS 6 is here!  Read more at Deploy your PHP applications today with the IIS 6 FastCGI Go-Live release!

********************

UPDATE - 11/12/2007: FastCGI for IIS 6.0 RTMs on Download Center! Read more at FastCGI for IIS 6.0 is released on Download Center.

********************

The latest matrix of FastCGI releases for Windows XP, Windows Server 2003, Windows Vista and Windows Server 2008 at IIS FastCGI and PHP: What you absolutely need to know to host PHP applications on IIS 6 and IIS 7.

Right as I was about to go home, one of our developers comes in to tell me some good news about our new IIS7 FastCGI module.  So, I figure I would shed some light on our recent work to improve hosting PHP (yes, you read right, PHP) applications on Windows/IIS. 

The IIS team is committed to providing production quality support for PHP applications, which is currently lacking on the Windows platform.  It turns out, while 70%+ of PHP developers develop on Windows, actually hosting PHP applications on Windows is not recommended by the PHP community for production.  Why? 

Here is the reason:

IIS is a multi-threaded web server, because multi-threading is really the only way to achieve high-concurrency high-performance server applications on Windows (processes aren’t as cheap as they are on Nix).  ASP.NET, ASP, and other IIS application frameworks and components are all thread safe, and the IIS extensibility model is designed to allow high-performance / asynchronous processing.  PHP has not been designed with multi-threading in mind, and while today the PHP core is thread safe (http://www.php.net/), many extension libraries PHP applications use are not and therefore cannot be reliably hosted in a multi-threaded environment.  You may get lucky, but unless you are making sure the extensions you are using are thread-safe (except for extensions bundled with the PHP core distribution, I cannot find any list of known-safe extensions anywhere), you are sure to hit deadlocks and memory corruption when running PHP in multi-threaded mode with the PHP ISAPI extension for IIS.

The only supported single-request-per-process option on Windows/IIS today is to use CGI (http://www.w3.org/CGI/).  In a nutshell, CGI hosts spawn a new application process for each incoming request, send in request data via environment variables/stdin, receive the response back via stdout, and kill the process.  Result - the performance on Windows is horrendous! 

So, we set out to build a FastCGI host for PHP, which is another commonly supported mode for PHP applications that uses the next generation FastCGI protocol (http://www.fastcgi.com/devkit/doc/fcgi-spec.html), that still allows for a single request per process execution but maintains a pool of reusable processes.  This should be quite promising according to our internal test results, and I cannot wait until it’s ready for primetime. 

Bill Staples and I gave the first public preview of our work to make PHP rock solid on the Windows/IIS platform to a number of key PHP developers last week … I demoed our brand new native response caching feature in IIS7 that launched the throughput of my sample dynamic PHP app (QDIG) from 40 RPS to 1600+ RPS (it was client bound at that point, so I couldn’t even come close to maxing the server). 

Here is some early news coverage of the event: http://searchopensource.techtarget.com/columnItem/0,294698,sid39_gci1218130,00.html. 

The article quotes me as saying “nothing concrete has come out of this yet” – but something concrete is definitely coming.  For starters, our FastCGI PHP host platform that should get us most of the way there.  There are definitely other things we need to do to make the experience rock end to end, including providing support for commonly-used Apache features like mod_rewrite for url rewriting, and a number of others, but one thing is clear - PHP on IIS7 is going to kick ass!

If you have any ideas / specific suggestions for how we can make PHP run better on Windows, please don’t hesitate to comment.

Stay tuned for more updates on this effort.

The first ever blog post

I’ve wanted to start a blog for many years, and finally decided that if I don’t just do it now, I never will.  For the past 3 years, I’ve been planning to set up a server for blogging, and to show off some of the cool technology we’ve been working on over at the ASP.NET / IIS … with visions of poll-driven topics, exclusive interviews, and free MS software (well, maybe not the free software J).  But time went on, and the more ambitious I became the less likely it was that anything was to come of it.

So, I went to godaddy, got a domain name with the “Quick Blog” feature free with domain purchase, set it up in 15 minutes, and posted the first blog post … Wow, that was easy!  If this goes well, then next up will be setting up the latest IIS7 (http://www.iis.net/default.aspx?tabid=7, check it out baby!) server build at home, and dropping Community Server on it.  But for now, this will do – as long as I can ignore the advertisement at the top of the page.

Just a few words about me and this blog.  My name is Mike Volodarsky, I am a Program Manager in the Microsoft’s Internet Information Services team, out in the main campus in Redmond, WA.  I own the design and development of the IIS core server, the ASP.NET runtime, and a number of special projects that you’ll hear about on this blog.  I’ve owned pretty much all of the core runtime features of ASP.NET 2.0 before it shipped last year, and now I am primarily focused on delivering the world’s best (and Microsoft’s best no doubt) web server with IIS7 in Windows Vista / Longhorn.  In this blog, I want to share some of the technology we are working on, get out some product information to help people adopt IIS/ASP.NET, and get your feedback on the work we are doing.

If you have any questions / comments / interest about IIS, ASP.NET, web server infrastructure, security, performance, scalability, feel free to ask and I’ll blog on it.

I guess sometimes, you have to stop planning and just get going (if you want a good reminder for this for your desk at work – check out http://www.despair.com/planning.html).