SlideShare a Scribd company logo
PHP Performance on Windows

 Mark Brown, Ruslan Yakushev
 Microsoft
A Little History

2006     • PHP on Win/IIS = Big Joke



2007     • IIS FastCGI



2008     • windows.php.net
         • PHP 5.3


2009     • PHP 5.3 Release
         • WinCache 1.0


2010     • FastCGI 1.5
         • WinCache 1.1
PHP Community and Microsoft
• “PHP on Windows” project involves:
  – PHP core developers
  – PHP installer developers
  – PHP documentation team
  – PHP community and influentials
  – PHP applications communities (WordPress,
    Joomla, Drupal, others)
  – Many others…
CGI  FASTCGI
CGI vs FastCGI
• (CGI on Windows) == SLOW !!!
  – New PHP process per request
• FastCGI == (CGI on steroids)
  – Re-use PHP processes in a process pool
  – Single-threaded execution environment
  – Use Non-Thread Safe PHP with IIS FastCGI
• PHP ISAPI?
  – Stay away!!! Use FastCGI instead
  – No ISAPI support in 5.3 anyway
CGI vs. FastCGI
CGI vs. FastCGI
CGI Processes           FastCGI processes
FastCGI 1.5
• New features:
   – Auto-tuning of maxIntances for optimal performance
   – Automatic recycling of PHP processes with config
     change MonitorChangesTo setting
   – No more restarts with changes to php.ini
• Consistent set of features across all IIS versions:
   – For IIS 7.5 in WS08 R2 – new features are included
   – For IIS 7.0 in WS08 – install the FastCGI update
     (http://www.iis.net/expand/FastCGI)
   – For IIS 5.1 & 6.0 – install FastCGI 1.5 extension
IIS FastCGI and PHP Setup - automated
• Use the easiest option - Web Platform Installer!



                                   




     Get Web Platform Installer from http://www.microsoft.com/web/php/
Add PHP installer option
IIS FastCGI & PHP Setup - manual
• Follow the instructions on php.net:
• IIS 5.1 and IIS 6.0:
   – php.net/manual/en/install.windows.iis6.php
• IIS 7 and later:
   – php.net/manual/en/install.windows.iis7.php
• PHP configuration
   – php.net/manual/en/install.windows.manual.php
PHP 5.2  PHP 5.3
PHP 5.3 improvements
• PHP 5.3 improvements:
  – Using VC9 compiler (PHP 5.2 used VC6)
  – Optimized API calls (using Win32 instead of POSIX)
  – All PHP libraries built from the source code
  – Compatibility fixes
• Windows builds are available at:
  – http://windows.php.net/

 From: http://ilia.ws/files/Confoo2010_PHP53.pdf
 “Substantial performance improvements on Windows (40% +)”
WINCACHE
WinCache 1.0
• PHP Accelerator optimized for Windows
  – Opcode cache
  – File cache
  – Resolve path cache
• Download from:
  – http://www.iis.net/expand/WinCacheForPhp
• Contributed by MS to PECL:
  – Source code on http://pecl.php.net/wincache/
  – Documentation on http://www.php.net/wincache/
  – BSD license

           Contributions are welcome!
Why use opcode cache?



To serve an index.php in WordPress, PHP has to read, parse,   compile and
                       execute more than 100 PHP files!
WinCache in action




Just add extension=php_wincache.dll in php.ini.
No app code changes necessary!
WinCache and CPU usage
• WinCache significantly
  reduces CPU load
• Use FastCGI
  maxInstances setting to
  load CPU more
• Set maxInstances to 0
  to enable auto tuning
WinCache and CPU usage




  Increased FastCGI maxInstances from 4 (default) to 10
WinCache 1.1 User Cache API:
• Stores app data in shared memory
• Function by function compatible with APC
WinCache 1.1 – Session Handler
• Stores PHP session data in shared memory
• Enabled in php.ini :
  session.save_handler = wincache
• Session storage is not persistent in beta, but
  will be in RC:
  – Use the code snapshot to try it out.
WinCache 1.1 user cache in action




 Instructions on how to configure WordPress to use WinCache user cache:
  http://ruslany.net/2010/03/make-wordpress-faster-on-iis-with-wincache-1-1/
WinCache statistics script




Always restrict access to wincache.php by using built-in
    authentication or web server authentication!
What’s next?
• Popular PHP applications to adopt WinCache:
  – Joomla 1.6
  – Drupal cacherouter module
  – Sugar CRM
• WinCache improvements:
  – File change notifications support
  – Function hooks
Summary
• In 3 years Windows/IIS has become a great option
  for hosting PHP applications
• In 2 years the PHP performance on Windows has
  improved considerably.
PHP on Windows - Contacts
• Pierre Joye
                                     • Venkat Raman Don
• (PHP Core Developer)
   – pajoye@php.net
                                     • (IIS and WinCache Tester)
                                        – donraman@microsoft.com
   – http://twitter.com/PierreJoye
                                        – http://blogs.iis.net/donraman
                                     • Mark Brown
• Kanwaljeet Singla
                                     • (Web Platform)
• (IIS and WinCache                     – twitter.com/markjbrown
  Developer)                            – blogs.msdn.com/markbrown/
   – ksingla@microsoft.com
   – http://twitter.com/kjsingla
                                     • Ruslan Yakushev
   – http://blogs.iis.net/ksingla/   • (IIS Program Manager)
                                        – ruslany@microsoft.com
                                        – http://twitter.com/ruslany
                                        – http://ruslany.net/
PHP on Windows - resources
•   http://windows.php.net/
•   http://php.iis.net/
•   php.windows mailing list
•   http://forums.iis.net/
Test setup
•   Quad core CPU + 4 GB RAM
•   Windows Server 2008 with IIS 7.0 and FastCGI
•   PHP 5.3.2
•   WinCache 1.1 beta
•   WordPress 2.9.2
•   + Load Generator and MySQL on the same box

More Related Content

PPTX
Programmation orientée objet avancée
PPTX
PHP and FastCGI Performance Optimizations
DOCX
How to configure PHP with IIS or Apache on Windows
PPTX
Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM
PPT
Wordpress On Windows
PPT
PHP on Windows - What's New
PPTX
Rev it up with php on windows
PDF
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
Programmation orientée objet avancée
PHP and FastCGI Performance Optimizations
How to configure PHP with IIS or Apache on Windows
Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM
Wordpress On Windows
PHP on Windows - What's New
Rev it up with php on windows
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5

Similar to Php Performance On Windows (20)

PPTX
PHP Enhancement with Windows Server 2008
PDF
Php apache vs iis By Hafedh Yahmadi
PPTX
Developing Php Applications Using Microsoft Software And Services
PPTX
Wordpress on Windows
PDF
Windows Loves Drupal
PPT
Running PHP on Windows Technical Overview
PPTX
PHP on Windows
PPTX
PHP on Windows
PPTX
Microsoft WebsiteSpark & Windows Platform Installer
PPTX
Windows Server and Fast CGI Technologies For PHP
PPTX
Windows Loves drupal
PPTX
Northeast PHP - High Performance PHP
PDF
PHP, Handle with care
PDF
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
PPT
Php Presentation
PPTX
Publish_PHP_Website_Windows_Server_2012.pptx
PPT
PHP on Windows 2008
PPTX
Partying with PHP on Microsoft Internet Information Services 7
PDF
PHP 5.3 + Windows
PPTX
Php On Windows
PHP Enhancement with Windows Server 2008
Php apache vs iis By Hafedh Yahmadi
Developing Php Applications Using Microsoft Software And Services
Wordpress on Windows
Windows Loves Drupal
Running PHP on Windows Technical Overview
PHP on Windows
PHP on Windows
Microsoft WebsiteSpark & Windows Platform Installer
Windows Server and Fast CGI Technologies For PHP
Windows Loves drupal
Northeast PHP - High Performance PHP
PHP, Handle with care
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
Php Presentation
Publish_PHP_Website_Windows_Server_2012.pptx
PHP on Windows 2008
Partying with PHP on Microsoft Internet Information Services 7
PHP 5.3 + Windows
Php On Windows
Ad

Recently uploaded (20)

PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
KodekX | Application Modernization Development
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
cuic standard and advanced reporting.pdf
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
Empathic Computing: Creating Shared Understanding
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
Chapter 2 Digital Image Fundamentals.pdf
KodekX | Application Modernization Development
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
cuic standard and advanced reporting.pdf
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Empathic Computing: Creating Shared Understanding
Sensors and Actuators in IoT Systems using pdf
Electronic commerce courselecture one. Pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
madgavkar20181017ppt McKinsey Presentation.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
NewMind AI Weekly Chronicles - August'25 Week I
GamePlan Trading System Review: Professional Trader's Honest Take
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
Ad

Php Performance On Windows

  • 1. PHP Performance on Windows Mark Brown, Ruslan Yakushev Microsoft
  • 2. A Little History 2006 • PHP on Win/IIS = Big Joke 2007 • IIS FastCGI 2008 • windows.php.net • PHP 5.3 2009 • PHP 5.3 Release • WinCache 1.0 2010 • FastCGI 1.5 • WinCache 1.1
  • 3. PHP Community and Microsoft • “PHP on Windows” project involves: – PHP core developers – PHP installer developers – PHP documentation team – PHP community and influentials – PHP applications communities (WordPress, Joomla, Drupal, others) – Many others…
  • 5. CGI vs FastCGI • (CGI on Windows) == SLOW !!! – New PHP process per request • FastCGI == (CGI on steroids) – Re-use PHP processes in a process pool – Single-threaded execution environment – Use Non-Thread Safe PHP with IIS FastCGI • PHP ISAPI? – Stay away!!! Use FastCGI instead – No ISAPI support in 5.3 anyway
  • 7. CGI vs. FastCGI CGI Processes FastCGI processes
  • 8. FastCGI 1.5 • New features: – Auto-tuning of maxIntances for optimal performance – Automatic recycling of PHP processes with config change MonitorChangesTo setting – No more restarts with changes to php.ini • Consistent set of features across all IIS versions: – For IIS 7.5 in WS08 R2 – new features are included – For IIS 7.0 in WS08 – install the FastCGI update (http://www.iis.net/expand/FastCGI) – For IIS 5.1 & 6.0 – install FastCGI 1.5 extension
  • 9. IIS FastCGI and PHP Setup - automated • Use the easiest option - Web Platform Installer!  Get Web Platform Installer from http://www.microsoft.com/web/php/
  • 11. IIS FastCGI & PHP Setup - manual • Follow the instructions on php.net: • IIS 5.1 and IIS 6.0: – php.net/manual/en/install.windows.iis6.php • IIS 7 and later: – php.net/manual/en/install.windows.iis7.php • PHP configuration – php.net/manual/en/install.windows.manual.php
  • 12. PHP 5.2  PHP 5.3
  • 13. PHP 5.3 improvements • PHP 5.3 improvements: – Using VC9 compiler (PHP 5.2 used VC6) – Optimized API calls (using Win32 instead of POSIX) – All PHP libraries built from the source code – Compatibility fixes • Windows builds are available at: – http://windows.php.net/ From: http://ilia.ws/files/Confoo2010_PHP53.pdf “Substantial performance improvements on Windows (40% +)”
  • 15. WinCache 1.0 • PHP Accelerator optimized for Windows – Opcode cache – File cache – Resolve path cache • Download from: – http://www.iis.net/expand/WinCacheForPhp • Contributed by MS to PECL: – Source code on http://pecl.php.net/wincache/ – Documentation on http://www.php.net/wincache/ – BSD license Contributions are welcome!
  • 16. Why use opcode cache? To serve an index.php in WordPress, PHP has to read, parse, compile and execute more than 100 PHP files!
  • 17. WinCache in action Just add extension=php_wincache.dll in php.ini. No app code changes necessary!
  • 18. WinCache and CPU usage • WinCache significantly reduces CPU load • Use FastCGI maxInstances setting to load CPU more • Set maxInstances to 0 to enable auto tuning
  • 19. WinCache and CPU usage Increased FastCGI maxInstances from 4 (default) to 10
  • 20. WinCache 1.1 User Cache API: • Stores app data in shared memory • Function by function compatible with APC
  • 21. WinCache 1.1 – Session Handler • Stores PHP session data in shared memory • Enabled in php.ini : session.save_handler = wincache • Session storage is not persistent in beta, but will be in RC: – Use the code snapshot to try it out.
  • 22. WinCache 1.1 user cache in action Instructions on how to configure WordPress to use WinCache user cache: http://ruslany.net/2010/03/make-wordpress-faster-on-iis-with-wincache-1-1/
  • 23. WinCache statistics script Always restrict access to wincache.php by using built-in authentication or web server authentication!
  • 24. What’s next? • Popular PHP applications to adopt WinCache: – Joomla 1.6 – Drupal cacherouter module – Sugar CRM • WinCache improvements: – File change notifications support – Function hooks
  • 25. Summary • In 3 years Windows/IIS has become a great option for hosting PHP applications • In 2 years the PHP performance on Windows has improved considerably.
  • 26. PHP on Windows - Contacts • Pierre Joye • Venkat Raman Don • (PHP Core Developer) – [email protected] • (IIS and WinCache Tester) – [email protected] – http://twitter.com/PierreJoye – http://blogs.iis.net/donraman • Mark Brown • Kanwaljeet Singla • (Web Platform) • (IIS and WinCache – twitter.com/markjbrown Developer) – blogs.msdn.com/markbrown/ – [email protected] – http://twitter.com/kjsingla • Ruslan Yakushev – http://blogs.iis.net/ksingla/ • (IIS Program Manager) – [email protected] – http://twitter.com/ruslany – http://ruslany.net/
  • 27. PHP on Windows - resources • http://windows.php.net/ • http://php.iis.net/ • php.windows mailing list • http://forums.iis.net/
  • 28. Test setup • Quad core CPU + 4 GB RAM • Windows Server 2008 with IIS 7.0 and FastCGI • PHP 5.3.2 • WinCache 1.1 beta • WordPress 2.9.2 • + Load Generator and MySQL on the same box