Skip to Content
DatabaseMariaDB on Zenifra

How Zenifra MariaDB works

This page shows how Zenifra managed MariaDB is configured: how many instances it uses, how memory and connections are split in each plan, how writes are replicated, and how the connection is protected. To create and connect, see Create from the Console and Connect your application to MariaDB.

Summary

ItemHow it is
Versions10 (10.11 series) and 11 (11.4 series)
EngineCommunity MariaDB, no fork
Storage engineInnoDB by default
Instancesalways 3: one primary and two replicas
Memoryabout 70% of the plan RAM for the InnoDB cache (innodb_buffer_pool_size)
Connectionslimit per plan and per instance, from 32 to 500
Writesinnodb_flush_log_at_trx_commit = 1: COMMIT only returns after the data is on disk
Replicationby GTID in strict mode, with automatic failover; optional write to 2 instances (semi-synchronous)
TLSalways required, on every connection
Userapp, with the app database, no root access
Plansstarting at db-starter

Versions

  • MariaDB 10 uses the 10.11 series, and MariaDB 11 uses the 11.4 series.
  • In the settings, you can upgrade from 10 to 11. Downgrade is not supported.
  • The upgrade can cause a few minutes of unavailability. Do it in a low-traffic window.

To check the version of your database:

SELECT VERSION();

Always 3 instances

Every Zenifra MariaDB has 3 instances: one primary, which takes writes and reads, and two replicas. The number is fixed at 3.

  • The Console connection always points to the primary.
  • Each instance has its own disk, of the size you chose.
  • Each instance is billed at the plan price. For example, a db-basic MariaDB costs 3 times the plan price, plus the storage of the 3 instances. See Database Plans.

Memory and connections per plan

The values below are set when the database is created and applied again on every plan change. They apply to each instance.

PlanRAMInnoDB cache (innodb_buffer_pool_size)Connections per instance (max_connections)Connections for your application
db-starter256 MBabout 179 MB3220
db-basic1 GBabout 716 MB128116
db-premium2 GB1 GB256244
db-enterprise8 GB5 GB500488
  • InnoDB cache: 70% of the plan RAM. When this value is over 1 GB, it is rounded down to whole GB. Below that, it stays in MB, with a minimum of 128 MB.
  • Connections: 1 connection for every 8 MB of RAM, with a minimum of 20 and a maximum of 500.
  • Connections for your application: the app user can open the plan connections minus 12, kept for replication, monitoring and database maintenance (20 on db-starter).

To check them on your database:

SELECT @@innodb_buffer_pool_size, @@max_connections;

Connections

  • Above your application's connection limit, a new connection is refused with Too many connections (error 1040). The limit is split evenly between the database's two entry points.
  • Use a connection pool in the driver or ORM, with a maximum size below the limit, adding up all instances of your application. For example: on db-basic, 3 application instances with a pool of 30 use 90 of the application's 116 connections.
  • Leave some headroom in the pool: part of the connections can be used by the platform to monitor the database.

To see how many connections are open:

SELECT COUNT(*) FROM information_schema.PROCESSLIST WHERE USER = 'app';

Writes and replication

  • innodb_flush_log_at_trx_commit = 1: when COMMIT returns, the transaction is already on the primary's disk and survives a restart.
  • Write to 2 instances (semi-synchronous replication): optional, in the Write to 2 instances card of the database edit page or through the API. On, the primary only answers COMMIT after at least one replica confirms it received the transaction. Off (default), COMMIT is confirmed on the primary and is faster. The option applies to the whole database and, when you change it, the database restarts one instance at a time. See Write to 2 instances.
  • GTID in strict mode: each transaction has a global identifier, and the replicas follow the primary by it.
  • Parallel replication: the replicas apply up to 4 transactions at the same time, to keep up with the primary during heavy writes.
  • ROW format: the replication log records the changed rows, not the SQL statements.
  • Automatic backups included in the plan. See Automatic backups.

Failover

  • If the primary fails, a replica is promoted to the new primary automatically, with no action from you.
  • Instances always run on different servers, close to each other on the network, so a single server failure does not take down the primary and the replicas together.
  • The Console host does not change: it starts leading to the new primary.
  • Connections open to the old primary drop. Set your application to reconnect and retry idempotent operations.

Encryption and TLS

  • In transit: MariaDB always requires TLS, including on private connections between applications. There is no option to turn it off. A connection without TLS is rejected with Access denied for user '…' (using password: YES), even with the right password. See Connect your application to MariaDB.
  • Public certificate: the certificate is issued for *.managed.zenifra.com and is validated by the system authorities, with no certificate file. Always connect through the Console host, not the IP.
  • From the public address to the database: the whole path uses TLS, with the database certificate validated.
  • At rest: the database disks are encrypted.

User and limits

  • The application user is app, with the app database. There is no root access. Server administration (parameters, replication, backups, and versions) stays with Zenifra.
  • Maximum packet: max_allowed_packet is 256 MB. A row or statement larger than that is rejected.
  • LOAD DATA LOCAL INFILE off: the database does not read files sent by the client. To import data, use batched INSERT statements or a dump with mariadb-dump/mysqldump.
  • Server parameters are managed by Zenifra and follow the plan. What can be tuned per session with SET SESSION is up to you.

Next steps

Last updated on

On this page