Cloud and evolutions of the Microsoft platform
Pierre Couzy - Microsoft
What’s new for Open Source, PHP
and Cloud Computing in the
Microsoft environment.
Laurent Bonnet - Microsoft
• The (relatively) new Microsoft/OSS story
• A new PHP platform on Windows
• Running PHP on Windows
• PHP apps on Windows
• Opening Windows products to PHP
• Cloud story : PHP on Windows Azure
• The Why
• The How
Agenda
• Has been around for a decade
• Actually, most PHP development is done on Windows
• And yet, the Microsoft-PHP story has been difficult for years.
Introduction
PHP on Windows :
3 goals :
I. Get Involved with Open Source communities
II. Ensure major projects run correctly on the Windows Operating Systems
III. Open our products and platform to non-Microsoft stacks
Open Source at Microsoft ?
Open Source Technology Center
OSTC : in the early days …
Founded in 2004
2 computers
One guy…
OSTC today
• Hosted in Redmond
• Staffed by OSS and Linux experts
• 300 servers of varying types
• 340+ Linux distros available for testing
• Tests interoperability of OSS and Windows
• Research of OSS technologies
Results ?
• Done in collaboration with the PHP community
• Published on CodePlex with an OSI-approved license (http://sqlsrvphp.codeplex.com/).
• Can access any Sql Server instance (Express, 2005, 2008, 2008 R2, Azure) from PHP
• Work in progress : enable Sql Server access to major PHP projects & frameworks
A SQL Server driver for PHP ?
And also
• We contributed to the linux kernel
• GPL developers do exist in Redmond
• On-going collaboration
• With the Apache Software Foundation
• With communities
• There’s still room for improvement
• A typical project is still 1 month dev, 3 months stabilization, 1 year legal…
OSTC has changed Microsoft
• The (relatively) new Microsoft/OSS story
• A new PHP platform on Windows
• Running PHP on Windows
• PHP apps on Windows
• Opening Windows products to PHP
• Cloud story : PHP on Windows Azure
• The Why
• The How
Agenda
A PHP Windows platform ?
• Application: PHP
• DB: SQL Server, MySql, etc.
• Web Server: Internet Information Services (IIS)
• OS: Windows Server 2008 / 2008 R2
From CGI to FastCGI C
GI One request, One
process
The good
• Very stable
The bad
• *SLOW* on Windows (spawning a new process)
ISA
PI PHP runtime lives
in IIS or in a surrogate process
The good
• Very fast
The bad
• Stability
• Thread safety
Fast
CG
I PHP runtime handled by a process pool
The good
• Faster than CGI
• More robust than ISAPI
• No more threading issues
Démo
Also available on Server Core
• A “distro” that minimizes footprint and attack surface
• PHP runs on Server Core since Windows Server 2008
Creating a new Build Process Using better tools to do a better job
• Makefiles are generated using Unix-style configure scripts. Functionality is emulated with JScript
Unix ‘configure’-style makefiles
• Makefiles are generated with no ability to optimize entire builds, nor take advantage of better tools, compilers, etc.
No Optimizations
• Libraries never compiled with the same settings.
Independent Dependencies
• Very few people had all the right bits/tools to even compile the Windows PHP binaries—Certainly impossible to replicate an exact build.
Undefined process
•Using tools built by the OSTC, we have constructed a better build process which opens many new possibilities, yet can easily adapt to new changes by developers using older technologies.
Created a clean, unified build
•Generated project files use a single set of build configuration files, allowing 100% of the code to be built to the same specifications.
One unified set of properties
•The new process lets us take advantage of high-performance PGO technology to improve the performance of PHP by leaps and bounds.
Optimizations everywhere
•With the new process, we can now do instrumented builds of the entire stack, allowing us to analyze and improve PHP for any environment.
Limitless opportunities
Using VC 9 What a difference the compiler makes
• Visual C++ 6.0, being over a decade old, would not produce code optimized for modern operating systems and hardware.
VC 6 builds
• PHP on Windows was being left behind, simply because it was nearly impossible to build with any other compiler
Older Compiler
• VC 6 offered no ability to build for 64 bit Windows
No 64 bit support
• Visual C++ 9.0 provides technologies that allow us to target today’s operating systems and hardware.
VC 9 builds
• By just changing the compiler, generates code that performs better, even before using advanced PGO technologies.
New Compiler
• We are now building 64bit snapshot builds alongside the 32 bit builds, 95%+ libraries are 64 bit too.
Now, 64 bit support
Going native Using Windows APIs on Windows…
• PHP has been built with POSIX in mind, and therefore, on Windows it was natural to adopt emulation libraries to accomplish similar tasks.
Heavy use of POSIX emulation
• Often, the way to do something on Unix, is not the way to do it on Windows.
Using wrong methods
• Many libraries were being used to supply functionality that was already present in Windows (Crypto, DNS, etc)
Non-standard Implementations
• Windows 98 was considered a primary target… ‘nuff said!
Targeted oldest OS possible
• Dropped the POSIX emulation libraries, and code has been written to use Win32 APIs correctly.
Eliminated POSIX emulation
• Implemented features in a way that doesn’t mimic the method on Unix, just the results.
Choosing the Win32 Way
• Replaced that code with calls to the natively provided APIs.
Use native libraries/APIs
• Recent code changes now allow us to target features on the latest versions of Windows, and provides graceful failure on down-level platforms.
Targets new OS, gracefully
Testing and QA Using Windows APIs on Windows…
• If it worked on a Unix platform, it was done... Windows was never given any attention, nor care by hardly anyone
Unix was the primary platform
• The standard PHP test suite did not pass with a strong success rate.
Tests did not have high pass rate.
• Security considerations for Windows were not taking place, no Windows developers were on the Security Mailing Lists
Security was a Unix concern.
• Nearly no tools to assist in automation of testing on Windows at all.
No tools for doing automated testing.
•Windows is now a primary platform, and changes which break Windows must be addressed.
Windows is a primary platform
•Over 98% of tests now pass on Windows, and we’re aiming to close the gap completely.
98%+ tests now pass on Windows.
•Windows developers are now on the security mailing lists, and can take action at the same time.
Windows is now represented
•The OSTC has created new tools for testing FastCGI and PHP builds that can be included in the official build process, providing PGO and instrumentation data to the developers.
New Testing Tools
Release Process Same Day Service…with a smile
• Unix Platforms was the only concern.
Unix was the primary platform
• Builds for Windows were constrained by a single person’s ability to make the build happen.
Single point of failure.
• Hardly anyone worked on Windows releases, and the installer was poor.
No attention to details.
• Windows gets the same ability to push back on Release Dates, and builds are done on both platforms on the same day.
Windows is a primary platform
• It is now simple for anyone to rebuild the exact same PHP stack on Windows as the release build.
Easy to replicate.
• New work is being done to improve the installer for the Windows platform.
New work on the installer.
• PHP is at last maintained on Windows.
• And ready for production
• http://windows.php.net
• Performance tuning is on its way
• We are getting on par with LAMP
• Ongoing work on caching
• We still lack many modules for 5.3
• That’s our top priority right now
Where are we now ?
Web Plaform Installer
http://www.microsoft.com/web
• A tool to install and configure • IIS
• Frameworks and runtimes (.NET / PHP)
• Databases (SQL Server, MySQL)
• Tools (Visual Web Developper 2008, Silverlight 3 Tools for VS)
• And Web apps
• Blogs (phpBB, WordPress, DasBlog, …)
• Wikis, Galleries, etc.
• CMS (DotNetNuke, Drupal, SilverStripe, ...)
Windows Cache Extension 1.0 for PHP
PHP Connectivity to Windows Azure
Word and Excel reading and writing
Windows Live services
PDO Driver for Sql Server
…
Working in sync with you on the most popular applications
What’s next
Web Platform Installer
• The (relatively) new Microsoft/OSS story
• A new PHP platform on Windows
• Running PHP on Windows
• PHP apps on Windows
• Opening Windows products to PHP
• Cloud story : PHP on Windows Azure
• The Why
• The How
Agenda
• Infrastructure as a Service : bring your OS
• Platform as a service : bring your App
• Infrastructure as a service : use our App
Cloud terms & actors in a nutshell
Cloud
Cloud
How does your app handle load ?
Usage
Jan Apr Jul Oct
peak load
Idle time
Web Tier B/L Tier Database B/L Tier
B/L Tier
B/L Tier
Database
p1 p2 p3 Web Tier
Web Tier
Web Tier
Company A
How does your app share data ?
Server Data
I love you! I love
you too!
Company A
Company B
Public Cloud
Scenarios for Data
Server Data
Server
Server
Server Data Server
In-browser Application
(JSON & AtomPub Support in Azure)
Your app, my accounts ?
Entreprise directory
Account DB for a web
app
Your University account
Your OpenID account
…
Your App Federated Identity
Provider Your App
The Windows Azure cloud infrastructure
We Start with Lots of Blinking Lights and Cables
We Put them Into Racks
Then, we add software
• A hypervisor, on top of which a Host Virtual Machine, on top of which many Virtual Machines
CPU: x64
OS : Windows 2008
Web Server : IIS 7
Apps : .Net, PHP, C++, etc.
Then, we add redundancy logic
Mgmt. Services
Data Node
SQL Server
Fabric
Data Node Components
Partition Manager
Master Node
Mgmt. Services
Data Node
SQL Server
Fabric
Mgmt. Services
Data Node
SQL Server
Fabric
Mgmt. Services
Data Node
SQL Server
Fabric
Deployment Health
Monitoring
Service Management
Master Cluster
Data Cluster
Fabric Replication Fetch Partition
Map SQL
Client
Mgmt. Services
Data Node
SQL Server
Fabric
Data Node Components
Partition Manager
Master Node Provisioning
front-end
Data Access Library
REST/SOAP
ACE Logic
Front-end Node
Data Access Library
REST/SOAP
ACE Logic
Front-end Node
Data Access Library
REST/SOAP
ACE Logic
Front-end Node
Which leads to :
Running code on Azure
• We re-use the existing IIS infrastructure
• FastCGI allows us to plug in almost every language • For example, you can package PHP, • .. Including your own extensions and
configuration, • Point PHP files to PHP-CGI.exe, • .. And run them directly
• Let’s see that in action.
Running code on Azure
Data on Azure
• A basic storage infrastructure : Azure Storage • Blobs (think files) • Tables (think Flat File database) • Queues (messages) • Access is done using REST
• A SQL-Server engine : SQL Azure
• A subset of SQL Server 2008 • Including Views, Stored Procedures, etc. • Access is done using TDS
Using Azure Storage
• http://phpazure.codeplex.com/ • Overview
• Enables PHP developers to take advantage of the Microsoft Cloud Services Platform – Windows Azure.
• Provides consistent programming model for Windows Azure Storage (Blobs, Tables & Queues)
• Features • PHP classes for Windows Azure Blobs, Tables & Queues
(for CRUD operations) • Helper Classes for HTTP transport, AuthN/AuthZ, REST &
Error Management • Manageability, Instrumentation & Logging support • Support for storing PHP sessions in Azure Table Storage
• Licence : BSD
Using Sql Azure
• http://www.codeplex.com/SQLSRVPHP
• Licence : Microsoft Public License (Ms-PL)
• Gives access to SQL Server databases,
• But also SQL Azure
Consuming Sql Azure ... in PHP … with Eclipse
We do our best to be technology-agnostic
Azure™ Services Platform
Thank you, and stay tuned for more (Symfony on Azure ?)
Links
• www.azure .com : main entry point • http://sqlazuremw.codeplex.com/
• Migration Wizard (Sql Server -> Sql Azure) • http://www.codeplex.com/SQLSRVPHP
• Accessing data using TDS (Sql Server, Sql Azure) • http://phpazure.codeplex.com/
• Accessing Azure Storage in PHP • http://windows.php.net
• Latest PHP binaries & Source • http://www.microsoft.com/downloads/details.aspx?FamilyID=413E
88F8-5966-4A83-B309-53B7B77EDF78&displaylang=en • Standard Azure Training Kit, contains samples to run PHP on
Azure • http://phpdataservices.codeplex.com/
• Accessing REST data using PHP
Top Related