HyperDB is an advanced database class for WordPress that supports replication and partitioning of data. It is a replacement for the standard wpdb class, and replaces a few of the WordPress built-in database functions.
HyperDB lets WordPress connect to any number of database servers and inspects each query to send it to the right one, for example writes to a MySQL master and reads from a slave. It does not replicate the data itself: you need MySQL replication for that.
I originally wrote this post in 2012. At the time of this update the HyperDB plugin had not been updated for years and was only tested up to WordPress 6.0, so test it thoroughly before using it on a current WordPress version.
The main differences of HyperDB are that it:
- can connect to an arbitrary number of database servers;
- inspects each query to determine the appropriate database.
For some time, I had HyperDB configured for this blog to use two databases, which worked great (write to master, read from slave). Unfortunately I had to replicate the data myself after each post, using a PHP script. That kind of sucked 😉
More information about HyperDB
If you'd like more information about WordPress HyperDB and database partitioning and replication, check out the following resources:
- WordPress Codex: HyperDB (Wayback Machine)
- HyperDB in the WordPress plugin directory
- How to deploy HyperDB
WordPress performance, PHP and IIS
I'd love to hear what plugins or special configurations you use to boost your WordPress' performance. Share your thoughts, knowledge and ideas. How to improve WordPress performance on IIS is a major subject on this blog.
Before spreading your database over multiple servers, make sure the one you have is optimized: optimize(d) WordPress hosting and MySQL InnoDB performance improvement.