Skip to content

feat(roles/mariadb_server): make table_open_cache_instances configurable - #783

Merged
markuslf merged 1 commit into
mainfrom
feat/mariadb-table-open-cache-instances
Nov 19, 2026
Merged

markuslf merged 1 commit into
mainfrom
feat/mariadb-table-open-cache-instances

Conversation

@markuslf

@markuslf markuslf commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

MariaDB lowers table_open_cache_instances at startup to (open files - max_connections) / 2 / table_open_cache without logging it (sql/mysqld.cc). With LimitNOFILE=32768 and table_open_cache=2000, a database host with 12 vCPUs stays at 8 instances and warns about table cache contention after every restart.

  • New mariadb_server__cnf_table_open_cache_instances__host_var / __group_var (role default 8, the upstream default on 10.6 to 11.8).
  • mariadb_server__service_limit_nofile defaults to 65536. The drop-in renders the highest of the variable, 65536 and the limit mariadb.service gets without it (LimitNOFILE of the packaged unit, else systemd's DefaultLimitNOFILE), and omits the line where that OS limit is already the highest.
  • Breaking: changed default, and a value below 65536 no longer takes effect. The next run restarts MariaDB (both templates change).

Tested: molecule test --scenario-name mariadb_server on the full OS matrix (Debian 12/13, Rocky 8/9/10, Ubuntu 22.04/24.04/26.04), verify asserts 16 instances on the running server.

MariaDB lowers table_open_cache_instances at startup to
(open files - max_connections) / 2 / table_open_cache without logging it
(sql/mysqld.cc), so with LimitNOFILE=32768 and table_open_cache=2000 a
database host with 12 vCPUs stays at 8 instances and warns about table
cache contention after every restart.

LimitNOFILE now defaults to 65536 and the drop-in renders the highest of
mariadb_server__service_limit_nofile, 65536 and the limit mariadb.service
gets without it (LimitNOFILE of the packaged unit, else systemd's
DefaultLimitNOFILE). The line is omitted where that OS limit is already
the highest. Molecule verifies 16 instances on the full OS matrix.
@markuslf
markuslf merged commit 4c89151 into main Nov 19, 2026
11 checks passed
@markuslf
markuslf deleted the feat/mariadb-table-open-cache-instances branch November 19, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant