How to get the most with Windows and Windows Azure


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

How to get the most with Windows and Windows Azure

  1. 1. How to get the most with Windows and Windows Azure<br />Kanwaljeet Singla & Sumit Chawla<br />Microsoft Corporation<br />
  2. 2. Agenda<br />PHP on Windows<br />How to make PHP fly on IIS<br />SQL Server Driver for PHP<br />Web Platform Installer<br />Community<br />PHP on Windows Azure<br />What is the Microsoft Cloud?<br />Deploying a PHP application to the cloud<br />Windows Azure SDKs and Tools for PHP<br />Questions / Open Discussion<br />
  3. 3. FastCGI<br />Fast and Reliable.<br />v1.0 released in Oct 2007<br />v1.5 released in Nov 2009<br />Consistent set of features across all IIS versions:<br />FastCGI in IIS 7.5 – new features included in OS<br />FastCGI in IIS 7.0 – install the FastCGI update (<br />FastCGI in IIS 5.1/IIS 6.0 – install FastCGI 1.5 extension<br />Recommended way of running PHP on Windows<br />
  4. 4. FastCGI (cont.)<br />New features:<br />Auto-tuning of maxInstances<br />Automatic recycling of PHP processes when php.ini changes<br />Useful tips<br />Use latest version of FastCGI and turn on dynamic maxInstances and monitorChangesTo features<br />Increase InstanceMaxRequests value and match the value to PHP_FCGI_MAX_REQUESTS environment variable<br />
  5. 5. PHP 5.3<br />PHP 5.3 improvements:<br />Using VC9 compiler (PHP 5.2 used VC6)<br />Optimized API calls (using Win32 instead of POSIX)<br />All PHP libraries built from the source code<br />Compatibility fixes<br />Windows builds are available at:<br /><br />From: <br />“Substantial performance improvements on Windows (40% +)” <br />
  6. 6. WinCache 1.0 <br />PHP Accelerator optimized for Windows<br />Opcode cache<br />File cache<br />Resolve path cache<br />Download from:<br /><br />Contributed by MS to PECL:<br />Source code on<br />Documentation on<br />BSD license<br />Contributions are welcome!<br />
  7. 7. Why use opcode cache?<br />To serve index.php in WordPress, PHP has to read, parse, compileand execute more than 100 php files!<br />
  8. 8. WinCache 1.0<br />Useful Tips:<br />Increase maxInstances or use dynamic maxInstances<br />Adjust file cache and opcode cache sizes. Use wincache.php to study cache usage<br />Keep wincache.chkinterval value high on production servers and low on development machines<br />Restrict access to wincache.php by using built-inauthentication or web server authentication<br />
  9. 9. WinCache 1.1<br />Beta2 released in April 2010<br />Object cache – Compatible with APC APIs<br />WinCache session handler<br />File change notification support<br />Function hooks<br />Useful Tips:<br />Turn on user cache if application supports it<br />Port from existing code which uses APC’s object cache<br />Keep file change notification turned on<br />Turn on session handler if not running a web farm<br />
  10. 10. SQL Server Driver for PHP<br />Thin layer over SNAC (ODBC)<br />Single functional layer with thin API layer on top<br />SQL Server Driver for PHP 1.1<br />SQL Server Driver for PHP 2.0<br />php_sqlsrv.dll<br />php_pdo_sqlsrv.dll<br />php_sqlsrv.dll<br />PDO API<br />SQLSRV Native API<br />SQLSRV Native API<br />Core Functional Layer<br />SQL Server Native Client (ODBC)<br />
  11. 11. SQL Server Driver for PHP Tips<br />Scrollable Cursor: scrollable but slower<br />Use sqlsrv_has_rows() w/ CURSOR_FORWARD if you only need to check if there’s data in the resultset, it’s faster and doesn’t move the cursor<br />If scrollable required, consider CURSOR_STATIC first<br />WarningsReturnAsErrors: ON by default<br />Remember to turn it OFF in deployment<br />Should we change default to OFF?<br />UTF-8 encoding<br />The default for PDO, available per col/param<br />Should we make this the default for sqlsrv_xxx?<br />Use transactions for DDL to improve performance<br />
  12. 12. SQL Server Query Tips<br />Range query:<br />SELECT * FROM table ORDER BY date LIMIT 20,10<br />Use TOP & ROW_NUMBER<br />SELECT sub2.*,ROW_NUMBER() OVER(ORDER BY sub2._l2) AS _lFROM ( SELECT 1 AS _l2, sub1.* FROM ( SELECT TOP(30) * FROM table ORDER BY date ) AS sub1) as sub2WHERE _l BETWEEN 20 AND 30;<br />SELECT * FROM (<br /> SELECT *, ROW_NUMBER() OVER(ORDER BY date)<br />AS _l FROM table<br />) AS t<br />WHERE _l BETWEEN 20 AND 30<br />ORDER BY _l;<br />
  13. 13. Web Platform Installer<br />Easy way to install IIS components, PHP 5.2, PHP and Asp.Net web applications etc.<br />Demo<br />PHP 5.3 will be offered through WebPI soon<br />
  14. 14. Community participation<br />WinCache is on PECL and SQL driver for PHP is on codeplex<br />IIS and WinCache documentation on<br />Participating on PHP newsgroups<br />Working with PHP developers to improve PHP and PHP installer<br />Working with PHP application developers to integrate URLRewrite, WinCache<br />
  15. 15. Miscellaneous tips<br />Set IP address of MySql machine in hosts file<br />Build PHP yourself and statically link WinCache<br />Compile and optimize using PGO for maximum performance<br />URLRewrite<br />Includes htaccess importer<br />Use IIS warm-up module to fill opcode cache before first request arrives<br />
  16. 16. What is Windows Azure?<br />It’s an Operating System<br /> In the Cloud.<br />Simple Answer?<br />Windows Azure: operating system as an online serviceMicrosoft SQL Azure: fully relational cloud database solutionWindows Azure platform AppFabric: connects cloud services and on-premises applicationsMicrosoft Codename “Dallas”: information marketplace for data and web services <br />
  17. 17. Microsoft Data Centers<br />Vision<br />Go Inside<br />Energy Efficient<br />Containers<br />North American Data Centers<br />European Data Centers<br />Asian Data Centers<br />Dublin<br />Chicago<br />Washington<br />Amsterdam<br />San Antonio<br />Hong Kong<br />Singapore<br />
  18. 18. The Windows Azure Model<br /><br />
  19. 19. Windows Azure RolesThis is how your code runs in the cloud<br />Worker Role<br />Web Role<br />Public Internet<br />Public Internet<br />[1..n]<br />Web Role<br />Worker Role<br />[1..m]<br />Load<br /> Balancer<br />Load balanced Web Farm<br />IIS7 web server<br />Serves HTTP/HTTPS requests<br />No inbound connections by default<br />Typically used to process background tasks by reading requests from storage queue<br />Storage Services<br />Storage Service<br />
  20. 20. SQL AzureRelational Database in the cloud<br />Based on SQL Server technologies<br />Scale databases up or down based on business needs <br />No need to install or patch software or other physical administration <br />Automatic high availability and fault tolerance <br />Simple provisioning and deployment of multiple databases <br /><br />
  21. 21. What about hosting my PHP + MySQL on Windows Azure?<br /><ul><li>Yes, you can do it
  22. 22. If you do, you are using Windows Azure only as an infrastructure service
  23. 23. This means you are responsible for managing the infrastructure</li></ul>Solutions<br />MySQL<br />PHP Web App<br />Hosted Web Core Worker Role [1 VM Instance]<br /><br />MySQL Solution Accelerator [>=2 VM Instances]<br /><br /><br /><br />
  24. 24. Deploying PHP Apps to Windows Azure<br />PHP Application<br />PHP Core<br />Windows Azure Deployment Package<br />(cspkg + configuration)<br />PHP Extensions<br />Windows Azure Command-line Tool for PHP<br /><br />Download at<br />
  25. 25. Windows Azure Command-line Tool for PHP<br />Create new applications or convert existing PHP applications to Windows Azure applications<br />Deploy to Local Development Fabric or the Windows Azure Cloud<br />No IDE required<br /><br />Download at<br />
  26. 26. Demo<br />Deploy WordPress to Windows Azure<br /><br />
  27. 27. Windows Azure Command-line Tool for PHP<br />What’s new<br />Worker Role Support<br />Ability to attach an external drive to your Windows Azure Instance [aka X-Drive]<br /><br />Download at<br />
  28. 28. Browser<br />Web Role<br />1<br />2<br />3<br />LB<br />Queue<br />7<br />4<br />6<br />5<br />Worker Role<br />Blob Store<br />Running background tasks with PHP on Windows Azure<br />
  29. 29. Other Windows Azure SDKs and ToolsWindows Azure SDK for PHP<br />Overview<br />Enables PHP developers to take advantage of the Microsoft Cloud Services Platform  – Windows Azure.  <br />Features<br />PHP classes for Windows Azure Blobs, Tables & Queues (for CRUD operations)<br />Helper Classes for HTTP transport, AuhN/AuthZ, REST & Error Management<br />Manageability, Instrumentation & Logging support<br />Also Distributed via Zend Framework <br />Project Site<br /><br />Logical architecture <br />Your PHP application<br />XML<br />REST<br />Compute<br />Storage<br />Manage<br />Deployment scenarios<br />PHP Runtime<br />Any internet connected Server<br />PHP Runtime<br />REST<br />REST<br />
  30. 30. Other Windows Azure SDKS and Tools<br />Windows Azure Eclipse Tools<br />+ Fast CGI + Eclipse IDE + PHP SDK for Windows Azure <br />1<br />2<br />4<br />3<br />
  31. 31. Summary<br />Recap<br />PHP on Windows has come a long way in the last few years<br />We are committed to improving the PHP experience on Windows<br />Windows Azure Platform offers scalable operating system as service and relational database services in the cloud<br />Windows Azure is more than a hosting infrastructure<br />There are several SDKs and Tools available for developing and deploying PHP Apps to the Microsoft Cloud<br />Call to Action<br />What scenarios are important to you?<br />What would make Windows Azure more interesting for you?<br />
  32. 32. Additional Resources<br />PHP on Windows<br /><br /><br /><br /><br /><br /> mailing list<br />PHP Interoperability<br /><br /><br /><br />
  33. 33. Contact Information<br /> PHP on Windows<br /> PHP Interoperability<br />Kanwaljeet Singla (IIS and WinCache Developer)<br /><br /><br /><br />Ruslan Yakushev (IIS Program Manager)<br /><br /><br /><br />Venkat Raman Don (IIS and WinCache Tester)<br /><br /><br />Pierre Joye (PHP Core Developer)<br /><br /><br />Mark Brown (IIS Product Manager)<br /><br /><br />Sumit Chawla<br /><br />Jean-Christophe<br /><br />Vijay Rajagopalan<br /><br />Karri Dunn<br /><br />Jas Sandhu<br /><br />Interoperability Team Blog<br /><br />
  34. 34. Questions<br />