Performance settings

Relution runs with the defaults of the components it uses and sets none of them itself. They apply per Relution instance and require the database server to provide matching limits.


Defaults and connection pool

SettingDefault
Threads for HTTP requests200 (at least 10)
Database connections in the connection pool100 (at least 10)
Wait time for a free database connection30 seconds
Threads of the internal task scheduler10
Prepared statements per database connection on MariaDB250

With several Relution nodes these values apply to the same database server accordingly. Adjusting them is usually not necessary.

All database access goes through the same connection pool: requests from the portal and from devices, the internal task scheduler, cluster locking and the database migration at startup. There is no separate pool for the task scheduler. Once HTTP requests occupy the pool, the task scheduler no longer receives a connection either, and push notifications stop:

org.apache.tomcat.jdbc.pool.PoolExhaustedException: [...] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:100; busy:100; idle:0; lastwait:30000].

On MariaDB as well as on PostgreSQL, max_connections therefore has to be at least the number of Relution nodes multiplied by 100, plus a reserve for administration and backup.


Prepared statements on MariaDB

This section applies to MariaDB only. PostgreSQL has no comparable limit, no adjustment is required there.

The connection strings documented by Relution for MariaDB contain useServerPrepStmts=true. The database server prepares the queries itself and holds up to 250 of them per connection, which with 100 connections amounts to roughly 25,000 in normal operation as a guide value.

max_prepared_stmt_count → applies to the entire database server, not per connection or per database. Its default of 16,382 is below what a single Relution instance alone can occupy; several nodes or applications on the same database server add up on top. Once the limit is reached, every further prepared statement is rejected:

Error: 1461-42000: Can't create more than max_prepared_stmt_count statements (current value: 16382)

Individual connections can then stay occupied permanently. If the task scheduler is affected, no push notifications are sent until Relution is restarted.

Setting and verifying the limit

At least the number of Relution nodes multiplied by 25,000 is required. The following value corresponds to four times the default and leaves a reserve for administration tools and further applications; 0 to 4,294,967,295 are permitted:

[mysqld]
max_prepared_stmt_count = 65528

The configuration file is database.cnf (Docker), /etc/my.cnf.d/relution.cnf (native installation on Linux) or my.ini (Windows). The change takes effect after a restart of the database server. The following takes effect immediately, but only until the next restart:

SET GLOBAL max_prepared_stmt_count = 65528;

Effective limit and current usage:

SELECT @@max_prepared_stmt_count;
SHOW GLOBAL STATUS LIKE 'Prepared_stmt_count';

Memory of the database server

The data buffer determines how much of the database is held in memory. If it is considerably smaller than the Relution database, the database is read from disk permanently and response times increase. innodb_buffer_pool_size → is set to 128 MiB out of the box on MariaDB, shared_buffers → usually likewise on PostgreSQL, independent of the database size.

The size of the Relution database on MariaDB:

SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024) AS mb
FROM information_schema.TABLES
WHERE table_schema = 'relution';

On PostgreSQL:

SELECT pg_size_pretty(pg_database_size('relution'));

What matters is the comparison of this value with the configured data buffer and the available memory. The vendor figures — MariaDB up to 80 percent, PostgreSQL about 25 percent of the memory — only apply to servers that run the database service exclusively. Up to 1,000 devices our recommendation provides for a shared server for Relution and the database with 4 to 8 GB in total; there these figures are not applicable, see System requirements →.


Next steps

To narrow down a performance problem: Relution Logs →, Set log level → and Performance analysis with Glowroot →. As MariaDB is only supported until the end of 2027 and the limit for prepared statements does not exist on PostgreSQL, switching is the more sustainable solution: Migration from MariaDB to PostgreSQL →.

How helpful was this article?