SlideShare ist ein Scribd-Unternehmen logo
1 von 92
Award-winning technology Fast, faster, fastest – limited seats!
Ulf Wendel,  MySQL/Sun/Oracle/TellMeWhatIsNext Environmental friendly technology Plugins: easy, fast, secure
The speaker says... Fun is a function of performance. Performance gains, performance wins are one of the primary purposes of a cache. Before we look at the mysqlnd cache plugin, let's see some performance figures. Maybe, you'll smile about any benchmark you read in the future.
Performance: open 24h „ Your ultimate OpenSource  Shopsoftware E-Commerce solution for growth and profitability.“  http://www.oxid-esales.com/
PHP 5.2.15-dev ,[object Object],RES 22...23m ./configure' '--with-mysql=/usr/local/mysql/' '--with-gd'  '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs' 100%
The speaker says... We are benchmarking Oxid on a dated two machines setup.  One machine runs Apache 2.2.15 + PHP, the other machine runs MySQL 5.1.25-rc.  Our hardware consists of two machines with using dual-core x86_64 CPUs. We run on Linux, have 4GB RAM and use RAID-0. The machines are connected via a 1GBit ethernet. The webserver is CPU saturated. The database server is bored...  - no CPU, no I/O wait. Network latency <0.2ms. Benchmark: ab -n600 -c8 http://127.0.0.1/oxid
PHP 5.2.15-dev ,[object Object],RES 22...23m './configure' '--with-mysql=/usr/local/mysql/' '--with-gd'  '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc '  161%
The speaker says... Add 14 charachters, get  61% performance gain! Use byte-code caches, simple as that! Your http-workers don't increase in size and the memory required by the byte-code cache is irrelevant. Do you smell the blood? Let's use fresh meat!
PHP 5.3.4-dev ,[object Object],RES 22...29m './configure' '--with-mysql=/usr/local/mysql/' '--with-gd'  '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc '  173%
The speaker says... 73 % performance gain, if you step up to PHP 5.3 ! The fresh and tasty meat is waiting for you. Honestly, try PHP 5.3. Make the life of the php.net developers easier. Be brave, forget about „never touch a runnning systems“. Security and performance are good reasons to eat fresh meat. Anyway, what can MySQL do for Oxid, any MySQL contributions to PHP 5.3? Sure!
The MySQL native driver for PHP Server API (SAPI) CGI CLI Embed ISAPI NSAPI phttpd thttpd ... Zend Engine PHP Runtime PHP Extensions bcmath mysql mysqli mysqlnd pdo pdo_mysql xml ...
The speaker says... The MySQL native driver for PHP (mysqlnd) is a C library which implements the MySQL Client Server Protocol.  It serves as a drop-in replacement for the MySQL Client Library   (AKA libmysqlclient  AKA Connector/C). mysqlnd is part of the PHP source code repository as of PHP 5.3.  Every PHP source code distribution contains it. mysqlnd is is a special kind of PHP extension. Like ext/PDO it does not export any userland functions.  It serves as a C library for other extensions , like ext/PDO.
Replacement for libmysql $mysqli = new mysqli(...); $mysql = mysql_connect(...); $pdo = new PDO(...);
The speaker says... All PHP-MySQL APIs can either make use of the MySQL Client Library or mysqlnd to connect to MySQL.  The decision to use one or the other library is made at compile time. Within a PHP binary you can mix mysqlnd and the MySQL Client Library as you like: one PHP MySQL API may use mysqlnd and another PHP MySQL extension may use the MySQL Client Library. To use the MySQL Client Library, you must have it installed on your system (at least when building PHP), whereas mysqlnd ships with PHP and thus has no pre-requisites.
PHP 5.3.4-dev ,[object Object],RES 23...27m './configure' ' --with-mysql=mysqlnd ' '--with-gd'  '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc '  180%
The speaker says... Strike - 80 % performance gain! That is 7% more than before. Unexpected, though. You can expect mysqlnd to be about as fast as libmysql. It really depends on the benchmark. If, for example, I use -c4 instead of -c8 and the webserver is not CPU bound, the results flip around: libmysql is a little faster than mysqlnd. That's a bit like with MySQL 5.5. I'm using MySQL 5.1 here because MySQL 5.5 turned out to be slower in my setup. MySQL 5.5 is optimized for high concurrent loads, but MySQL is not the bottle-neck in my setup...
How to grow/extend mysqlnd
The speaker says... The core feature set of mysqlnd is defined by the MySQL Client Libary feature set. It has taken about 15k lines of C (without comments) to implement the core functionality.  Further growth will complicate maintenance. Further growth will hinder an understanding of the code base.  mysqlnd growth must be stopped without preventing the addition of new features.  Some new features may be far beyond mainstream user requirements. Good reasons to introduce mysqlnd &quot;plugins&quot;. Plugins can hook and replace all mysqlnd C API calls.
What mysqlnd plugins can do!
The speaker says... A different way to name the plugin concept is to call it a &quot;mysqlnd client proxy&quot;.  From a PHP application point of view plugins can do everything that can be done using the MySQL Proxy product. For example : ,[object Object]
Failover
Round-Robin, least loaded ,[object Object],[object Object]
Query Analysis
Query Auditing ,[object Object],[object Object]
Throttling
Sharding
PHP 5.3.4-dev ,[object Object],RES 23...29m './configure' ' --with-mysql=mysqlnd ' ' --with-mysqli=mysqlnd '  '--with-gd' '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc ' ' --enable-mysqlnd-uh '  173%
The speaker says... Uuups... that mysqlnd_uh plugin is slow! Thank you David Sorria Para from Mayflower for making PHP slower! The performance benefit of mysqlnd over libmysql is lost.
PHP 5.3.4-dev ,[object Object],RES 23...29m './configure' ' --with-mysql=mysqlnd ' ' --with-mysqli=mysqlnd '  '--with-gd' '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc ' ' --enable-mysqlnd-uh '  ' --enable-mysqlnd-qc ' ' --enable-mysqlnd-qc-apc '
The speaker says... Uuups... that mysqlnd_qc plugin is slow! Thank you Andrey Hristov and Ulf Wendel from Oracle for developing a cache that makes PHP even slower!
PHP 5.3.4-dev ,[object Object],RES 23...29m './configure' ' --with-mysql=mysqlnd ' ' --with-mysqli=mysqlnd '  '--with-gd' '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc ' ' --enable-mysqlnd-uh '  ' --enable-mysqlnd-qc ' ' --enable-mysqlnd-qc-apc '  168%
The speaker says... Wait, have traded-in some 5% performance loss compared to libmysql for a new feature. The new feature is user space query monitoring.  The benchmark shows Oxid running with a simplictic query monitor. The query monitor logs all queries run by Oxid and prints outs the total number of queries and distinct queries at the end of the web page.
PHP 5.3.4-dev ,[object Object],RES 26...31m './configure' ' --with-mysql=mysqlnd ' ' --with-mysqli=mysqlnd '  '--with-gd' '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc ' ' --enable-mysqlnd-uh '  ' --enable-mysqlnd-qc ' ' --enable-mysqlnd-qc-apc '  mysqlnd_qc.cache_by_default = 1 188%
The speaker says... The client-side query cache is now turned on. What we see is about the maximum performance gain can get from client side query caching in this scenario: 88% performance win.  mysqlnd_qc.cache_by_default does cache all queries for mysqlnd_qc.ttl seconds. This setting is not recommended for production environments. Its is for development to estimate the maximum performance gain.
PHP 5.3.4-dev ,[object Object],RES 25...30m './configure' ' --with-mysql=mysqlnd ' ' --with-mysqli=mysqlnd '  '--with-gd' '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc ' ' --enable-mysqlnd-qc ' ' --enable-mysqlnd-qc-apc '  mysqlnd_qc.cache_by_default = 1 mysqlnd_qc.cache_no_table = 1 194%
The speaker says... End of the PHP 5.3 game: 94% performance win. mysqlnd_qc.cache_no_table will cache even those queries which query no table, such as SELECT NOW(). In most cases this setting is out of question: don't use it.
PHP 5.3.99-dev ,[object Object],RES 23...35m './configure' ' --with-mysql=mysqlnd ' ' --with-mysqli=mysqlnd '  '--with-gd' '--with-jpeg-dir=/usr/lib64/' '--with-png-dir=/home/nixnutz/ftp/libpng-1.4.4/install' '--enable-mbstring' '--with-curl' '--enable-bcmath' '--with-apxs2=/usr/local/apache2/bin/apxs'  ' --enable-apc ' ' --enable-mysqlnd-qc ' ' --enable-mysqlnd-qc-apc '  mysqlnd_qc.cache_by_default = 1 mysqlnd_qc.cache_no_table = 1 249%
The speaker says... The future is bright: 149% performance win! Recall how we got here. We did nothing but use the latest software. We have not modified Oxid, we have not made future updates of Oxid a hassle because of potential add-ons and custom additions. We have compiled a custom version of PHP which powers PECL/mysqlnd_qc. We have set two php.ini configuration settings. That's it.
PHP 6.0.6-dev ,[object Object],RES 10...11m There's no PHP 6.0 because there is no MySQL 6.0! BULLSHIT BINGO !
The speaker says... Just kidding. However, the previous PHP 5.3.99-dev figure is no fake. Well done, Zend guys!
Performance wins Setup Win 5.2.15-dev + libmysql 0 % 5.2.15-dev + libmysql + APC 61 % 5.3.4-dev + libmysql + APC 73 % 5.3.4-dev + mysqlnd + APC 80 % 5.3.4-dev + mysqlnd + APC + monitor (off) 73 % 5.3.4-dev + mysqlnd + APC + monitor (off) + cache (off) 68 % 5.3.4-dev + mysqlnd + APC + monitor (on) + cache (off) 67 % 5.3.4-dev + mysqlnd + APC + monitor (off) + cache (on) 93 % 5.3.99-dev + mysqlnd + APC + monitor (off) + cache (on) 149 %
The speaker says... 93 % - 60 % = 33 %  - disappointing and expected! The web server is CPU bound. The impact of the database queries on the total CPU consumption is rather small. We save very little, although we save some query time. The database server CPU is 90% idle. Queries are served mostly from main memory buffers. The 1GBit network is idle. It has a latency of <0.2ms.
Tuning the client-side cache
The speaker says... Almost 200% performance win! Same hardware, same software, same query cache configuration. Still a two machine setup, still PHP 5.3.4-dev using APC.  A minor variation on using Apache bench: ab -n80 -c8 http://127.0.0.1/oxid
X factor: network latency Latency (ms) No cache (R/s) Cache (default) Cache (APC) 5 3,72 7,11 7,71 10 ,[object Object],5,35 6,34 50 0,60 1,16 1,76 100 0,31 0,35 0,68 ,[object Object]
The speaker says... Forget about the benchmarks: what if, for example, we use ab -c32 ? The CPU is idle with all the network wait times. Run your own tests! Too many variables! The benchmark demostrates the difference between a client and a server-side cache.  The MySQL Server Query Cache will not help you much, if the client-server connection is slow.  The mysqlnd_qc plugin gives you a significant boost:  move the cache to the client! In 2003 Rasmus said something like  „they are *** stupid not to have the cache in the driver.“  - we listened...
PECL/mysqlnd_qc at a glance Supports Oxid eShop, supports any PHP MySQL application!
PECL/mysqlnd_qc
The speaker says... PECL/mysqlnd_qc is a basic client side query cache. The default invalidation method is TTL. The limitation can be lifted with user defined storage handler. Build-in storage handler support local memory, APC, Memcache and SQLite. Multiple query cache prototypes had been developed before. None got published because all of them had been too complicated.  PECL/mysqlnd_qc is way more elegant and simpler: it caches raw wire protocol data. On a cache hit it replays the raw data. This is much easier than serializing and deserializing result sets of PHP variables (zvals).
Key Features PECL/mysqlnd_qc ,[object Object],[object Object]
Supports ext/mysql
Supports PDO_MySQL ,[object Object],[object Object]
Custom: user callbacks ,[object Object],[object Object]
Custom: user callbacks
The speaker says... PECL/mysqlnd_qc  shares the basic design with the much older  PEAR_Cache – a generic cache, written in PHP, to store arbitrary data.  Both offer flexible storage and default to TTL invalidation strategy but can easily be expanded.
Possibly asked questions (PAQ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The speaker says... There is one important change over previous talks and presentations: we do support prepared statements! As of two days after the initial release and the publication of the first presentations.
Basic Usage $mysqli = new mysqli($host, $user, $pw, $db, $port, $sock); /* Cached for mysqlnd_qc.ttl seconds */ $sql = sprintf(&quot;/*%s*/SELECT id, label FROM test&quot;, MYSQLND_QC_ENABLE_SWITCH); $res = $mysqli->query($sql); var_dump($res->fetch_all(MYSQLI_ASSOC)); $res->free(); /* Not cached */ $sql = &quot;SELECT id, label FROM test&quot;; $res = $mysqli->query($sql); var_dump($res->fetch_all(MYSQLI_ASSOC)); $res->free();
The speaker says... Somehow we need to tell the query cache which query to cache. SQL hints are a very simple solution. If you do not want to change any code in your application but turn on caching only for selected queries, read below. Check the examples at the end of the presentation.
SQL hints to control the cache ,[object Object],[object Object]
Query must start with hint: /*qc=on*/SELECT ,[object Object],[object Object]
Overrules mysqlnd_qc.cache_by_default = 1 ,[object Object],[object Object]
Overrules mysqlnd_qc.ttl
Vs. MySQL Server Query Cache
The speaker says... When talking about differences between a server-side solution and a client-side solution, for example PECL/mysqlnd_qc, it always boils down to the same arguments: ,[object Object]
Scale out hoizontally by adding more clients
Short distance to cache: lower latency
Lower server load To be fair: PECL/mysqlnd_qc uses TTL by default. The server cache never serves stale data.
Vs. Memcache: serializations
The speaker says... PECL/mysqlnd_qc can use Memcache as a storage medium. An application based cache, such as PEAR/Cache, can do the same. None has the edge. PECL/mysqlnd_qc will store raw wire data in Memcache. With PECL/mysqlnd_qc you get three data transformations, three serializations: MySQL intern -> Wire data -> PHP variable. The application based requires additional serializsations: MySQL intern -> Wire data -> PHP variable -> String (-> PHP variable).
Vs Proxy: Single Point of Failure
The speaker says... Topology:  MySQL Proxy can either be installed on the PHP application server or be run on a dedicated machine. Multiple clients connect to it. A mysqlnd plugin is part of the client. It operates on and within the client.  Plugin advantages: ,[object Object]
Horizontal scale out, scale by client
No concurrency issues
Use existing deployment infrastructure
Commercials
The speaker says... This presentation was given at the 10 th  aniversary of the PHP Conference. At some point, during the first edition, Björn Schotte asked to close the doors of the main presentation room. People in the back started to joke: Ferengi is talking – sales will start now, he does not want anybody to be able to leave the room. So, if Commericals have a tradition. Let's see some commercials.  Note the comment in the lower left. There are some 40-50 PHP slots in total at the 10 th  conference...
thePHP.cc In times of tight budgets, quality is a key success factor to reduce risks in IT projects. We help businesses and enterprises to reduce IT costs in the long term with Open Source technologies and PHP in particular. [email_address] 11 slots + 1 commercial
A closer look at the query cache Storage handler,  slam defense and statistics.
Storage handler responsibilities ,[object Object],[object Object]
Location: distance to cache
Replacement strategy
Slam defense strategy ,[object Object],[object Object],[object Object],[object Object]
The speaker says... Caches can be shared to a different degree between clients.  Some caches are available to the current process, resulting in a low re-use figure of cache entries, others are shared among multiple processes or even machines. Those shared among machines usually add latency. The is_select() method of a storage handler gets asked for every query if it shall be cached or not.  User-defined storage handler use is_select() to implement whatever invalidation strategy they want. See below.
No rush Concurrency # queries # distinct queries % DB runtime 1 330 297 46% 2 330 297 64% 3 330 297 85% 4 330 297 91% 5 330 297 91% 6 330 297 83% Total Many Many Significant 1  An application developed by the presenter in 2004 has run  several thousand queries per page load 2  A HTML forms library developed by the presenter in 2001 has used  sessions of a size >1MB
The speaker says... Almost 200% performance win! Same hardware, same software, same query cache configuration, still a two machine setup, still PHP 5.3.4-dev using APC.  A minor variation on using Apache bench: ab -n80 -c8 http://127.0.0.1/oxid
S.O.S – cache entry expires
The speaker says... Plan your cache strategy carefully!  If not properly planned, caching can be counter productive. For example, test what happens if a very popular cache entry used by many clients expires. For the time it takes to refresh the cache entry all clients formerly using the invalidated cache entry will contact the database. The load of the MySQL server will increase suddenly – MySQL will be slammed. Due to the high load it takes longer and longer to refresh the cache entry. MySQL gets overloaded: a spiral to death.
Slam defense: serve stale! Refresh
The speaker says... To avoid slamming the MySQL Server the query cache plugin has a special TTL based slam protection operation mode.  If a client hits an expired cache entry (cache miss) and slam protection is turned on the client gets a cache miss but the cache entry lifetime will be extended by a configurable time. All other clients also using the expired cache entry will get a cache hit because of the extended  lifetime. Only the first client, which got a cache miss, contacts the MySQL Server to refresh the expired cache entry. Ideally, it will refresh the expired cache entry before the extended lifetime ends and MySQL does not get slammed because of a sudden massive load.
The 150+ statistics of mysqlnd ,[object Object],php.net/manual/en/mysqlnd.stats.php ,[object Object],[object Object]
Connection: mysqli_get_connection_stats() ,[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQLUlf Wendel
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesUlf Wendel
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsUlf Wendel
 
Highly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlndHighly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlndJervin Real
 
HTTP Plugin for MySQL!
HTTP Plugin for MySQL!HTTP Plugin for MySQL!
HTTP Plugin for MySQL!Ulf Wendel
 
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding Ulf Wendel
 
NoSQL in MySQL
NoSQL in MySQLNoSQL in MySQL
NoSQL in MySQLUlf Wendel
 
MySQL 5.6 Global Transaction IDs - Use case: (session) consistency
MySQL 5.6 Global Transaction IDs - Use case: (session) consistencyMySQL 5.6 Global Transaction IDs - Use case: (session) consistency
MySQL 5.6 Global Transaction IDs - Use case: (session) consistencyUlf Wendel
 
DIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterDIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterUlf Wendel
 
MySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveMySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveUlf Wendel
 
MHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirksMHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirksColin Charles
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group ReplicationUlf Wendel
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to GaleraHenrik Ingo
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group ReplicationManish Kumar
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleFederico Razzoli
 
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationPercona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationKenny Gryp
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMakerKris Buytaert
 
Active mq Installation and Master Slave setup
Active mq Installation and Master Slave setupActive mq Installation and Master Slave setup
Active mq Installation and Master Slave setupRamakrishna Narkedamilli
 

Was ist angesagt? (20)

Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQL
 
Data massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodesData massage: How databases have been scaled from one to one million nodes
Data massage: How databases have been scaled from one to one million nodes
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIs
 
Highly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlndHighly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlnd
 
HTTP Plugin for MySQL!
HTTP Plugin for MySQL!HTTP Plugin for MySQL!
HTTP Plugin for MySQL!
 
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
 
NoSQL in MySQL
NoSQL in MySQLNoSQL in MySQL
NoSQL in MySQL
 
MySQL 5.6 Global Transaction IDs - Use case: (session) consistency
MySQL 5.6 Global Transaction IDs - Use case: (session) consistencyMySQL 5.6 Global Transaction IDs - Use case: (session) consistency
MySQL 5.6 Global Transaction IDs - Use case: (session) consistency
 
Scaling symfony apps
Scaling symfony appsScaling symfony apps
Scaling symfony apps
 
DIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL ClusterDIY: A distributed database cluster, or: MySQL Cluster
DIY: A distributed database cluster, or: MySQL Cluster
 
MySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveMySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspective
 
MHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirksMHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirks
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with Ansible
 
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationPercona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
Active mq Installation and Master Slave setup
Active mq Installation and Master Slave setupActive mq Installation and Master Slave setup
Active mq Installation and Master Slave setup
 

Andere mochten auch

Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Bastian Hofmann
 
Creating Clean Code with AOP
Creating Clean Code with AOPCreating Clean Code with AOP
Creating Clean Code with AOPRobert Lemke
 
Distributed Identities with OpenID
Distributed Identities with OpenIDDistributed Identities with OpenID
Distributed Identities with OpenIDBastian Hofmann
 
Creating Clean Code with AOP
Creating Clean Code with AOPCreating Clean Code with AOP
Creating Clean Code with AOPRobert Lemke
 
Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)Stefan Koopmanschap
 

Andere mochten auch (6)

Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands
 
Creating Clean Code with AOP
Creating Clean Code with AOPCreating Clean Code with AOP
Creating Clean Code with AOP
 
Distributed Identities with OpenID
Distributed Identities with OpenIDDistributed Identities with OpenID
Distributed Identities with OpenID
 
Creating Clean Code with AOP
Creating Clean Code with AOPCreating Clean Code with AOP
Creating Clean Code with AOP
 
Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)
 
jQuery's Secrets
jQuery's SecretsjQuery's Secrets
jQuery's Secrets
 

Ähnlich wie Award-winning technology: Oxid loves the query cache

Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and ScalabilityMediacurrent
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Yiwei Ma
 
Modernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & BowerModernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & BowerAlan Crissey
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Wim Godden
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.DrupalCampDN
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Chef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructureChef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructureMichaël Lopez
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Yiwei Ma
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineNGINX, Inc.
 
Securing Your Web Server
Securing Your Web ServerSecuring Your Web Server
Securing Your Web Servermanugoel2003
 
9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linuxchinkshady
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPressvnsavage
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloudTahsin Hasan
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudSalesforce Developers
 
php & performance
 php & performance php & performance
php & performancesimon8410
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Serversupertom
 

Ähnlich wie Award-winning technology: Oxid loves the query cache (20)

Performance and Scalability
Performance and ScalabilityPerformance and Scalability
Performance and Scalability
 
Drupal development
Drupal development Drupal development
Drupal development
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
Modernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & BowerModernizing Your WordPress Workflow with Grunt & Bower
Modernizing Your WordPress Workflow with Grunt & Bower
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Chef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructureChef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructure
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册
 
Triple Blitz Strike
Triple Blitz StrikeTriple Blitz Strike
Triple Blitz Strike
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 
Securing Your Web Server
Securing Your Web ServerSecuring Your Web Server
Securing Your Web Server
 
9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
php & performance
 php & performance php & performance
php & performance
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Server
 

Mehr von Ulf Wendel

HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLHTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLUlf Wendel
 
PHPopstar der PHP Unconference 2011
PHPopstar der PHP Unconference 2011PHPopstar der PHP Unconference 2011
PHPopstar der PHP Unconference 2011Ulf Wendel
 
The power of mysqlnd plugins
The power of mysqlnd pluginsThe power of mysqlnd plugins
The power of mysqlnd pluginsUlf Wendel
 
Mysqlnd query cache plugin benchmark report
Mysqlnd query cache plugin benchmark reportMysqlnd query cache plugin benchmark report
Mysqlnd query cache plugin benchmark reportUlf Wendel
 
mysqlnd query cache plugin: user-defined storage handler
mysqlnd query cache plugin: user-defined storage handlermysqlnd query cache plugin: user-defined storage handler
mysqlnd query cache plugin: user-defined storage handlerUlf Wendel
 
Mysqlnd query cache plugin statistics and tuning
Mysqlnd query cache plugin statistics and tuningMysqlnd query cache plugin statistics and tuning
Mysqlnd query cache plugin statistics and tuningUlf Wendel
 
Mysqlnd Async Ipc2008
Mysqlnd Async Ipc2008Mysqlnd Async Ipc2008
Mysqlnd Async Ipc2008Ulf Wendel
 

Mehr von Ulf Wendel (7)

HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLHTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
 
PHPopstar der PHP Unconference 2011
PHPopstar der PHP Unconference 2011PHPopstar der PHP Unconference 2011
PHPopstar der PHP Unconference 2011
 
The power of mysqlnd plugins
The power of mysqlnd pluginsThe power of mysqlnd plugins
The power of mysqlnd plugins
 
Mysqlnd query cache plugin benchmark report
Mysqlnd query cache plugin benchmark reportMysqlnd query cache plugin benchmark report
Mysqlnd query cache plugin benchmark report
 
mysqlnd query cache plugin: user-defined storage handler
mysqlnd query cache plugin: user-defined storage handlermysqlnd query cache plugin: user-defined storage handler
mysqlnd query cache plugin: user-defined storage handler
 
Mysqlnd query cache plugin statistics and tuning
Mysqlnd query cache plugin statistics and tuningMysqlnd query cache plugin statistics and tuning
Mysqlnd query cache plugin statistics and tuning
 
Mysqlnd Async Ipc2008
Mysqlnd Async Ipc2008Mysqlnd Async Ipc2008
Mysqlnd Async Ipc2008
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Award-winning technology: Oxid loves the query cache

  • 1. Award-winning technology Fast, faster, fastest – limited seats!
  • 2. Ulf Wendel, MySQL/Sun/Oracle/TellMeWhatIsNext Environmental friendly technology Plugins: easy, fast, secure
  • 3. The speaker says... Fun is a function of performance. Performance gains, performance wins are one of the primary purposes of a cache. Before we look at the mysqlnd cache plugin, let's see some performance figures. Maybe, you'll smile about any benchmark you read in the future.
  • 4. Performance: open 24h „ Your ultimate OpenSource Shopsoftware E-Commerce solution for growth and profitability.“ http://www.oxid-esales.com/
  • 5.
  • 6. The speaker says... We are benchmarking Oxid on a dated two machines setup. One machine runs Apache 2.2.15 + PHP, the other machine runs MySQL 5.1.25-rc. Our hardware consists of two machines with using dual-core x86_64 CPUs. We run on Linux, have 4GB RAM and use RAID-0. The machines are connected via a 1GBit ethernet. The webserver is CPU saturated. The database server is bored... - no CPU, no I/O wait. Network latency <0.2ms. Benchmark: ab -n600 -c8 http://127.0.0.1/oxid
  • 7.
  • 8. The speaker says... Add 14 charachters, get 61% performance gain! Use byte-code caches, simple as that! Your http-workers don't increase in size and the memory required by the byte-code cache is irrelevant. Do you smell the blood? Let's use fresh meat!
  • 9.
  • 10. The speaker says... 73 % performance gain, if you step up to PHP 5.3 ! The fresh and tasty meat is waiting for you. Honestly, try PHP 5.3. Make the life of the php.net developers easier. Be brave, forget about „never touch a runnning systems“. Security and performance are good reasons to eat fresh meat. Anyway, what can MySQL do for Oxid, any MySQL contributions to PHP 5.3? Sure!
  • 11. The MySQL native driver for PHP Server API (SAPI) CGI CLI Embed ISAPI NSAPI phttpd thttpd ... Zend Engine PHP Runtime PHP Extensions bcmath mysql mysqli mysqlnd pdo pdo_mysql xml ...
  • 12. The speaker says... The MySQL native driver for PHP (mysqlnd) is a C library which implements the MySQL Client Server Protocol. It serves as a drop-in replacement for the MySQL Client Library (AKA libmysqlclient AKA Connector/C). mysqlnd is part of the PHP source code repository as of PHP 5.3. Every PHP source code distribution contains it. mysqlnd is is a special kind of PHP extension. Like ext/PDO it does not export any userland functions. It serves as a C library for other extensions , like ext/PDO.
  • 13. Replacement for libmysql $mysqli = new mysqli(...); $mysql = mysql_connect(...); $pdo = new PDO(...);
  • 14. The speaker says... All PHP-MySQL APIs can either make use of the MySQL Client Library or mysqlnd to connect to MySQL. The decision to use one or the other library is made at compile time. Within a PHP binary you can mix mysqlnd and the MySQL Client Library as you like: one PHP MySQL API may use mysqlnd and another PHP MySQL extension may use the MySQL Client Library. To use the MySQL Client Library, you must have it installed on your system (at least when building PHP), whereas mysqlnd ships with PHP and thus has no pre-requisites.
  • 15.
  • 16. The speaker says... Strike - 80 % performance gain! That is 7% more than before. Unexpected, though. You can expect mysqlnd to be about as fast as libmysql. It really depends on the benchmark. If, for example, I use -c4 instead of -c8 and the webserver is not CPU bound, the results flip around: libmysql is a little faster than mysqlnd. That's a bit like with MySQL 5.5. I'm using MySQL 5.1 here because MySQL 5.5 turned out to be slower in my setup. MySQL 5.5 is optimized for high concurrent loads, but MySQL is not the bottle-neck in my setup...
  • 18. The speaker says... The core feature set of mysqlnd is defined by the MySQL Client Libary feature set. It has taken about 15k lines of C (without comments) to implement the core functionality. Further growth will complicate maintenance. Further growth will hinder an understanding of the code base. mysqlnd growth must be stopped without preventing the addition of new features. Some new features may be far beyond mainstream user requirements. Good reasons to introduce mysqlnd &quot;plugins&quot;. Plugins can hook and replace all mysqlnd C API calls.
  • 20.
  • 22.
  • 24.
  • 27.
  • 28. The speaker says... Uuups... that mysqlnd_uh plugin is slow! Thank you David Sorria Para from Mayflower for making PHP slower! The performance benefit of mysqlnd over libmysql is lost.
  • 29.
  • 30. The speaker says... Uuups... that mysqlnd_qc plugin is slow! Thank you Andrey Hristov and Ulf Wendel from Oracle for developing a cache that makes PHP even slower!
  • 31.
  • 32. The speaker says... Wait, have traded-in some 5% performance loss compared to libmysql for a new feature. The new feature is user space query monitoring. The benchmark shows Oxid running with a simplictic query monitor. The query monitor logs all queries run by Oxid and prints outs the total number of queries and distinct queries at the end of the web page.
  • 33.
  • 34. The speaker says... The client-side query cache is now turned on. What we see is about the maximum performance gain can get from client side query caching in this scenario: 88% performance win. mysqlnd_qc.cache_by_default does cache all queries for mysqlnd_qc.ttl seconds. This setting is not recommended for production environments. Its is for development to estimate the maximum performance gain.
  • 35.
  • 36. The speaker says... End of the PHP 5.3 game: 94% performance win. mysqlnd_qc.cache_no_table will cache even those queries which query no table, such as SELECT NOW(). In most cases this setting is out of question: don't use it.
  • 37.
  • 38. The speaker says... The future is bright: 149% performance win! Recall how we got here. We did nothing but use the latest software. We have not modified Oxid, we have not made future updates of Oxid a hassle because of potential add-ons and custom additions. We have compiled a custom version of PHP which powers PECL/mysqlnd_qc. We have set two php.ini configuration settings. That's it.
  • 39.
  • 40. The speaker says... Just kidding. However, the previous PHP 5.3.99-dev figure is no fake. Well done, Zend guys!
  • 41. Performance wins Setup Win 5.2.15-dev + libmysql 0 % 5.2.15-dev + libmysql + APC 61 % 5.3.4-dev + libmysql + APC 73 % 5.3.4-dev + mysqlnd + APC 80 % 5.3.4-dev + mysqlnd + APC + monitor (off) 73 % 5.3.4-dev + mysqlnd + APC + monitor (off) + cache (off) 68 % 5.3.4-dev + mysqlnd + APC + monitor (on) + cache (off) 67 % 5.3.4-dev + mysqlnd + APC + monitor (off) + cache (on) 93 % 5.3.99-dev + mysqlnd + APC + monitor (off) + cache (on) 149 %
  • 42. The speaker says... 93 % - 60 % = 33 % - disappointing and expected! The web server is CPU bound. The impact of the database queries on the total CPU consumption is rather small. We save very little, although we save some query time. The database server CPU is 90% idle. Queries are served mostly from main memory buffers. The 1GBit network is idle. It has a latency of <0.2ms.
  • 44. The speaker says... Almost 200% performance win! Same hardware, same software, same query cache configuration. Still a two machine setup, still PHP 5.3.4-dev using APC. A minor variation on using Apache bench: ab -n80 -c8 http://127.0.0.1/oxid
  • 45.
  • 46. The speaker says... Forget about the benchmarks: what if, for example, we use ab -c32 ? The CPU is idle with all the network wait times. Run your own tests! Too many variables! The benchmark demostrates the difference between a client and a server-side cache. The MySQL Server Query Cache will not help you much, if the client-server connection is slow. The mysqlnd_qc plugin gives you a significant boost: move the cache to the client! In 2003 Rasmus said something like „they are *** stupid not to have the cache in the driver.“ - we listened...
  • 47. PECL/mysqlnd_qc at a glance Supports Oxid eShop, supports any PHP MySQL application!
  • 49. The speaker says... PECL/mysqlnd_qc is a basic client side query cache. The default invalidation method is TTL. The limitation can be lifted with user defined storage handler. Build-in storage handler support local memory, APC, Memcache and SQLite. Multiple query cache prototypes had been developed before. None got published because all of them had been too complicated. PECL/mysqlnd_qc is way more elegant and simpler: it caches raw wire protocol data. On a cache hit it replays the raw data. This is much easier than serializing and deserializing result sets of PHP variables (zvals).
  • 50.
  • 52.
  • 53.
  • 55. The speaker says... PECL/mysqlnd_qc shares the basic design with the much older PEAR_Cache – a generic cache, written in PHP, to store arbitrary data. Both offer flexible storage and default to TTL invalidation strategy but can easily be expanded.
  • 56.
  • 57. The speaker says... There is one important change over previous talks and presentations: we do support prepared statements! As of two days after the initial release and the publication of the first presentations.
  • 58. Basic Usage $mysqli = new mysqli($host, $user, $pw, $db, $port, $sock); /* Cached for mysqlnd_qc.ttl seconds */ $sql = sprintf(&quot;/*%s*/SELECT id, label FROM test&quot;, MYSQLND_QC_ENABLE_SWITCH); $res = $mysqli->query($sql); var_dump($res->fetch_all(MYSQLI_ASSOC)); $res->free(); /* Not cached */ $sql = &quot;SELECT id, label FROM test&quot;; $res = $mysqli->query($sql); var_dump($res->fetch_all(MYSQLI_ASSOC)); $res->free();
  • 59. The speaker says... Somehow we need to tell the query cache which query to cache. SQL hints are a very simple solution. If you do not want to change any code in your application but turn on caching only for selected queries, read below. Check the examples at the end of the presentation.
  • 60.
  • 61.
  • 62.
  • 64. Vs. MySQL Server Query Cache
  • 65.
  • 66. Scale out hoizontally by adding more clients
  • 67. Short distance to cache: lower latency
  • 68. Lower server load To be fair: PECL/mysqlnd_qc uses TTL by default. The server cache never serves stale data.
  • 70. The speaker says... PECL/mysqlnd_qc can use Memcache as a storage medium. An application based cache, such as PEAR/Cache, can do the same. None has the edge. PECL/mysqlnd_qc will store raw wire data in Memcache. With PECL/mysqlnd_qc you get three data transformations, three serializations: MySQL intern -> Wire data -> PHP variable. The application based requires additional serializsations: MySQL intern -> Wire data -> PHP variable -> String (-> PHP variable).
  • 71. Vs Proxy: Single Point of Failure
  • 72.
  • 73. Horizontal scale out, scale by client
  • 75. Use existing deployment infrastructure
  • 77. The speaker says... This presentation was given at the 10 th aniversary of the PHP Conference. At some point, during the first edition, Björn Schotte asked to close the doors of the main presentation room. People in the back started to joke: Ferengi is talking – sales will start now, he does not want anybody to be able to leave the room. So, if Commericals have a tradition. Let's see some commercials. Note the comment in the lower left. There are some 40-50 PHP slots in total at the 10 th conference...
  • 78. thePHP.cc In times of tight budgets, quality is a key success factor to reduce risks in IT projects. We help businesses and enterprises to reduce IT costs in the long term with Open Source technologies and PHP in particular. [email_address] 11 slots + 1 commercial
  • 79. A closer look at the query cache Storage handler, slam defense and statistics.
  • 80.
  • 83.
  • 84. The speaker says... Caches can be shared to a different degree between clients. Some caches are available to the current process, resulting in a low re-use figure of cache entries, others are shared among multiple processes or even machines. Those shared among machines usually add latency. The is_select() method of a storage handler gets asked for every query if it shall be cached or not. User-defined storage handler use is_select() to implement whatever invalidation strategy they want. See below.
  • 85. No rush Concurrency # queries # distinct queries % DB runtime 1 330 297 46% 2 330 297 64% 3 330 297 85% 4 330 297 91% 5 330 297 91% 6 330 297 83% Total Many Many Significant 1 An application developed by the presenter in 2004 has run several thousand queries per page load 2 A HTML forms library developed by the presenter in 2001 has used sessions of a size >1MB
  • 86. The speaker says... Almost 200% performance win! Same hardware, same software, same query cache configuration, still a two machine setup, still PHP 5.3.4-dev using APC. A minor variation on using Apache bench: ab -n80 -c8 http://127.0.0.1/oxid
  • 87. S.O.S – cache entry expires
  • 88. The speaker says... Plan your cache strategy carefully! If not properly planned, caching can be counter productive. For example, test what happens if a very popular cache entry used by many clients expires. For the time it takes to refresh the cache entry all clients formerly using the invalidated cache entry will contact the database. The load of the MySQL server will increase suddenly – MySQL will be slammed. Due to the high load it takes longer and longer to refresh the cache entry. MySQL gets overloaded: a spiral to death.
  • 89. Slam defense: serve stale! Refresh
  • 90. The speaker says... To avoid slamming the MySQL Server the query cache plugin has a special TTL based slam protection operation mode. If a client hits an expired cache entry (cache miss) and slam protection is turned on the client gets a cache miss but the cache entry lifetime will be extended by a configurable time. All other clients also using the expired cache entry will get a cache hit because of the extended lifetime. Only the first client, which got a cache miss, contacts the MySQL Server to refresh the expired cache entry. Ideally, it will refresh the expired cache entry before the extended lifetime ends and MySQL does not get slammed because of a sudden massive load.
  • 91.
  • 92.
  • 95.
  • 96.
  • 99.
  • 100.
  • 102.
  • 103.
  • 104. APC: timings, hit ratio, result set size
  • 105. Default: APC plus result set meta data
  • 107. To new shores with MAYFLOWER Mayflower is Germany's largest service provider in terms of PHP programming. No matter whether you need corporation-wide Intranets, communities, e-business and e-commerce systems or customised solutions - we are the right partner to cooperate with. Find out more about our services in the field of software development. http://www.mayflower.de/en/contact 5 slots + 1 commercial
  • 108. Hacking Oxid A basic user defined storage handler
  • 109. The speaker says... Read and enjoy the slides. It aint complicated!
  • 110. php.ini [PHP] mysqlnd_qc.collect_normalized_query_trace=1 mysqlnd_qc.collect_query_trace=1 mysqlnd_qc.query_trace_bt_depth=20 mysqlnd_qc.collect_statistics=1 auto_prepend_file=/home/nixnutz/www/htdocs/oxid/prepend.php auto_append_file=/home/nixnutz/www/htdocs/oxid/append.php
  • 111. auto_prepend_file <?php /* prepend.php */ ?>
  • 112. auto_append_file $queries = mysqlnd_qc_get_query_trace_log(); $distinct = array(); $max_store_time = $max_store_time_idx = 0; foreach ($queries as $k => $details) { if (!isset($distinct[$details['query']])) $distinct[$details['query']] = 0; else $distinct[$details['query']]++; if ($details['store_time'] > $max_store_time) { $max_store_time = $details['store_time']; $max_store_time_idx = $k; } } printf(&quot;<pre>Total: %d, distinct %d&quot;, count($queries), count($distinct)); var_dump($queries[$max_store_time_idx]);
  • 113. Query monitor findings... Total: 329, distinct 296 array(8) { [&quot;query&quot;]=> string(348) &quot;select [... snip ...]&quot; [&quot;origin&quot;]=> String(1210) &quot;#0 [... snip ...] mysql_driver.inc(352): mysql_query('select oxmanufa...', Resource id #11) [...] #11 {main}&quot; [&quot;run_time&quot;] => int(0) [&quot;store_time&quot;] => int(558) [&quot;eligible_for_caching&quot;] => bool(false) [&quot;no_table&quot;] => bool(false) [&quot;was_added&quot;] => bool(false) [&quot;was_already_in_cache&quot;] => bool(false) }
  • 114.
  • 115. Most basic user storage handler <?php /* prepend.php */ class my_qc extends mysqlnd_qc_handler_default { public function is_select($query) { printf(&quot;<pre>%s</pre>&quot;, htmlspecialchars($query)); return parent::is_select($query); } } $qc = new my_qc(); mysqlnd_qc_change_handler($qc); ?>
  • 116. Google on diet <?php /* prepend.php */ class my_qc extends mysqlnd_qc_handler_default { public function is_select($query) { if (preg_match(&quot;@from oxseo where@ism&quot;, $query)) { /* cache query for mysqlnd_qc.ttl seconds */ return true; } return parent::is_select($query); } } $qc = new my_qc(); mysqlnd_qc_change_handler($qc); ?>
  • 117. Does it work? <?php /* append.php */ print &quot;<pre>&quot;; var_dump(mysqlnd_qc_get_core_stats()); $queries = mysqlnd_qc_get_query_trace_log(); foreach ($queries as $k => $details) { if ($details['eligible_for_caching']) { printf(&quot;(%d/%d) %s ...&quot;, $details['run_time'], $details['store_time'], substr($details['query'], 0, 40)); } } ?>
  • 118. Marketing kills you! array(26) { [&quot;cache_hit&quot;] => string(1) &quot;0&quot; [&quot;cache_miss&quot;] => string(3) &quot;179&quot; [&quot;cache_put&quot;] => string(2) &quot;90&quot; [... snip ...] } (3591/117) select oxfixed, oxseourl, oxexpired, oxt ... (3206/132) select oxfixed, oxseourl, oxexpired, oxt …
  • 119. Scope: process array(26) { [&quot;cache_hit&quot;] => string(3) &quot;270&quot; [&quot;cache_miss&quot;] => string(3) &quot;446&quot; [&quot;cache_put&quot;] => string(2) &quot;90&quot; [.. snip ...] } (30/14) select oxfixed, oxseourl, oxexpired, oxt ... (30/27) select oxfixed, oxseourl, oxexpired, oxt ...
  • 121. Qafoo Increase your Return On Investment Ease your project management Raise developer motivation [email_address] 4 slots + 1 commercial
  • 123.
  • 124. QC User defined storage handler
  • 127.
  • 128. THE END Credits: Andrey Hristov, David Sorria Para Contact: ulf.wendel@oracle.com