MariaDB and WordPress explained

MariaDB&WordPress

In my extensive search for the tech-stack that suits WordPress best, MariaDB showed significant performance increases among it’s competitors.

…but will it work in the WordPress ecosystem?

First thing to check when testing a new database engine with WordPress is compatibility.

WordPress officially supports only MySQL, though there are some database layer-abstraction techniques which are too complex to execute to be offering any performance increases.

MariaDB, on the other hand, is 100% compatible with MySQL.

All the goodies that increase performance and offer new features are tucked under the hood of the familiar MySQL.

Compatibility – check!

Caching

Unlike MySQL, MariaDB comes with query caching on by default. What this means is that every query that is being sent to the database engine is first looked up in the cache to see if the user can get what he wants without even running a query on the database.

Performance increases on a WordPress site, which always has a much larger number of database reads than writes, are significant.

Subquery caching

Another form of caching which MariaDB offers is subquery caching.

If we have two queries run one after another:

Query 1:

 

Query 2:

MySQL would run both of these queries in entirety, increasing CPU-load and response time.

MariaDB, on the other hand would create a “virtual” table consisting of the values returned from the subquery – so that when the second query is sent, data is read from the cached “virtual” table instead of running the subquery again.

Storage engines

MariaDB is included with numerous storage engines, each suitable for a specific set of usage scenarios.

Two storage engines we’ve considered are MariaDB’s more performant forks of MyISAM and InnoDB: Aria and XtraDB.

Though MyISAM and Aria offer greater read speeds and smaller memory footprints out of the box, through heavy usage and database growth these storage solutions become fragmented and slow.

What point is in having a site that’s super fast with a couple of visitors, but super slow at it’s peak?

XtraDB and InnoDB solve fragmentation problems by using clustered indices.

All the time, indices are reordered to a cluster to ensure spatial proximity of related data – which is crucial when your queries have a large number of JOIN and GROUP statements.

In a WordPress environment, where viewing a single post trigger multiple queries with JOINS, clustered indices make a difference.

Future development

Being community driven and completely open source, MariaDB experiences rapid growth in features, encourages development of experimental storage engines, which could end up to be the next big thing.

As of version 10.0.1 MariaDB has added support for Cassandra storage engine with an intention to include more NoSQL storage engines in the future. Though NoSQL currently means nothing to your WordPress installations – since WordPress only supports SQL engines, this is a big sign showing  MariaDB’s vibrant development efforts.

If we can ensure scalability, maintainability, unprecedented speed and performance – there’s no such thing as an ‘nontraditional’ tech-stack.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *