Tối ưu hóa cấu hình my.cnf – Tối ưu MariaDB InnoDB hoặc MySQL InnoDB
|1. Máy chủ VPS với 2 core và 4GB RAM (MariaDB với InnoDB)
innodb_buffer_pool_size = 2G
innodb_log_buffer_size = 32M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
key_buffer_size = 256M
query_cache_type = 0
query_cache_size = 0
max_connections = 100
thread_cache_size = 8
table_open_cache = 512
2. Máy chủ VPS với 4 core và 8GB RAM (MariaDB với InnoDB)
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
innodb_flush_method = O_DIRECT
key_buffer_size = 512M
query_cache_type = 0
query_cache_size = 0
max_connections = 200
thread_cache_size = 16
table_open_cache = 1024
Các thông số bên trên các bạn nên tìm đọc tài liệu để hiểu rõ hơn về từng thông số