After initial setup, there are several system-level optimisations that can significantly improve server performance under load.
MySQL/MariaDB Tuning
Edit /etc/mysql/mariadb.conf.d/50-server.cnf:
innodb_buffer_pool_size = 256M # ~70% of RAM for dedicated DB servers\nquery_cache_size = 64M\nmax_connections = 100\ntmp_table_size = 32MRestart: systemctl restart mariadb
PHP-FPM Process Manager
For PHP-FPM, tune the pool configuration (/etc/php/8.1/fpm/pool.d/www.conf):
pm = dynamic\npm.max_children = 20\npm.start_servers = 5\npm.min_spare_servers = 3\npm.max_spare_servers = 10Adjust based on your RAM and traffic patterns.
Kernel Network Tuning
Add to /etc/sysctl.conf for better network performance:
net.core.somaxconn = 65535\nnet.ipv4.tcp_max_syn_backlog = 65535\nnet.ipv4.tcp_fin_timeout = 30Apply: sysctl -p