PECL/mysqlnd_ms 1.1.0 (download) has been released (documentation)! It is a drop-in solution to add MySQL replication support to any PHP 5.3+ application using any of the PHP MySQL APIs (mysql, mysqli, PDO_MySQL) when compiled to use the mysqlnd library. It extends the mysqlnd library by replication and load balancing funtionality. The mysqlnd library is an optional replacement for the MySQL Client Library (AKA libmysql). The mysqlnd library ships together with PHP as of version 5.3. As of PHP 5.4 the mysqlnd library is a compile time default choice for all three PHP MySQL extensions.
The plugin provides automatic read-write splitting, load balancing, lazy connections, failover and a brand new filter concept. Because the plugin operates on its own layer beneath the application, no or very little application changes are needed, depending on the use case. This makes the plugin a perfect drop-in solution for existing applications. Please, don’t miss this blog posting comparing PECL/mysqlnd_ms with an application based approach.
|WordPress, phpMyFAQ, phpBB, … – any PHP 5.3 application|
|using any of|
|compiled to use|
If you are new to MySQL scale-out solutions and the plugin, check out this overview presentation.
Version 1.1.0 has been significantly re-factored and improved over the previous version. The most significant and visible change is the introduction of a filter concept. Filter take a list of servers and a query statement string as input to pick one or more servers capable of executing the statement. Filters can be chained and you can use them like command line tools which you connect with a shell’s pipe operator:
user | random. Check out the blog post Replication plugin | filter | conquer = 1.1.0 coming for details.
Please, note also the significanly extended reference manual which contains a quick start, example, an introduction to the concepts and a referenced part.
PECL calls 1.1.0 as alpha. However, that is not the full story. The alpha is a packaging mistake. 1.1.0 is of beta quality. We have tested it extensively. For example, there number of lines of test code is equal to the number of lines of C code… After a short test out in the wild, we will anounce a production ready version. We are looking forward to hear from you about the 1.1.0 release before we do the production ready version. Just like any PHP 5.4 developer enchourages you to try 5.4 in time. BTW, the plugin also works better with 5.4, see the manual for details. Happy hacking!