MariaDB-Nginx | Performance Issues
Hello! Greetings!
We are currently moving our Moodle Site to MariaDB and Nginx. We are using AWS infra, (C5 series). While performing tests we achieved the following results on a 4 CPU 8 GB Ram Server.
Sampling Rate- 600/10 secs. (success)
Following are the configs of MariaDB and Nginx
[mysqld]
## Performance Specific ##
##########################
innodb_buffer_pool_size = 12G
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_io_capacity = 800
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
table_open_cache = 4096
thread_cache_size = 128
thread_stack = 256k
tmp_table_size = 64M
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_read_io_threads = 8
join_buffer_size = 2M
max_heap_table_size = 64M
query_cache_limit = 2M
query_cache_min_res_unit = 2048
query_cache_size = 196M
query_cache_type = 1
table_open_cache_instances = 8
table-definition-cache = 4096
key_buffer_size = 16M
back_log = 1500
innodb_purge_threads = 2
innodb_sort_buffer_size = 2M
binlog_cache_size = 128K
binlog_stmt_cache_size = 1M
max_allowed_packet = 32MB
------------------------------------
Applied Nginx cnf changes
worker_processes 4;
worker_rlimit_nofile 100000;
events{
worker_connections 4000;
use epoll;
multi_accept on;
}
http{
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
fastcgi_read_timeout 240;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;
keepalive_timeout 180;
keepalive_requests 100000;
}
PHP-FPM Changes :-
/etc/php/7.4/fpm/pool.d/www.conf
listen = /run/php/php7.4-fpm.sock
-------------------------------
/etc/nginx/sites-available/site.conf
location ~ [^/]\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
--------------------------------------
Course Level activities :-
predefined activities,
skipped forum,
interactive videos,
interactive presentation,
upload video,
attempt video,
scrom
------------------------------------
Hard Disk Utilization- 2/30GB
Size = 50GB
Used = 30GB
Avail = 20GB
However, after this we moved onto increasing the hardware specs to 8 CPU and 16GB Ram, and tried testing for 600 users and 700 users, but it kept on failing. We tried changing settings but no improvement. Our max CPU usage for this server was 34% and ram was 3.2/16 GB.
The instance kept on giving ‘Error-502 Bad Gateway’.
What could be the possible issue in this case?
https://moodle.org/mod/forum/discuss.php?d=422436