SlideShare ist ein Scribd-Unternehmen logo
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 4.61 Requests/s 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 7.44 Requests/s 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 7.99 Requests/s 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 8.31 Requests/s 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 : Load Balancing Read/Write Splitting
Failover
Round-Robin, least loaded Monitoring Query Logging
Query Analysis
Query Auditing Performance Caching
Throttling
Sharding
PHP 5.3.4-dev 7.99 Requests/s 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 7.77 Requests/s 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 7.70 Requests/s 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 8.70 Requests/s 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 8.94 Requests/s 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 11.49 Requests/s 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 16.06 Requests/s 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 2,43 5,35 6,34 50 0,60 1,16 1,76 100 0,31 0,35 0,68 I can make it slower.  I can make the difference increase.
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 Transparent: no user API changes Supports ext/mysqli
Supports ext/mysql
Supports PDO_MySQL Invalidation: TTL, custom Per query TTL (Time to Live)
Custom: user callbacks Storage handler: build-in, custom Default (Hash), APC, Memcache, SQLite
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) Can stale data be served? Sure, the default invalidation strategy is Time to Live (TTL). However, you can implement your own invalidation strategy! Which PHP versions are supported? What a question! Look at the benchmarks: you want to use PHP 5.3.4 or newer. Does it support prepared statements? Sure, since about two days after the initial release.
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 MYSQLND_QC_ENABLE_SWITCH qc=on (can be changed at compile time)
Query must start with hint: /*qc=on*/SELECT MYSQLND_QC_DISABLE_SWITCH qc=off (can be changed at compile time)
Overrules mysqlnd_qc.cache_by_default = 1 MYSQLND_QC_TTL_SWITCH qc_ttl= (can be changed at compile time)
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: No single overloaded entity (MySQL Server)
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: No Single Point of Failure
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 Storage Scope: request, process, machine, multi-machine
Location: distance to cache
Replacement strategy
Slam defense strategy Decide what to cache is_select() - detect SQL hints Extended statistics Storage statistics, traces, timings
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 Collected by: mysqlnd php.net/manual/en/mysqlnd.stats.php Scope: process, connection Process: mysqli_get_client_stats()
Connection: mysqli_get_connection_stats() Contents: wide range Network related

Weitere ähnliche Inhalte

Was ist angesagt?

Vote NO for MySQL
Vote NO for MySQLVote NO for MySQL
Vote NO for MySQL
Ulf 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 nodes
Ulf 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/APIs
Ulf 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 mysqlnd
Jervin 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 MySQL
Ulf 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) consistency
Ulf Wendel
 
Scaling symfony apps
Scaling symfony appsScaling symfony apps
Scaling symfony apps
Matteo Moretti
 
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
Ulf 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 perspective
Ulf 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 quirks
Colin Charles
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
Ulf Wendel
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
Henrik Ingo
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
Manish 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 Ansible
Federico 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 Replication
Kenny Gryp
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
Kris Buytaert
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
Matteo Moretti
 
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
Ramakrishna 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 AOP
Robert Lemke
 
Distributed Identities with OpenID
Distributed Identities with OpenIDDistributed Identities with OpenID
Distributed Identities with OpenID
Bastian Hofmann
 
Creating Clean Code with AOP
Creating Clean Code with AOPCreating Clean Code with AOP
Creating Clean Code with AOP
Robert 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
 
jQuery's Secrets
jQuery's SecretsjQuery's Secrets
jQuery's Secrets
Bastian Feder
 

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 Scalability
Mediacurrent
 
Drupal development
Drupal development Drupal development
Drupal development
Dennis Povshedny
 
Mysql ppt
Mysql pptMysql ppt
Mysql ppt
Sanmuga Nathan
 
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 & Bower
Alan 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 2012
Wim 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 Nginx
Bud Siddhisena
 
Chef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructureChef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructure
Michaë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 scalability
Wim Godden
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册
Yiwei Ma
 
Triple Blitz Strike
Triple Blitz StrikeTriple Blitz Strike
Triple Blitz Strike
Denis Zhdanov
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
NGINX, Inc.
 
Securing Your Web Server
Securing Your Web ServerSecuring Your Web Server
Securing Your Web Server
manugoel2003
 
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
chinkshady
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
vnsavage
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
Tahsin 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 Cloud
Salesforce Developers
 
php & performance
 php & performance php & performance
php & performance
simon8410
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Server
supertom
 

Ä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 MySQL
Ulf Wendel
 
PHPopstar der PHP Unconference 2011
PHPopstar der PHP Unconference 2011PHPopstar der PHP Unconference 2011
PHPopstar der PHP Unconference 2011
Ulf Wendel
 
The power of mysqlnd plugins
The power of mysqlnd pluginsThe power of mysqlnd plugins
The power of mysqlnd plugins
Ulf Wendel
 
Mysqlnd query cache plugin benchmark report
Mysqlnd query cache plugin benchmark reportMysqlnd query cache plugin benchmark report
Mysqlnd query cache plugin benchmark report
Ulf 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 handler
Ulf 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 tuning
Ulf Wendel
 
Mysqlnd Async Ipc2008
Mysqlnd Async Ipc2008Mysqlnd Async Ipc2008
Mysqlnd Async Ipc2008
Ulf 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

Sonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdfSonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdf
SubhamMandal40
 
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
maigasapphire
 
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
Priyanka Aash
 
Integrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecaseIntegrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecase
shyamraj55
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
ankush9927
 
(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...
(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...
(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...
Priyanka Aash
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
Bhajan Mehta
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
Matthias Neugebauer
 
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
Priyanka Aash
 
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
Priyanka Aash
 
Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)
Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)
Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)
Muhammad Ali
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
SynapseIndia
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
bhumivarma35300
 
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Nicolás Lopéz
 
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
Priyanka Aash
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
bellared2
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
shanihomely
 
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptxIntroduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
313mohammedarshad
 

Kürzlich hochgeladen (20)

Sonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdfSonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdf
 
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
 
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
(CISOPlatform Summit & SACON 2024) Orientation by CISO Platform_ Using CISO P...
 
Integrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecaseIntegrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecase
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
 
(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...
(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...
(CISOPlatform Summit & SACON 2024) Workshop _ Most Dangerous Attack Technique...
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
 
Opencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of MünsterOpencast Summit 2024 — Opencast @ University of Münster
Opencast Summit 2024 — Opencast @ University of Münster
 
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
 
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
(CISOPlatform Summit & SACON 2024) Cyber Insurance & Risk Quantification.pdf
 
Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)
Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)
Litestack talk at Brighton 2024 (Unleashing the power of SQLite for Ruby apps)
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
 
Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024Vertex AI Agent Builder - GDG Alicante - Julio 2024
Vertex AI Agent Builder - GDG Alicante - Julio 2024
 
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
(CISOPlatform Summit & SACON 2024) Gen AI & Deepfake In Overall Security.pdf
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
 
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptxIntroduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
 

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. PHP 5.2.15-dev 4.61 Requests/s 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%
  • 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. PHP 5.2.15-dev 7.44 Requests/s 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%
  • 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. PHP 5.3.4-dev 7.99 Requests/s 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%
  • 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. PHP 5.3.4-dev 8.31 Requests/s 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%
  • 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. 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 : Load Balancing Read/Write Splitting
  • 22. Round-Robin, least loaded Monitoring Query Logging
  • 27. PHP 5.3.4-dev 7.99 Requests/s 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%
  • 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. PHP 5.3.4-dev 7.77 Requests/s 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 '
  • 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. PHP 5.3.4-dev 7.70 Requests/s 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%
  • 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. PHP 5.3.4-dev 8.70 Requests/s 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%
  • 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. PHP 5.3.4-dev 8.94 Requests/s 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%
  • 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. PHP 5.3.99-dev 11.49 Requests/s 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%
  • 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. PHP 6.0.6-dev 16.06 Requests/s RES 10...11m There's no PHP 6.0 because there is no MySQL 6.0! BULLSHIT BINGO !
  • 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. X factor: network latency Latency (ms) No cache (R/s) Cache (default) Cache (APC) 5 3,72 7,11 7,71 10 2,43 5,35 6,34 50 0,60 1,16 1,76 100 0,31 0,35 0,68 I can make it slower. I can make the difference increase.
  • 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. Key Features PECL/mysqlnd_qc Transparent: no user API changes Supports ext/mysqli
  • 52. Supports PDO_MySQL Invalidation: TTL, custom Per query TTL (Time to Live)
  • 53. Custom: user callbacks Storage handler: build-in, custom Default (Hash), APC, Memcache, SQLite
  • 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. Possibly asked questions (PAQ) Can stale data be served? Sure, the default invalidation strategy is Time to Live (TTL). However, you can implement your own invalidation strategy! Which PHP versions are supported? What a question! Look at the benchmarks: you want to use PHP 5.3.4 or newer. Does it support prepared statements? Sure, since about two days after the initial release.
  • 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. SQL hints to control the cache MYSQLND_QC_ENABLE_SWITCH qc=on (can be changed at compile time)
  • 61. Query must start with hint: /*qc=on*/SELECT MYSQLND_QC_DISABLE_SWITCH qc=off (can be changed at compile time)
  • 62. Overrules mysqlnd_qc.cache_by_default = 1 MYSQLND_QC_TTL_SWITCH qc_ttl= (can be changed at compile time)
  • 64. Vs. MySQL Server Query Cache
  • 65. 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: No single overloaded entity (MySQL Server)
  • 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. 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: No Single Point of Failure
  • 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. Storage handler responsibilities Storage Scope: request, process, machine, multi-machine
  • 83. Slam defense strategy Decide what to cache is_select() - detect SQL hints Extended statistics Storage statistics, traces, timings
  • 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. The 150+ statistics of mysqlnd Collected by: mysqlnd php.net/manual/en/mysqlnd.stats.php Scope: process, connection Process: mysqli_get_client_stats()
  • 95. 20 statistics of the cache core Collected by: mysqlnd_qc core php.net/manual/en/function.mysqlnd_qc_get_core_stats.php Scope: process Process: mysqlnd_qc_get_core_stats()
  • 96. Aggregated values from all PHP MySQL APIs Contents: wide range Cache usage and efficiency
  • 99. Query statistics and backtraces Collected by: mysqlnd_qc core php.net/manual/en/function.mysqlnd_qc_get_query_trace_log.php Scope: process mysqlnd_qc_get_query_trace_log()
  • 102. Storage handler statistics Collected by: storage handler php.net/manual/en/function..mysqlnd_qc_get_cache_info.php Scope: cache entry Depends on storage handler scope
  • 103. Aggregated values from all PHP MySQL APIs Contents: none or assorted Depends on storage handler support
  • 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. User defined storage handler Procedural php.net/manual/en/function.mysqlnd_qc_set_user_handlers.php Callback functions Object oriented slideshare.net/nixnutz/mysqlnd-query-cache-plugin-userdefined-storage-handler Interface mysqlnd_qc_handler Andrey hates me Extending mysqlnd_qc_handler_default
  • 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. Documentation and resources php.net/mysqlnd_qc Installation, Examples, Functions php.net/mysqlnd Introduction, Changes, C plugin API slideshare.net/nixnutz/presentations QC Basics
  • 124. QC User defined storage handler
  • 127. More public plugins on PECL... mysqlnd_mc Multi-connect: splits SELECT to be run by different servers and merges the results on the client mysqlnd_sip SQL Injection protection: rejects unknown queries to prevent SQL injection attacks mysqlnd_pscache Prepared Statement handle cache
  • 128. THE END Credits: Andrey Hristov, David Sorria Para Contact: ulf.wendel@oracle.com