High 
Performance 
Drupal 
with 
MariaDB 
Maria 
Luisa 
Raviol 
MariaDB 
-­‐ 
Senior 
Sales 
Engineer 
© 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
Thursday, 2 October 2014
MariaDB Corporation 
• MariaDB Corporation (former SkySQL AB) was founded by original MySQL AB team members 
including Michael “Monty” Widenius 
• Strongest team of core MySQL experts 
• Global, follow-the-sun, 24/7 enterprise support for MariaDB and MySQL 
• Powerful distribution and customer base 
• MariaDB is adopted by key open source communities 
• Wikipedia (English, German) is running MariaDB 
• Over 400 enterprise customers 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
2 
Thursday, 2 October 2014
400+ Customers in 33 Countries 
Finance Travel Retail 
Telecom Technology & .gov/.edu Media 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
3 
Thursday, 2 October 2014
What is MariaDB? 
•MariaDB is an enhanced, drop-in replacement for MySQL. 
•Community oriented 
•Not backed up by any company but governed by a foundation MariaDB.org 
• It is supported by MariaDB Corporation and we are backed up by the foundation 
•MariaDB is becoming the leading database platform for cloud 
•RHEL7, Debian, Fedora, OpenSUSE are shipping MariaDB as default replacing MySQL 
•we also provide third level support for SLES 12, which will include MariaDB 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
4 
Thursday, 2 October 2014
The 
open 
source 
community 
is 
switching 
from 
MySQL 
to 
MariaDB 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
5 
Thursday, 2 October 2014
Why MariaDB for Drupal? 
• Because MariaDB is part of the Drupal Setup process 
• it is recommended in the documentation 
• https://www.drupal.org/requirements/database 
• MariaDB is 100% drop in replacement for MySQL 
• MariaDB has a better Query Optimiser 
• It comes with MariaDB only features that can improve Drupal performances 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
6 
Thursday, 2 October 2014
MariaDB vs MySQL 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
• More Storage Engines 
• XtraDB (drop-in replacement for InnoDB) 
• FederatedX (drop-in replacement for Federated) 
• SphinxSE 
• TokuDB 
• .... 
• Speed Improvements 
• optimizer enhancements (Subqueries are now finally usable!) 
• Parallel Replication 
• Pool of Threads 
• Faster and safer replication 
• Extensions & new features 
• Dynamic Columns support 
• Extended User Statistics 
• KILL all queries for a user 
• KILL QUERY ID - terminates the query by query_id, leaving the connection intact 
• Group commit for the binary log. This makes replication notably faster! 
• GIS Functionality 
• Multi-source replication. 
• Roles. — new in 10.0 
7 
Thursday, 2 October 2014
MariaDB Features for Drupal Users 
XtraDB Storage Engine 
• it is MariaDB default storage engine 
• enhanced version for InnoDB storage engine 
• less check pointing, less flushing to disk, stable performances 
• developed by both MariaDB Corporation and Percona 
• fast innodb restart, pre-populate the innodb buffer pool 
• best use of RAM 
• improved single core performances 
• great for cloud environment 
• It is backwards-compatible with InnoDB 
• so it can be used as a drop-in replacement 
• Still with MyISAM? 
• It still is great for bulk inserts 
• but...major read bottlenecks because it is affected by the key buffer 
• ADVICE: migrate to InnoDB or XtraDB unless you really want to use MyISAM 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
8 
Thursday, 2 October 2014
MariaDB Features to benefit Drupal users 
Sphynx Storage Engine 
• MariaDB support full text search with SphinxSE 
• With MariaDB SphynxSE you can do your full text search with sphynx and still use your regular 
database 
• Engine connects to Sphinx searchd 
CREATE TABLE t(...) ENGINE=SPINX CONNECION=”sphinx://localohost:9312/test”; 
• Let Sphinx do what it is designed to do 
• Let indexing, searching, sorting, filtering be performed by Sphinx as it is optimised for these tasks 
• JOIN search table with other MariaDB tables 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
9 
Thursday, 2 October 2014
MariaDB Features to benefit Drupal users 
Other storage engines 
TokuDB 
• uses fractal Tree indexes instead of B-Tree 
• improved write operations 
• data compression 
• online schema flexilbilty 
• great for SSD usage 
CONNECT 
• can read/write/update in/to different formats: .DBF, .CSV, .INI and many many other more 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
10 
Thursday, 2 October 2014
MariaDB Features for Drupal Users 
• Threadpool 
• This his is probably the most useful for Drupal users 
• there are many short running queries that are executed when reaching a website any time you load 
a page that does not hit the cache 
• If you have many concurrent clients or users you will open one thread per connection 
• Many active threads are a performance killer 
• With MariaDB you can create pool of threads that keep on being reused. 
• When should you use Threadpool? 
• Threadpools are most efficient in situations where queries are relatively short 
and the load is CPU bound (OLTP workloads). 
• So, if you have many concurrent clients or many users that potentially 
use a thread each turn this on in your My.cnf 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
11 
Thursday, 2 October 2014
MariaDB Features to benefit Drupal users 
Subqueries 
• With MariaDB, Subqueries Materialise 
• MySQL users know that basically subqueries do not work and they used to be rewritten with joins or 
separate queries 
• MariaDB has Subquery cache and it performs better than MySQL 5.6’s subquery optimiser 
Group Commit 
• The idea with group commit is to amortise the costs of each fsync() over multiple commits from 
multiple parallel transactions. 
• If there are many transactions in parallel trying to commit, we can force all of them to disk at once 
with a single fsync(), rather than do one fsync() for each. 
• effective if you use replication 
• largely used by facebook 
• if you’re relying on replication to scale Drupal you will probably end up in some 
slave lag and turning group commit on will probably help 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
12 
Thursday, 2 October 2014
MariaDB Features to benefit Drupal users 
GIS precise support 
• in MySQL was only drafted 
• MySQL has OpenGIS SFS it allows you to find the minimum boundary region 
• MariaDB has full OpenGIS support inside MariaDB 
• SQL with full geometry types 
• https://mariadb.com/kb/en/mariadb/documentation/gis-functionality/gis-features-in-533/ 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
13 
Thursday, 2 October 2014
MariaDB Galera Cluster Quick Overview 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
14 
•MultiMaster solution that comes with synchronous replication 
•Based on InnoDB and hence XtraDB so loved by Drupal users 
•Fully Read-Write scalable 
•Guarantees no lag or lost transactions 
•Made for today’s cloud 
based environments 
Thursday, 2 October 2014
MariaDB Galera Cluster Quick Overview 
• For Drupal Users Galera Cluster looks 
like one big database with multiple 
entry points 
• many different databases on the 
network 
• The client can connect any node 
• once a transaction has been 
committed on one node we are sure 
that the other nodes have received the 
transaction 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
15 
Thursday, 2 October 2014
MariaDB Galera Cluster Quick Overview 
Quorum Failure 
• Galera Cluster is quorum based 
• when cluster partitioning is detected, the majority partition “has quorum” and can continue 
• a minority partition cannot commit transaction, but will attempt to reconnect to primary partition 
• Load Balancer will detect errors and remove node from cluster pool 
• 50% does not constitute a majority so the minimum number of nodes for a Galera Cluster is 3 
• Galera works with multiple-geographies across WANs 
• good for distributed/cloud based solutions 
• synchronous in one DC, use Async or time delayed replication across WAN 
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
16 
Thursday, 2 October 2014
09/25/14 © 
MariaDB 
Corpora,on 
Ab. 
Company 
Confiden,al. 
References 
Maria Luisa Raviol: luisa@mariadb.com 
MariaDB: www.mariadb.org 
www.mariadb.com 
KB: https://mariadb.com/kb/en/mariadb/documentation/optimization-and-tuning/ 
https://mariadb.com/kb/en/mariadb/documentation/storage-engines/ 
https://mariadb.com/kb/en/mariadb/documentation/replication-cluster-multi-master/ 
17 
Thursday, 2 October 2014

High Performance Drupal with MariaDB

  • 1.
    High Performance Drupal with MariaDB Maria Luisa Raviol MariaDB -­‐ Senior Sales Engineer © MariaDB Corpora,on Ab. Company Confiden,al. Thursday, 2 October 2014
  • 2.
    MariaDB Corporation •MariaDB Corporation (former SkySQL AB) was founded by original MySQL AB team members including Michael “Monty” Widenius • Strongest team of core MySQL experts • Global, follow-the-sun, 24/7 enterprise support for MariaDB and MySQL • Powerful distribution and customer base • MariaDB is adopted by key open source communities • Wikipedia (English, German) is running MariaDB • Over 400 enterprise customers 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 2 Thursday, 2 October 2014
  • 3.
    400+ Customers in33 Countries Finance Travel Retail Telecom Technology & .gov/.edu Media 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 3 Thursday, 2 October 2014
  • 4.
    What is MariaDB? •MariaDB is an enhanced, drop-in replacement for MySQL. •Community oriented •Not backed up by any company but governed by a foundation MariaDB.org • It is supported by MariaDB Corporation and we are backed up by the foundation •MariaDB is becoming the leading database platform for cloud •RHEL7, Debian, Fedora, OpenSUSE are shipping MariaDB as default replacing MySQL •we also provide third level support for SLES 12, which will include MariaDB 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 4 Thursday, 2 October 2014
  • 5.
    The open source community is switching from MySQL to MariaDB 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 5 Thursday, 2 October 2014
  • 6.
    Why MariaDB forDrupal? • Because MariaDB is part of the Drupal Setup process • it is recommended in the documentation • https://www.drupal.org/requirements/database • MariaDB is 100% drop in replacement for MySQL • MariaDB has a better Query Optimiser • It comes with MariaDB only features that can improve Drupal performances 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 6 Thursday, 2 October 2014
  • 7.
    MariaDB vs MySQL 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. • More Storage Engines • XtraDB (drop-in replacement for InnoDB) • FederatedX (drop-in replacement for Federated) • SphinxSE • TokuDB • .... • Speed Improvements • optimizer enhancements (Subqueries are now finally usable!) • Parallel Replication • Pool of Threads • Faster and safer replication • Extensions & new features • Dynamic Columns support • Extended User Statistics • KILL all queries for a user • KILL QUERY ID - terminates the query by query_id, leaving the connection intact • Group commit for the binary log. This makes replication notably faster! • GIS Functionality • Multi-source replication. • Roles. — new in 10.0 7 Thursday, 2 October 2014
  • 8.
    MariaDB Features forDrupal Users XtraDB Storage Engine • it is MariaDB default storage engine • enhanced version for InnoDB storage engine • less check pointing, less flushing to disk, stable performances • developed by both MariaDB Corporation and Percona • fast innodb restart, pre-populate the innodb buffer pool • best use of RAM • improved single core performances • great for cloud environment • It is backwards-compatible with InnoDB • so it can be used as a drop-in replacement • Still with MyISAM? • It still is great for bulk inserts • but...major read bottlenecks because it is affected by the key buffer • ADVICE: migrate to InnoDB or XtraDB unless you really want to use MyISAM 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 8 Thursday, 2 October 2014
  • 9.
    MariaDB Features tobenefit Drupal users Sphynx Storage Engine • MariaDB support full text search with SphinxSE • With MariaDB SphynxSE you can do your full text search with sphynx and still use your regular database • Engine connects to Sphinx searchd CREATE TABLE t(...) ENGINE=SPINX CONNECION=”sphinx://localohost:9312/test”; • Let Sphinx do what it is designed to do • Let indexing, searching, sorting, filtering be performed by Sphinx as it is optimised for these tasks • JOIN search table with other MariaDB tables 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 9 Thursday, 2 October 2014
  • 10.
    MariaDB Features tobenefit Drupal users Other storage engines TokuDB • uses fractal Tree indexes instead of B-Tree • improved write operations • data compression • online schema flexilbilty • great for SSD usage CONNECT • can read/write/update in/to different formats: .DBF, .CSV, .INI and many many other more 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 10 Thursday, 2 October 2014
  • 11.
    MariaDB Features forDrupal Users • Threadpool • This his is probably the most useful for Drupal users • there are many short running queries that are executed when reaching a website any time you load a page that does not hit the cache • If you have many concurrent clients or users you will open one thread per connection • Many active threads are a performance killer • With MariaDB you can create pool of threads that keep on being reused. • When should you use Threadpool? • Threadpools are most efficient in situations where queries are relatively short and the load is CPU bound (OLTP workloads). • So, if you have many concurrent clients or many users that potentially use a thread each turn this on in your My.cnf 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 11 Thursday, 2 October 2014
  • 12.
    MariaDB Features tobenefit Drupal users Subqueries • With MariaDB, Subqueries Materialise • MySQL users know that basically subqueries do not work and they used to be rewritten with joins or separate queries • MariaDB has Subquery cache and it performs better than MySQL 5.6’s subquery optimiser Group Commit • The idea with group commit is to amortise the costs of each fsync() over multiple commits from multiple parallel transactions. • If there are many transactions in parallel trying to commit, we can force all of them to disk at once with a single fsync(), rather than do one fsync() for each. • effective if you use replication • largely used by facebook • if you’re relying on replication to scale Drupal you will probably end up in some slave lag and turning group commit on will probably help 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 12 Thursday, 2 October 2014
  • 13.
    MariaDB Features tobenefit Drupal users GIS precise support • in MySQL was only drafted • MySQL has OpenGIS SFS it allows you to find the minimum boundary region • MariaDB has full OpenGIS support inside MariaDB • SQL with full geometry types • https://mariadb.com/kb/en/mariadb/documentation/gis-functionality/gis-features-in-533/ 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 13 Thursday, 2 October 2014
  • 14.
    MariaDB Galera ClusterQuick Overview 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 14 •MultiMaster solution that comes with synchronous replication •Based on InnoDB and hence XtraDB so loved by Drupal users •Fully Read-Write scalable •Guarantees no lag or lost transactions •Made for today’s cloud based environments Thursday, 2 October 2014
  • 15.
    MariaDB Galera ClusterQuick Overview • For Drupal Users Galera Cluster looks like one big database with multiple entry points • many different databases on the network • The client can connect any node • once a transaction has been committed on one node we are sure that the other nodes have received the transaction 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 15 Thursday, 2 October 2014
  • 16.
    MariaDB Galera ClusterQuick Overview Quorum Failure • Galera Cluster is quorum based • when cluster partitioning is detected, the majority partition “has quorum” and can continue • a minority partition cannot commit transaction, but will attempt to reconnect to primary partition • Load Balancer will detect errors and remove node from cluster pool • 50% does not constitute a majority so the minimum number of nodes for a Galera Cluster is 3 • Galera works with multiple-geographies across WANs • good for distributed/cloud based solutions • synchronous in one DC, use Async or time delayed replication across WAN 09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. 16 Thursday, 2 October 2014
  • 17.
    09/25/14 © MariaDB Corpora,on Ab. Company Confiden,al. References Maria Luisa Raviol: luisa@mariadb.com MariaDB: www.mariadb.org www.mariadb.com KB: https://mariadb.com/kb/en/mariadb/documentation/optimization-and-tuning/ https://mariadb.com/kb/en/mariadb/documentation/storage-engines/ https://mariadb.com/kb/en/mariadb/documentation/replication-cluster-multi-master/ 17 Thursday, 2 October 2014