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
| Item | How it is |
|---|---|
| Versions | 10 (10.11 series) and 11 (11.4 series) |
| Engine | Community MariaDB, no fork |
| Storage engine | InnoDB by default |
| Instances | always 3: one primary and two replicas |
| Memory | about 70% of the plan RAM for the InnoDB cache (innodb_buffer_pool_size) |
| Connections | limit per plan and per instance, from 32 to 500 |
| Writes | innodb_flush_log_at_trx_commit = 1: COMMIT only returns after the data is on disk |
| Replication | by GTID in strict mode, with automatic failover; optional write to 2 instances (semi-synchronous) |
| TLS | always required, on every connection |
| User | app, with the app database, no root access |
| Plans | starting 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-basicMariaDB 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.
| Plan | RAM | InnoDB cache (innodb_buffer_pool_size) | Connections per instance (max_connections) | Connections for your application |
|---|---|---|---|---|
db-starter | 256 MB | about 179 MB | 32 | 20 |
db-basic | 1 GB | about 716 MB | 128 | 116 |
db-premium | 2 GB | 1 GB | 256 | 244 |
db-enterprise | 8 GB | 5 GB | 500 | 488 |
- 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
appuser can open the plan connections minus 12, kept for replication, monitoring and database maintenance (20 ondb-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: whenCOMMITreturns, 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
COMMITafter at least one replica confirms it received the transaction. Off (default),COMMITis 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.
ROWformat: 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.comand 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 theappdatabase. There is no root access. Server administration (parameters, replication, backups, and versions) stays with Zenifra. - Maximum packet:
max_allowed_packetis 256 MB. A row or statement larger than that is rejected. LOAD DATA LOCAL INFILEoff: the database does not read files sent by the client. To import data, use batchedINSERTstatements or a dump withmariadb-dump/mysqldump.- Server parameters are managed by Zenifra and follow the plan. What can be tuned per session with
SET SESSIONis up to you.
Next steps
Last updated on
PostgreSQL Metrics and Insights
Interpret connections, activity, read cache, locks, latency, storage, and replication in PostgreSQL native metrics on Zenifra, refreshed every minute.
How to Start MariaDB on Zenifra via Console
Create your managed MariaDB on Zenifra from the console: plans from db-starter, version 10 or 11, 3 instances with failover, storage, and a TLS connection.