SlideShare a Scribd company logo
Ipc mysql php
<Insert Picture Here>
PHP and MySQL – The Current State
Johannes Schlüter
MySQL Engineering: Connectors & Client Connectivity
The following is intended to outline our general
product direction. It is intended for information
purposes only, and may not be incorporated into any
contract. It is not a commitment to deliver any
material, code, or functionality, and should not be
relied upon in making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.
Oracle’s Strategy:
Complete. Open. Integrated.
• Built together
• Tested together
• Managed together
• Serviced together
• Based on open standards
• Lower cost
• Lower risk
• More reliable
Oracle’s Investment in Open Source
• Supported popular open source projects for many years
• Part of Oracle’s Complete, Open, Integrated strategy
• Speed up time-to-innovation
• Expand the developer community
• Oracle never settles for being
second best at any level of the
stack
• “Complete” means we meet
most customer requirements
at every level
That’s why MySQL matters
to Oracle and Oracle
customers
Industry’s Most Complete LAMP Stack
–Oracle Enterprise Linux
–Oracle VM (Xen-based)
–Apache
–MySQL
–PHP, Perl, Python
MySQL
Apache
Eclipse
NetBeans
Apps
PHP
Investment in MySQL
• Make MySQL a Better MySQL
– #1 Open Source Database for Web Applications
• Develop, Promote and Support MySQL
– Improve engineering, consulting and support
– Leverage 24x7, World-Class Oracle Support
• MySQL Community Edition
– Source and binary releases
– GPL license
Investment in MySQL
• MySQL Focus Areas
– Web, Embedded & Telecom
– LAMP
– Windows
• Oracle + MySQL Customers
– Oracle Enterprise Manager
– Oracle Secure Backup
– Oracle Audit Vault
InnoDB will become default
• ACID Transactions, FKs, Crash Recovery
Improved Availability
• Semi-synchronous Replication
• Replication Heartbeat
Improved Usability
• SIGNAL/RESIGNAL
• More Partitioning Options
• PERFORMANCE_SCHEMA
Better Instrumentation/Diagnostics
• InnoDB stats in 5.5 PERFORMANCE_SCHEMA
MySQL 5.5
RC
InnoDB Performance improvements
• Multiple Buffer Pool Instances
• Multiple Rollback Segments
• Extended Change Buffering (with delete buffering, purge buffering)
• Improved Purge Scheduling
• Improved Log Sys mutex
• Separate Flush List mutex
MySQL Performance Improvements
• Better Metadata Locking within Transactions
• Split LOCK_open mutex
• Eliminated LOCK_alarm mutex as bottleneck
• Eliminated LOCK_thread_count as bottleneck
• Improved Performance/Scale on Win32, 64
More than 10x improvement in recovery times
MySQL 5.5 is Faster!
RC
MySQL 5.5 SysBench Benchmarks
Linux
Intel Xeon X7460 x86_64
4 CPU x 6 Cores/CPU
2.66 GHz, 32GB RAM
Fedora 10
MySQL 5.1.50
(InnoDB built-in)
MySQL 5.1.50
(InnoDB Plug-in)
MySQL 5.5.6
(New InnoDB)
200% performance gain
for MySQL 5.5 over 5.1.50; at scale
RC
MySQL 5.5 SysBench Benchmarks
Linux
MySQL 5.1.50
(InnoDB built-in)
MySQL 5.1.50
(InnoDB Plug-in)
MySQL 5.5.6
(New InnoDB)
Intel Xeon X7460 x86_64
4 CPU x 6 Cores/CPU
2.66 GHz, 32GB RAM
Fedora 10
369% performance gain
for MySQL 5.5 over 5.1.50; at scale
RC
Ipc mysql php
PHP Extensions for MySQL
PDO_mysql
ext/mysql mysqli
PHP
ext/mysql
• One of the first PHP extensions
• Actively maintained with PHP 4
– No new features in PHP 5
• Exception: Added mysqlnd support with PHP 5.3
– Bug fixing only
• Best documented database extension
– Tons of books, tutorials, …
• Missing support for many MySQL features
– Prepared statements, Queries with multiple result sets (stored
procedures), compression, encryption, full charset support, …
PDO_mysql
• “The PHP Data Objects (PDO) extension defines a
lightweight, consistent interface for accessing
databases in PHP.” http://php.net/intro.pdo
• Lowest common denominator
• PHPish API
• Broken by Design™
$ php --rf PDO::sqliteCreateFunction
Exception: Method PDO::sqliteCreateFunction() does not exist
PDO – Broken by Design
Intermezzo: Prepared Statements
Client Server
SELECT foo
FROM bar
WHERE id = 42
•Create Execution plan
•Query database
Resultset(s)
query()
Intermezzo: Prepared Statements
Client Server
SELECT foo
FROM bar
WHERE id = ?
•Query database
Resultset(s)
Handle
Handle
Param 1: 42
•Create Execution plan
prepare()
execute()
PDO – Broken by Design
<?php
$pdo = new PDO(“mysql:host=localhost;dbname=test”,
“user”, “password”);
$query = $pdo->prepare(
“SELECT id FROM table LIMT ?, ?”);
$query->bindValue(1, $_GET[“offset”]);
$query->bindValue(2, $_GET[“limit”]);
$query->execute();
“The mysqli extension, or as it is sometimes known,
the MySQL improved extension, was developed to
take advantage of new features found in MySQL
systems versions 4.1.3 and newer. […] If you are
using MySQL versions 4.1.3 or later it is strongly
recommended that you use this extension.”
http://php.net/mysqli.overview
What The PHP Manual Is Saying
Extended(!) support for
MySQL 4.0(!) ended 2008-09-30
mysqli
The Improved MySQL Extension
• Full support for all MySQL features
– Stored Procedures
– Prepared Statements
– Encryption (SSL)
– Compression
– Charsets
– …
• Actively developed, maintained and supported by
Oracle
PHP and mysqlnd
PHP
PHP Memory IO: PHP StreamsInfrastructure
ext/mysql PDO_mysqlmysqli
mysqlnd – MySQL native driver for PHP
MySQL Server
libmysql vs. mysqlnd
MySQL Server MySQL Server
mysqlnd libmysql
PHP PHP
PHP Memory
libmysql Memory
PHP Memory
PHP Memory
copy
copy
usedirectly
copy
Building PHP with mysqlnd
• ./configure 
--with-mysql=mysqlnd 
--with-mysqli=msqlnd 
--with-pdo-mysql=mysqlnd
• Default on Windows and some distributions
mysqlnd Statistics
• Around 150 statistic values collected
• mysqli_get_client_stats (),
mysqli_get_connection_stats()
Asynchronous Queries
/* Do something */
PHP Script MySQL
query
result
query
poll
result
$conn = new MySQLi(...);
$conn->query(
"SELECT * FROM t WHERE ....",
MYSQLI_ASYNC);
/* Process query results */
mysqli_poll($links, $errors, $reject, 1);
Sharding
<?php
…
?>
Sharding
foreach ($all_links as $link)
$link->query("SELECT 'test' ", MYSQLI_ASYNC);
$processed = 0;
do {
$links = $all_links;
if (!mysqli_poll($links, $errors, $reject, 1)) continue; /* TIMEOUT */
foreach ($links as $link) {
if ($result = $link->reap_async_query()) {
print_r($result->fetch_row());
mysqli_free_result($result);
$processed++;
}
}
} while ($processed < count($all_links));
mysqlnd plugins
Plugin Hook
mysqlnd Query
mysqli::query()mysql_query() PDO::query()
Wire Protocol
Plugin Hook
Network
mysqlnd Plugins
• “mysqlnd client proxy”
– Load Balancing
• Read / Write splitting
• Failover
– Monitoring
• Query Logging
• Query Auditing
– Performance
• Caching
• Sharding
The Database Is The Bottleneck
Caching!
# pecl install mysqlnd_qc-beta
… and you are done!
Almost at least ;-)
mysqlnd Query cache
• For more:
• Ulf's presentation → Tomorrow 16:30 (German)
Experimental Extensions
• By Oracle:
– mysqlnd_sip
– mysqlnd_mc
– mysqlnd_ms
– mysqlnd_pscache
• By Community:
– mysqlnd_uh
(David Soria Parra /
Mayflower GmbH)
mysqlnd_uh
class ConnProxy extends MysqlndUHConnection {
public function query($conn, $query) {
if ($query == “SELECT 1”) {
$query = “SELECT 2”;
}
return parent::query($conn, $query);
}
}
mysqlnd_uh_set_connection_proxy(new ConnProxy());
Key Takeaways
• MySQL is important to Oracle and our customers
– Part of our Complete, Open, Integrated strategy
• Oracle is making MySQL better today
– Major Feature, Performance, Scalability enhancements
– 24x7, Global support in 145 countries
Download Now
http://dev.mysql.com/downloads
Download Now
http://dev.mysql.com/downloads
Ipc mysql php
Ipc mysql php
Ipc mysql php

More Related Content

What's hot (20)

PDF
MySQL 5.7 + JSON
Morgan Tocker
 
PDF
IaC MeetUp Active Directory Setup for Oracle Security LAB
Stefan Oehrli
 
PDF
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
Dave Stokes
 
PDF
My sql 5.7-upcoming-changes-v2
Morgan Tocker
 
PDF
MySQL NoSQL APIs
Morgan Tocker
 
PPT
Top 15 MySQL parameters
Andrejs Vorobjovs
 
PPTX
Awr doag
Marcin Przepiórowski
 
PDF
Middleware upgrade to Oracle Fusion Middleware(FMW) 12c.Real Case stories.
Andrejs Vorobjovs
 
PDF
REST in Piece - Administration of an Oracle Cluster/Database using REST
Christian Gohmann
 
PDF
AUSOUG Oracle Password Security
Stefan Oehrli
 
PDF
MySQL 5.7: Core Server Changes
Morgan Tocker
 
PDF
Security Best Practice: Oracle passwords, but secure!
Stefan Oehrli
 
PDF
MythBusters Globalization Support - Avoid Data Corruption
Christian Gohmann
 
PDF
Lamp Introduction 20100419
Vu Hung Nguyen
 
PDF
Oracle Cloud deployment with Terraform
Stefan Oehrli
 
PDF
WebLogic on ODA - Oracle Open World 2013
Michel Schildmeijer
 
PDF
New awesome features in MySQL 5.7
Zhaoyang Wang
 
PDF
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
Mark Swarbrick
 
PDF
Avoid boring work_v2
Marcin Przepiórowski
 
PPTX
Proxysql use case scenarios fosdem17
Alkin Tezuysal
 
MySQL 5.7 + JSON
Morgan Tocker
 
IaC MeetUp Active Directory Setup for Oracle Security LAB
Stefan Oehrli
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
Dave Stokes
 
My sql 5.7-upcoming-changes-v2
Morgan Tocker
 
MySQL NoSQL APIs
Morgan Tocker
 
Top 15 MySQL parameters
Andrejs Vorobjovs
 
Middleware upgrade to Oracle Fusion Middleware(FMW) 12c.Real Case stories.
Andrejs Vorobjovs
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
Christian Gohmann
 
AUSOUG Oracle Password Security
Stefan Oehrli
 
MySQL 5.7: Core Server Changes
Morgan Tocker
 
Security Best Practice: Oracle passwords, but secure!
Stefan Oehrli
 
MythBusters Globalization Support - Avoid Data Corruption
Christian Gohmann
 
Lamp Introduction 20100419
Vu Hung Nguyen
 
Oracle Cloud deployment with Terraform
Stefan Oehrli
 
WebLogic on ODA - Oracle Open World 2013
Michel Schildmeijer
 
New awesome features in MySQL 5.7
Zhaoyang Wang
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
Mark Swarbrick
 
Avoid boring work_v2
Marcin Przepiórowski
 
Proxysql use case scenarios fosdem17
Alkin Tezuysal
 

Viewers also liked (7)

PDF
ABC
chichibek
 
PPTX
Rolando aza
rolandoaza
 
XLS
GNI- purchasing power parity
Yatendra Kumar
 
PPT
Climas 2 Elaios
jorgecaldeprofe
 
PPT
Tienes 5 segundos
ZaydaRv
 
PPTX
Post tranlational modification
pavan831
 
PPTX
Arte paleolítico
lordaeron1995
 
Rolando aza
rolandoaza
 
GNI- purchasing power parity
Yatendra Kumar
 
Climas 2 Elaios
jorgecaldeprofe
 
Tienes 5 segundos
ZaydaRv
 
Post tranlational modification
pavan831
 
Arte paleolítico
lordaeron1995
 
Ad

Similar to Ipc mysql php (20)

PDF
MySQL Document Store
Mario Beck
 
PPTX
PowerShellForDBDevelopers
Bryan Cafferky
 
PDF
Top ten-list
Brian DeShong
 
PPT
My sqlstrategyroadmap
slidethanks
 
PPT
MySQL Strategy&Roadmap
slidethanks
 
PPT
Plantilla oracle
Uriel Barrales Garrido
 
PDF
Open Source Software – Open Day Oracle 2013
Erik Gur
 
PDF
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld
 
PDF
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
Serge Frezefond
 
PPTX
Northeast PHP - High Performance PHP
Jonathan Klein
 
PPTX
Experience sql server on l inux and docker
Bob Ward
 
PDF
Introdução ao Oracle NoSQL
Bruno Borges
 
PPT
Rajnish singh(presentation on oracle )
Rajput Rajnish
 
KEY
Standardizing and Managing Your Infrastructure - MOSC 2011
Brian Ritchie
 
PDF
제3회난공불락 오픈소스 인프라세미나 - MySQL
Tommy Lee
 
PDF
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Dave Stokes
 
PPT
ow-123123123123123123123123123123123123123
DngHong855117
 
PPT
ow.ppt
ssuser96a63c
 
PPT
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
Brahamam Veera
 
MySQL Document Store
Mario Beck
 
PowerShellForDBDevelopers
Bryan Cafferky
 
Top ten-list
Brian DeShong
 
My sqlstrategyroadmap
slidethanks
 
MySQL Strategy&Roadmap
slidethanks
 
Plantilla oracle
Uriel Barrales Garrido
 
Open Source Software – Open Day Oracle 2013
Erik Gur
 
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld
 
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
Serge Frezefond
 
Northeast PHP - High Performance PHP
Jonathan Klein
 
Experience sql server on l inux and docker
Bob Ward
 
Introdução ao Oracle NoSQL
Bruno Borges
 
Rajnish singh(presentation on oracle )
Rajput Rajnish
 
Standardizing and Managing Your Infrastructure - MOSC 2011
Brian Ritchie
 
제3회난공불락 오픈소스 인프라세미나 - MySQL
Tommy Lee
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Dave Stokes
 
ow-123123123123123123123123123123123123123
DngHong855117
 
ow.ppt
ssuser96a63c
 
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
Brahamam Veera
 
Ad

More from Anis Berejeb (9)

PDF
Perf tuning2
Anis Berejeb
 
PDF
Explain2
Anis Berejeb
 
PDF
Advanced Date/Time Handling with PHP
Anis Berejeb
 
PDF
APC & Memcache the High Performance Duo
Anis Berejeb
 
PDF
Mysqlnd Query Cache
Anis Berejeb
 
PDF
Barcelona mysqlnd qc
Anis Berejeb
 
PDF
Mysql tracing
Anis Berejeb
 
PDF
Mysql tracing
Anis Berejeb
 
PDF
Barcelona 2010 hidden_features
Anis Berejeb
 
Perf tuning2
Anis Berejeb
 
Explain2
Anis Berejeb
 
Advanced Date/Time Handling with PHP
Anis Berejeb
 
APC & Memcache the High Performance Duo
Anis Berejeb
 
Mysqlnd Query Cache
Anis Berejeb
 
Barcelona mysqlnd qc
Anis Berejeb
 
Mysql tracing
Anis Berejeb
 
Mysql tracing
Anis Berejeb
 
Barcelona 2010 hidden_features
Anis Berejeb
 

Recently uploaded (20)

PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Sound the Alarm: Detection and Response
VICTOR MAESTRE RAMIREZ
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PPTX
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
Draugnet: Anonymous Threat Reporting for a World on Fire
treyka
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Sound the Alarm: Detection and Response
VICTOR MAESTRE RAMIREZ
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Draugnet: Anonymous Threat Reporting for a World on Fire
treyka
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 

Ipc mysql php

  • 2. <Insert Picture Here> PHP and MySQL – The Current State Johannes Schlüter MySQL Engineering: Connectors & Client Connectivity
  • 3. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 4. Oracle’s Strategy: Complete. Open. Integrated. • Built together • Tested together • Managed together • Serviced together • Based on open standards • Lower cost • Lower risk • More reliable
  • 5. Oracle’s Investment in Open Source • Supported popular open source projects for many years • Part of Oracle’s Complete, Open, Integrated strategy • Speed up time-to-innovation • Expand the developer community
  • 6. • Oracle never settles for being second best at any level of the stack • “Complete” means we meet most customer requirements at every level That’s why MySQL matters to Oracle and Oracle customers
  • 7. Industry’s Most Complete LAMP Stack –Oracle Enterprise Linux –Oracle VM (Xen-based) –Apache –MySQL –PHP, Perl, Python MySQL Apache Eclipse NetBeans Apps PHP
  • 8. Investment in MySQL • Make MySQL a Better MySQL – #1 Open Source Database for Web Applications • Develop, Promote and Support MySQL – Improve engineering, consulting and support – Leverage 24x7, World-Class Oracle Support • MySQL Community Edition – Source and binary releases – GPL license
  • 9. Investment in MySQL • MySQL Focus Areas – Web, Embedded & Telecom – LAMP – Windows • Oracle + MySQL Customers – Oracle Enterprise Manager – Oracle Secure Backup – Oracle Audit Vault
  • 10. InnoDB will become default • ACID Transactions, FKs, Crash Recovery Improved Availability • Semi-synchronous Replication • Replication Heartbeat Improved Usability • SIGNAL/RESIGNAL • More Partitioning Options • PERFORMANCE_SCHEMA Better Instrumentation/Diagnostics • InnoDB stats in 5.5 PERFORMANCE_SCHEMA MySQL 5.5 RC
  • 11. InnoDB Performance improvements • Multiple Buffer Pool Instances • Multiple Rollback Segments • Extended Change Buffering (with delete buffering, purge buffering) • Improved Purge Scheduling • Improved Log Sys mutex • Separate Flush List mutex MySQL Performance Improvements • Better Metadata Locking within Transactions • Split LOCK_open mutex • Eliminated LOCK_alarm mutex as bottleneck • Eliminated LOCK_thread_count as bottleneck • Improved Performance/Scale on Win32, 64 More than 10x improvement in recovery times MySQL 5.5 is Faster! RC
  • 12. MySQL 5.5 SysBench Benchmarks Linux Intel Xeon X7460 x86_64 4 CPU x 6 Cores/CPU 2.66 GHz, 32GB RAM Fedora 10 MySQL 5.1.50 (InnoDB built-in) MySQL 5.1.50 (InnoDB Plug-in) MySQL 5.5.6 (New InnoDB) 200% performance gain for MySQL 5.5 over 5.1.50; at scale RC
  • 13. MySQL 5.5 SysBench Benchmarks Linux MySQL 5.1.50 (InnoDB built-in) MySQL 5.1.50 (InnoDB Plug-in) MySQL 5.5.6 (New InnoDB) Intel Xeon X7460 x86_64 4 CPU x 6 Cores/CPU 2.66 GHz, 32GB RAM Fedora 10 369% performance gain for MySQL 5.5 over 5.1.50; at scale RC
  • 15. PHP Extensions for MySQL PDO_mysql ext/mysql mysqli PHP
  • 16. ext/mysql • One of the first PHP extensions • Actively maintained with PHP 4 – No new features in PHP 5 • Exception: Added mysqlnd support with PHP 5.3 – Bug fixing only • Best documented database extension – Tons of books, tutorials, … • Missing support for many MySQL features – Prepared statements, Queries with multiple result sets (stored procedures), compression, encryption, full charset support, …
  • 17. PDO_mysql • “The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP.” http://php.net/intro.pdo • Lowest common denominator • PHPish API • Broken by Design™
  • 18. $ php --rf PDO::sqliteCreateFunction Exception: Method PDO::sqliteCreateFunction() does not exist PDO – Broken by Design
  • 19. Intermezzo: Prepared Statements Client Server SELECT foo FROM bar WHERE id = 42 •Create Execution plan •Query database Resultset(s) query()
  • 20. Intermezzo: Prepared Statements Client Server SELECT foo FROM bar WHERE id = ? •Query database Resultset(s) Handle Handle Param 1: 42 •Create Execution plan prepare() execute()
  • 21. PDO – Broken by Design <?php $pdo = new PDO(“mysql:host=localhost;dbname=test”, “user”, “password”); $query = $pdo->prepare( “SELECT id FROM table LIMT ?, ?”); $query->bindValue(1, $_GET[“offset”]); $query->bindValue(2, $_GET[“limit”]); $query->execute();
  • 22. “The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. […] If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use this extension.” http://php.net/mysqli.overview What The PHP Manual Is Saying Extended(!) support for MySQL 4.0(!) ended 2008-09-30
  • 23. mysqli The Improved MySQL Extension • Full support for all MySQL features – Stored Procedures – Prepared Statements – Encryption (SSL) – Compression – Charsets – … • Actively developed, maintained and supported by Oracle
  • 24. PHP and mysqlnd PHP PHP Memory IO: PHP StreamsInfrastructure ext/mysql PDO_mysqlmysqli mysqlnd – MySQL native driver for PHP MySQL Server
  • 25. libmysql vs. mysqlnd MySQL Server MySQL Server mysqlnd libmysql PHP PHP PHP Memory libmysql Memory PHP Memory PHP Memory copy copy usedirectly copy
  • 26. Building PHP with mysqlnd • ./configure --with-mysql=mysqlnd --with-mysqli=msqlnd --with-pdo-mysql=mysqlnd • Default on Windows and some distributions
  • 27. mysqlnd Statistics • Around 150 statistic values collected • mysqli_get_client_stats (), mysqli_get_connection_stats()
  • 28. Asynchronous Queries /* Do something */ PHP Script MySQL query result query poll result $conn = new MySQLi(...); $conn->query( "SELECT * FROM t WHERE ....", MYSQLI_ASYNC); /* Process query results */ mysqli_poll($links, $errors, $reject, 1);
  • 30. Sharding foreach ($all_links as $link) $link->query("SELECT 'test' ", MYSQLI_ASYNC); $processed = 0; do { $links = $all_links; if (!mysqli_poll($links, $errors, $reject, 1)) continue; /* TIMEOUT */ foreach ($links as $link) { if ($result = $link->reap_async_query()) { print_r($result->fetch_row()); mysqli_free_result($result); $processed++; } } } while ($processed < count($all_links));
  • 31. mysqlnd plugins Plugin Hook mysqlnd Query mysqli::query()mysql_query() PDO::query() Wire Protocol Plugin Hook Network
  • 32. mysqlnd Plugins • “mysqlnd client proxy” – Load Balancing • Read / Write splitting • Failover – Monitoring • Query Logging • Query Auditing – Performance • Caching • Sharding
  • 33. The Database Is The Bottleneck
  • 35. # pecl install mysqlnd_qc-beta … and you are done! Almost at least ;-)
  • 36. mysqlnd Query cache • For more: • Ulf's presentation → Tomorrow 16:30 (German)
  • 37. Experimental Extensions • By Oracle: – mysqlnd_sip – mysqlnd_mc – mysqlnd_ms – mysqlnd_pscache • By Community: – mysqlnd_uh (David Soria Parra / Mayflower GmbH)
  • 38. mysqlnd_uh class ConnProxy extends MysqlndUHConnection { public function query($conn, $query) { if ($query == “SELECT 1”) { $query = “SELECT 2”; } return parent::query($conn, $query); } } mysqlnd_uh_set_connection_proxy(new ConnProxy());
  • 39. Key Takeaways • MySQL is important to Oracle and our customers – Part of our Complete, Open, Integrated strategy • Oracle is making MySQL better today – Major Feature, Performance, Scalability enhancements – 24x7, Global support in 145 countries Download Now http://dev.mysql.com/downloads Download Now http://dev.mysql.com/downloads