32
Hank Janssen GPM OSSL 2007 [email protected] http://port25.technet.com

GPM OSSL 2007 [email protected] ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Hank Janssen – GPM – OSSL – [email protected]://port25.technet.com

Page 2: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs
Page 3: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Innovation

Technology Research

Interoperability

Technology Understanding

CulturalUnderstanding

Change Agent

Page 4: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Deep Unix & Linux Expertise

Heterogeneous Datacenter

Management

Virtualization

High Performance

Computing

Web Infrastructure

Security

Embedded

Page 5: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs
Page 6: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Microsoft's technical commitment to make Windows the Premier platform for one of the most popular web scripting languages on the web today

Microsoft Benefits Migrate existing PHP apps to windows with virtually no

modifications Combine PHP with Microsoft technologies creating rich websites Reuse existing PHP applications and infrastructure on Windows Provide customers greater availability of applications and

capabilities without increasing costs

Guaranteed growth into the best the OSS and Microsoft technologies available

Page 7: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Made non-threaded PHP work in Windows, including IIS (through FastCGImodule)

non-threaded PHP is significantly faster due to absence of thread-related locks and per-thread data structures handling.

non-thread safe php components and apps can run reliably FastCGI. Improved registry handling for PHP. PHP has an ability to configure

certain parameters per-request depending on registry settings, it wasn't implemented in optimal way (required registry scan on each request), fixed it to work more efficiently.

Some file system functions were using POSIX library wrappers, which worked significantly slower than native win32 API counterparts. These were rewritten to use win32 API efficiently.

Removed some of the file system functions had unnecessary system calls, which had a noticeable negative performance impact on Windows.

Page 8: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Updated file system functions to use realpath cache capability whenever possible.

Updated memory manager to use native win32 heap management APIs and return allocated memory to the system at the end of the request, improving performance and reduced memory requirements for PHP.

Optimized timeout thread in PHP to be started only when timeout is needed. Also optimized startup sequence for bcmath extension to do initialization on module startup only.

Available in PHP 5.2.1 and greater

Page 9: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Speed and StabilityApplication CompatibilitySupport and Guidance

Get it at http://www.iis.net/php

Page 10: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

INETINFO.exe

metabase

ftp, smtp,

nntp

User mode

Kernel mode

HTTP.SYS

W3SVC

SVCHOST.exe

W3Core

W3WP.exe

#1 Application Pool

ID: Network Service

W3Core

W3WP.exe

#2 Application Pool

ID: Network Service

W3Core

W3WP.exe

#3 Application Pool

ID: Network Service

ASP.net Apps

.Net App

Domain.Net App

Domain.Net App

Domain

ASP.net Apps

.Net App

Domain.Net App

Domain.Net App

Domain

ASP.net Apps

.Net App

Domain.Net App

Domain.Net App

Domain

Page 11: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

#2.config#1.config #3.config

IISADMIN

XML Config

ftp, smtp,

nntp

User mode

Kernel mode

HTTP.SYS

WAS

IISCore

W3WP.exe

#1 Application Pool

ID: SidforPool3

IISCore

W3WP.exe

#2 Application Pool

ID: SIDforPool2

IISCore

W3WP.exe

#3 Application Pool

ID: SIDforPool3

ASP.net Apps

.Net App

Domain.Net App

Domain.Net App

Domain

PHP5 Apps

.Net App

Domain.Net App

DomainPHP App

Domain

PHP4 Apps

.Net App

Domain.Net App

DomainPHP App

Domain

modules modules modules

Application Pools can only read their config

Page 12: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

FastCGI will ship in Windows Server 2008 as a built-in IIS component for the first time, sparing customers the hassle of downloading, installing and patching 3rd party products.

Delegate management to site owners. Allowing management with remote tools that are supported on Vista, 2003 and XP. Allowing you (Among many other management functions) to default homepage to for example index.php without needing server privileges.

Metabase has been replace by distributable and shareable config files xCopy deployments are now possible

Module support, for example http://www.Urlwriter.netprovides mod_rewrite like capabilities to IIS

Page 13: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Feature IIS6 IIS7

ISAPI/CGI Yes Yes

FastCGI Download Included in Vista SP1 and Windows Server 2008 Beta 3 and beyond. (There is a FastCGI download for Vista RTM)

Configure Default Homepage Requires Admin Delegated XML based config

Run Multiple Versions of PHP Yes Yes

Overwriting of Handlers at the URL Level

Requires Admin Yes (This means a site owner can configure PHP 4.4.7 for one URL and PHP 5.2.4 for a different URL in the same application)

ServerCore Support No Yes

Use Managed Modules from PHP (e.g. Forms Authentication)

No Yes

Page 14: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Provide Windows Hosting of PHP Applications

Built-in FastCGI optimized for high performance

▪ Reuses CGI processes for multiple requests

▪ Dramatically faster than standard CGI

Fully tested against latest PHP.NET builds

Host Multiple Versions of PHP Side by Side

Easily host PHP4 and PHP5 on the same server

Page 15: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

The Server Core installation option of the Microsoft Windows Server 2008 operating system coupled with the availability of IIS7, provides a powerful Web server on top of a minimal footprint operating system

You can run IIS/PHP on Server Core.

Go to http://www.iis.net/golive to get 2008

Page 16: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

The next version of Expression Web will be the first Microsoft tool to offer PHP support.

A set of PHP files has been created to support the use of the Microsoft AJAX Library with PHP web applications.

Page 17: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Main Microsoft starting pages http://www.iis.net/php http://www.iis.net/golive

Interesting Plugins http://www.Urlwriter.net

Additional Demo’s and Content http://blogs.iis.net/mvolo/archive/2007/08/13/iis-authentication-plugin-

for-the-wordpress-php-blogging-engine.aspx Mike Volodarsky WordPressdemo

http://blogs.iis.net/bills/archive/2006/10/28/PHP-on-IIS.aspx

Goody bag includes a pre-release of 2008 with IIS7 Always Looking for community participation!!!

Page 18: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

HOWTO/Setups available now for (http://www.iis.net/php); Advanced Poll b2Evolution Coppermine Crafty Syntax Live Help Gallery2 Geeklog Mambo WordPress XOOPS

Page 19: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Hostbasket CrystalTech DiscountASP Webhost (Hong Kong) Locaweb (Brazil) Hostaway MaximumASP

Page 20: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

John A. Bocharov – PM – Data [email protected]://msdn.microsoft.com/data

Page 21: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Goal: Provide robust, scalable, and reliable SQL Server connectivity for PHP developers targeting the Windows platform

October 2007 CTP: available later this week Looking for PHP Community feedback on:

Design & Functionality

Ease of Use & Development

Key Scenarios & Environments

Page 22: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Create a PHP API, not a Microsoft API for PHP Simple things take very little code

Avoid many ways to do the same thing

PHP Developers can apply existing data patterns Enterprise “abilities” to PHP/SQL Server Devs. Reliability

Scalability

Maintainability

Page 23: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

<?php

$connOptions = array('UID' => get_cfg_var('demo_uid'),

'PWD' => get_cfg_var('demo_pwd'));

$conn = sqlsrv_connect($serverName = "(local)", $connOptions);

$stmt = sqlsrv_conn_execute($conn, "SELECT TOP 20 "

."Name, ProductNumber, Color FROM Production.Product");

while ($dataRow = sqlsrv_stmt_fetch_array($stmt,

SQLSRV_FETCH_TYPE_ASSOC ) ) {

if (!$columns) $columns = display_header_row($dataRow);

display_row($dataRow, $columns);

}

sqlsrv_stmt_close($stmt);

sqlsrv_conn_close($conn);?>

Page 24: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

<?php

$connOptions = array('UID' => get_cfg_var('demo_uid'),

'PWD' => get_cfg_var('demo_pwd'));

$conn = sqlsrv_connect($serverName = "(local)", $connOptions);

$query = $_REQUEST['query'];

$stmt = sqlsrv_conn_execute($conn, "SELECT "."Name, ProductNumber, Color FROM Production.Product "

."WHERE [Name] LIKE '%$query%'");

while ($dataRow = sqlsrv_stmt_fetch_array($stmt,

SQLSRV_FETCH_TYPE_ASSOC ) ) {

if (!$columns) $columns = display_header_row($dataRow);

display_row($dataRow, $columns);

}

sqlsrv_stmt_close($stmt);

sqlsrv_conn_close($conn);?>

Page 25: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

<?php

$connOptions = array('UID' => get_cfg_var('demo_uid'),

'PWD' => get_cfg_var('demo_pwd'));

$conn = sqlsrv_connect($serverName = "(local)", $connOptions);

$stmt = sqlsrv_conn_execute($conn, "SELECT "."Name, ProductNumber, Color FROM Production.Product "

."WHERE [Name] LIKE '%' + ? + '%'",

array($_REQUEST['query'])

);

while ($dataRow = sqlsrv_stmt_fetch_array($stmt,

SQLSRV_FETCH_TYPE_ASSOC ) ) {

if (!$columns) $columns = display_header_row($dataRow);

display_row($dataRow, $columns);

}

sqlsrv_stmt_close($stmt);

sqlsrv_conn_close($conn);?>

Page 26: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

<?php

$connOptions = array('UID' => get_cfg_var('demo_uid'),

'PWD' => get_cfg_var('demo_pwd'));

$conn = sqlsrv_connect("(local)", $connOptions);

$stmt = sqlsrv_prepare($conn, "INSERT INTO SomeTable "

."(c1, c2, c3) VALUES (?, ?, ?)");

while ($dataArray = parseFormData()) {

sqlsrv_stmt_execute($stmt, $dataArray);}

sqlsrv_stmt_close($stmt);

sqlsrv_conn_close($conn);?>

Page 27: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Sample application shipping with the Driver

Page 28: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

<?php

$connOptions = array('UID' => get_cfg_var('demo_uid'),

'PWD' => get_cfg_var('demo_pwd'));

$conn = sqlsrv_connect("(local)", $connOptions);

$stmt = sqlsrv_conn_execute($conn, "INSERT INTO SomeTable "

."(c1, c2, c3) VALUES (?, ?, ?)");

while (sqlsrv_stmt_fetch($stmt)) {

$stream = sqlsrv_stmt_get_field($stmt, 1,

SQLSRV_PHPTYPE_STREAM);

while (! feof($stream) ) {

do_something(fread($stream, 8192));

}

fclose($stream);

}

?>

Page 29: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

$conn = sqlsrv_connect($server, $connOptions);

if (!$conn) die( e_format( sqlsrv_errors() ) );

if ($warnings = sqlsrv_warnings()) error_log( e_format( $warnings) );

$stmt = sqlsrv_conn_execute($conn, $tsql);

if (!$stmt) die( e_format( sqlsrv_errors() ) );

if ($warnings = sqlsrv_warnings()) error_log( e_format( $warnings) );

while (sqlsrv_stmt_fetch($stmt)) {

if ($warnings = sqlsrv_warnings()) error_log( e_format( $warnings) );

$stream = sqlsrv_stmt_get_field($stmt, 1, SQLSRV_PHPTYPE_STREAM);

if ($errors = sqlsrv_errors()) die( e_format( $errors ) );

if ($warnings = sqlsrv_warnings()) error_log( e_format( $warnings) );

}

if ($errors = sqlsrv_errors()) die( e_format( $errors ) ) ;

if ($warnings = sqlsrv_warnings()) error_log( e_format( $warnings) );

function e_format($errors) {

foreach ($errors as $error)

foreach (array('SQLSTATE', 'code', 'message') as $prop)

$formatted .= "$prop: {$error[$prop]}<br/>";

return $formatted;

}

Page 30: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Authentication Real-world Example

Page 31: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

Character Encoding Support Transactions Metadata Variable Binding Architecture Optimizations

Page 32: GPM OSSL 2007 hjanssen@microsoft.com ://msdnshared.blob.core.windows.net/media/... · capability whenever possible. Updated memory manager to use native win32 heap management APIs

We would love to have your feedback!

http://blogs.msdn.com/sqlphp

(blog available shortly)

[email protected]