Search code examples
mariadbmoodlegalera

I want to scale mariadb database for huge number of query requests


I use Moodle on centos7 with Php, Mariadb, Nginx. There are huge number of users that use this Moodle. If the number of users grows more than 300user per sec, the Moodle has delay in response and seems to be hanged!

I read about:

  • Galera (multi master clustering with 3nodes)

  • slave-master (separate read and write)

  • MaxScale

  • increase ram and cpu (I have up to: 288GB ram, 24coreCPU, SSD drive)

What is the best practice to serve huge number of requests without delay? How can I scale my database (because it is the bottleneck)? I want scale it for serve huge request (most of them is read from database)


Solution

  • MariaDB (and MySQL) can scale 'infinitely' for reads by using Replication and sending read requests to Slave servers.

    500 connections per second is very high. (But I don't know what the practical limit is.)

    There are several extra tools that can do "connection pooling". Search for this; it may let you go well past 500 logical connections on a single server.

    In the case of Galera, you could have 3 read-write nodes, plus any number of Slaves hanging off each of the 3.

    For simple Master-Slave, there can be any number of Slaves hanging off the one Master.