SlideShare a Scribd company logo
Ulf Wendel, Oracle Introduction and overview, Edition 2011 The MySQL native driver for PHP (mysqlnd)
The speaker says... The MySQL native driver for PHP (mysqlnd) is a drop-in replacement for the MySQL Client Library (AKA libmysql). All PHP MySQL extensions can be compiled to use mysqlnd instead of libmysql.  The mysqlnd library ships with PHP as PHP 5.3. Mysqlnd is part of the PHP source tree and distributed under the terms of the PHP license to avoid any license issues. PHP builds for Windows obtained from php.net use mysqlnd since PHP 5.3. Mysqlnd is a compile time default for all PHP MySQL extensions as of PHP 5.4.
New, unmatched features Plugin API for extensions – client-side proxies
Asynchronous, non-blocking queries
Performance statistics, read-only variables, ... The mysqlnd library MySQL Server
The speaker says... The mysqlnd library implements the MySQL Client Server protocol.  All three PHP MySQL extensions can be compiled to use it to communicate with MySQL.  Mysqlnd is tightly integrated into PHP and highly optimized for it. Therefore, it can outperform the MySQL Client Library in certain areas.  The MySQL Client Library is a general purpose library for all kinds of C/C++ clients. As such, it cannot offer all mysqlnd features. For example, memory savings by read-only variables (transparent for users) or respect of PHP memory limits is not possible without tight integration into PHP.
Open source plugins available from PECL mysqlnd_ms – Replication and Load Balancing
mysqlnd_qc – Client-side query caching
mysqlnd_uh – Monitoring, rewriting, ... with PHP
Prototypes: SQL injection protection, multi-query, ... Plugin API for extensions -> Presentation -> Documentation
The speaker says... A C plugin API is available for extending the mysqlnd C library.  Open source, ready-to-use plugins are available from PECL.   Plugins for MySQL replication and load balancing support (mysqlnd_ms), a client-side query cache (mysqlnd_qc), a swiss-army-knife plugin (mysqlnd_uh) which allows writing plugins with PHP for easy query monitoring, query rewriting and more. Plugins are client-side proxies. They operate on their own layer below the application.  Plugins can be drop-in solutions requiring no application changes!
MySQL Replication support drop-in solution Read/write splitting: automatic, user-defined
Load Balancing: round robin, random, user-defined
Client failover, master on write, transaction aware, ... Replication and Load Balancing -> Presentation -> Documentation MySQL Server 1 MySQL Server 2 MySQL Server n
The speaker says... The Replication and Load Balancing plugin (mysqlnd_ms)  has been designed as a drop-in solution. For simple use cases no application changes are required when stepping up from a single MySQL server to a MySQL replication cluster.  Advanced users can overwrite all automatic decisions of the plugin to handle arbitrary complex use cases. Goodies built-in to version 1.1.1 (early - more to come!) include use of master after first write to fight replication lag, transaction awareness and use of master, optional failover.
Transparent and fast TTL-based client-side cache Cache control: TTL using SQL hint, user-defined, all
Storage: Memcache, SHM (APC), memory, user, ...

More Related Content

ODP
PHP mysqlnd connection multiplexing plugin
ODP
NoSQL in MySQL
ODP
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
ODP
Vote NO for MySQL
ODP
The mysqlnd replication and load balancing plugin
ODP
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
ODP
Data massage: How databases have been scaled from one to one million nodes
ODP
MySQL 5.7 clustering: The developer perspective
PHP mysqlnd connection multiplexing plugin
NoSQL in MySQL
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
Vote NO for MySQL
The mysqlnd replication and load balancing plugin
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
Data massage: How databases have been scaled from one to one million nodes
MySQL 5.7 clustering: The developer perspective

What's hot (20)

ODP
MySQL 5.6 Global Transaction Identifier - Use case: Failover
ODP
MySQL 5.6 Global Transaction IDs - Use case: (session) consistency
ODP
Built-in query caching for all PHP MySQL extensions/APIs
PDF
DIY: A distributed database cluster, or: MySQL Cluster
ODP
MySQL Group Replication
PDF
HTTP Plugin for MySQL!
KEY
Intro to PECL/mysqlnd_ms (4/7/2011)
ODP
PoC: Using a Group Communication System to improve MySQL Replication HA
ODP
MySQL? Load? Clustering! Balancing! PECL/mysqlnd_ms 1.4
ODP
Award-winning technology: Oxid loves the query cache
PDF
Highly Available MySQL/PHP Applications with mysqlnd
PDF
MySQL Group Replication
PPTX
MySQL Multi Master Replication
PDF
Introduction to Galera
PDF
MySQL X protocol - Talking to MySQL Directly over the Wire
PDF
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
PDF
Introduction to Galera Cluster
PDF
MySQL Group Replication - an Overview
PDF
Scaling with sync_replication using Galera and EC2
PPTX
Active mq Installation and Master Slave setup
MySQL 5.6 Global Transaction Identifier - Use case: Failover
MySQL 5.6 Global Transaction IDs - Use case: (session) consistency
Built-in query caching for all PHP MySQL extensions/APIs
DIY: A distributed database cluster, or: MySQL Cluster
MySQL Group Replication
HTTP Plugin for MySQL!
Intro to PECL/mysqlnd_ms (4/7/2011)
PoC: Using a Group Communication System to improve MySQL Replication HA
MySQL? Load? Clustering! Balancing! PECL/mysqlnd_ms 1.4
Award-winning technology: Oxid loves the query cache
Highly Available MySQL/PHP Applications with mysqlnd
MySQL Group Replication
MySQL Multi Master Replication
Introduction to Galera
MySQL X protocol - Talking to MySQL Directly over the Wire
MySQL High Availability: Managing Farms of Distributed Servers (MySQL Fabric)
Introduction to Galera Cluster
MySQL Group Replication - an Overview
Scaling with sync_replication using Galera and EC2
Active mq Installation and Master Slave setup
Ad

Similar to MySQL native driver for PHP (mysqlnd) - Introduction and overview, Edition 2011 (20)

ODP
The power of mysqlnd plugins
PDF
Mysqlnd, an unknown powerful PHP extension
PDF
Scaling symfony apps
PPT
Introduction to OpenHFT for Melbourne Java Users Group
PPTX
OS for AI: Elastic Microservices & the Next Gen of ML
PPT
Performance and Scalability
PDF
ansible_rhel.pdf
PPTX
Serverless Functions and Machine Learning: Putting the AI in APIs
PDF
Scaling PHP apps
PPT
Open HFT libraries in @Java
PDF
PHP Basics
PPT
Drupalcamp Estonia - High Performance Sites
PPT
Drupalcamp Estonia - High Performance Sites
PDF
bigdata 2022_ FLiP Into Pulsar Apps
PPTX
LAMP TECHNOLOGY
PDF
Machine Intelligence Guild_ Build ML Enhanced Event Streaming Applications wi...
PDF
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
PPT
Lamp Zend Security
PDF
Headless approach for offloading heavy tasks in Magento
PDF
Php mysql-tutorial-en
The power of mysqlnd plugins
Mysqlnd, an unknown powerful PHP extension
Scaling symfony apps
Introduction to OpenHFT for Melbourne Java Users Group
OS for AI: Elastic Microservices & the Next Gen of ML
Performance and Scalability
ansible_rhel.pdf
Serverless Functions and Machine Learning: Putting the AI in APIs
Scaling PHP apps
Open HFT libraries in @Java
PHP Basics
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
bigdata 2022_ FLiP Into Pulsar Apps
LAMP TECHNOLOGY
Machine Intelligence Guild_ Build ML Enhanced Event Streaming Applications wi...
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
Lamp Zend Security
Headless approach for offloading heavy tasks in Magento
Php mysql-tutorial-en
Ad

More from Ulf Wendel (6)

ODP
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
ODP
PHPopstar der PHP Unconference 2011
ODP
Mysqlnd query cache plugin benchmark report
ODP
mysqlnd query cache plugin: user-defined storage handler
ODP
Mysqlnd query cache plugin statistics and tuning
ODP
Mysqlnd Async Ipc2008
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
PHPopstar der PHP Unconference 2011
Mysqlnd query cache plugin benchmark report
mysqlnd query cache plugin: user-defined storage handler
Mysqlnd query cache plugin statistics and tuning
Mysqlnd Async Ipc2008

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

MySQL native driver for PHP (mysqlnd) - Introduction and overview, Edition 2011

  • 1. Ulf Wendel, Oracle Introduction and overview, Edition 2011 The MySQL native driver for PHP (mysqlnd)
  • 2. The speaker says... The MySQL native driver for PHP (mysqlnd) is a drop-in replacement for the MySQL Client Library (AKA libmysql). All PHP MySQL extensions can be compiled to use mysqlnd instead of libmysql. The mysqlnd library ships with PHP as PHP 5.3. Mysqlnd is part of the PHP source tree and distributed under the terms of the PHP license to avoid any license issues. PHP builds for Windows obtained from php.net use mysqlnd since PHP 5.3. Mysqlnd is a compile time default for all PHP MySQL extensions as of PHP 5.4.
  • 3. New, unmatched features Plugin API for extensions – client-side proxies
  • 5. Performance statistics, read-only variables, ... The mysqlnd library MySQL Server
  • 6. The speaker says... The mysqlnd library implements the MySQL Client Server protocol. All three PHP MySQL extensions can be compiled to use it to communicate with MySQL. Mysqlnd is tightly integrated into PHP and highly optimized for it. Therefore, it can outperform the MySQL Client Library in certain areas. The MySQL Client Library is a general purpose library for all kinds of C/C++ clients. As such, it cannot offer all mysqlnd features. For example, memory savings by read-only variables (transparent for users) or respect of PHP memory limits is not possible without tight integration into PHP.
  • 7. Open source plugins available from PECL mysqlnd_ms – Replication and Load Balancing
  • 9. mysqlnd_uh – Monitoring, rewriting, ... with PHP
  • 10. Prototypes: SQL injection protection, multi-query, ... Plugin API for extensions -> Presentation -> Documentation
  • 11. The speaker says... A C plugin API is available for extending the mysqlnd C library. Open source, ready-to-use plugins are available from PECL. Plugins for MySQL replication and load balancing support (mysqlnd_ms), a client-side query cache (mysqlnd_qc), a swiss-army-knife plugin (mysqlnd_uh) which allows writing plugins with PHP for easy query monitoring, query rewriting and more. Plugins are client-side proxies. They operate on their own layer below the application. Plugins can be drop-in solutions requiring no application changes!
  • 12. MySQL Replication support drop-in solution Read/write splitting: automatic, user-defined
  • 13. Load Balancing: round robin, random, user-defined
  • 14. Client failover, master on write, transaction aware, ... Replication and Load Balancing -> Presentation -> Documentation MySQL Server 1 MySQL Server 2 MySQL Server n
  • 15. The speaker says... The Replication and Load Balancing plugin (mysqlnd_ms) has been designed as a drop-in solution. For simple use cases no application changes are required when stepping up from a single MySQL server to a MySQL replication cluster. Advanced users can overwrite all automatic decisions of the plugin to handle arbitrary complex use cases. Goodies built-in to version 1.1.1 (early - more to come!) include use of master after first write to fight replication lag, transaction awareness and use of master, optional failover.
  • 16. Transparent and fast TTL-based client-side cache Cache control: TTL using SQL hint, user-defined, all
  • 17. Storage: Memcache, SHM (APC), memory, user, ...
  • 18. Slam/overload detection, no-double serialization, ... Client-side cache -> Presentation -> Documentation MySQL Server Memcache SHM (APC), ...
  • 19. The speaker says... PECL/mysqlnd_qc is an easy to use client-side query cache. The cache is TTL based. Cached query results can be stored in various places: Memcache, shared memory (APC), process memory, SQLite or user-defined. Depending on the storage the cache results can be shared within the PHP process, all PHP processes running on a server or multiple servers. Caching is controlled with SQL hints. Optionally, all queries can be cache or a callback can be installed to control caching. The plugin is faster than any PHP solution by avoiding double-serialization. Goodies built-in to version 1.0.1 (early - more to come!) include slam protection ala Memcache and variable storage.
  • 20. Swiss-army-knife for debugging and prototyping Hooking of mysqlnd library calls with PHP
  • 21. 'Plugins' with PHP not C, no application changes
  • 22. Monitoring, Rewriting, Failover, you-name-it... User handler -> Presentation -> Documentation MySQL Server
  • 23. The speaker says... PECL/mysqlnd_uh is the swiss-army knife of the plugins. Developed by Mayflower Open Source Labs, it lets you hook internal mysqlnd library calls from PHP! In other words: you can manipulate many library calls, such as connect() or query(), to write client-side proxies that work around application limitations. Use cases include query monitoring, query rewriting, auditing, failover, … Consider it, whenever you need a quick hack and you can't change the applications source code. It is best used for debugging and prototyping. Take care when using: you are hacking mysqlnd!
  • 24. Non-blocking queries with mysqli @ mysqlnd Non-blocking time: max(t1, t2, ..., tn)
  • 25. Blocking time always higher: t1 + t2 + … + tn
  • 26. Perfect for application-level sharding! Asynchronous queries -> Presentation -> Documentation
  • 27. The speaker says... The mysqlnd library features non-blocking queries. A PHP script can perform other tasks, while waiting for a query result to be computed by MySQL. For example, the script can open additional connections to send additional statements. The total processing time for all statements performed in a non-blocking stlye is the run-time of the slowest statement. This is always faster than running statements in a blocking way, when individual run-times add up to the total run-time. Typical use-case: application-level sharding. Query multiple shards in a non-blocking way without extra message queue!
  • 28. Unique to mysqlnd... 150+ core performance statistics
  • 29. 30+ query cache performance statistics
  • 30. read-only variable concept for memory savings
  • 32. … find documentation: php.net/
  • 33. … read development blogs: planet.mysql.com
  • 34. … read more development blogs: planet-php.org
  • 35. … follow on Twitter: @phperror , @Ulf_Wendel Other goodies
  • 36. The speaker says... The mysqlnd library and its plugins are under constant development. It is well worth checking the documentation at php.net frequently for updates. It is even better to scan planet.mysql.com and planet-php.org. The mysqlnd developers try to blog and twitter about ideas, prototypes and latest developments, seeking for early feedback. However, if you are seriously interested in contacting us, which we hope you are, it should not be difficult to get in touch. Personally and virtually. Looking forward to answer your mysqlnd requests!
  • 37. THE END Credits: Andrey Hristov, Johannes Schlüter - Contact: ulf.wendel@oracle.com