πŸš€ Boosting MariaDB 11.4 Performance on AlmaLinux 9.5 + cPanel

If you’re running a high-performance WordPress or PHP-based site on MariaDB 11.4, AlmaLinux 9.5 STANDARD KVM, and cPanel, optimizing your database and server settings can lead to faster queries, better concurrency, and improved stability.

This tuning guide is 100% compatible with this stack πŸ‘‡


πŸ“¦ Step 1: Optimize MariaDB Configuration

Edit the MariaDB configuration file:

sudo nano /etc/my.cnf

Add the following under [mysqld]:

[mysqld]
# InnoDB Performance Tweaks
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_thread_concurrency = 0
innodb_buffer_pool_size = 4G
innodb_buffer_pool_instances = 8
innodb_log_file_size = 256M

# Query Cache (supported in MariaDB 11.4)
query_cache_type = 1
query_cache_limit = 128K
query_cache_size = 64M
query_cache_min_res_unit = 512

# Disable strict SQL modes
sql_mode = ""

# Optional: Disable performance schema to reduce overhead
performance-schema = 0

πŸ”’ Note: These settings are fully compatible with cPanel. Always back up my.cnf before modifying.


πŸ› οΈ Step 2: Apply Linux Kernel Tuning for MariaDB

Edit the sysctl configuration:

sudo nano /etc/sysctl.conf

Append the following lines:

vm.swappiness = 0
vm.dirty_ratio = 8
vm.dirty_background_ratio = 4
vm.max_map_count = 262144
fs.file-max = 2500000
fs.nr_open = 3000000

Apply the changes:

sudo sysctl -p

πŸ”“ Step 3: Increase File Limits for MariaDB

Edit file limits:

sudo nano /etc/security/limits.conf

Add:

mysql soft nofile 65535
mysql hard nofile 65535

Ensure limits are applied via PAM:

sudo nano /etc/pam.d/common-session

Add to the bottom:

session required pam_limits.so

πŸ” Step 4: Restart and Verify

Restart MariaDB:

sudo systemctl restart mariadb

Check the status:

systemctl status mariadb

Verify settings (login required):

mysql -u root -p

Run:

SHOW VARIABLES LIKE 'innodb_%';
SHOW VARIABLES LIKE 'query_cache%';

πŸ’‘ Final Thoughts

These optimizations are battle-tested for:

  • WordPress & WooCommerce
  • Dynamic PHP applications
  • Busy transactional workloads

They help ensure:
βœ… Better speed
βœ… Higher concurrency
βœ… Stable long-term uptime

Whether you’re tuning for performance, stability, or scaling, this setup gives you a solid, efficient foundation.

Scroll to Top