Open freephile opened 6 years ago
Are you proposing some change like "For a server with X gigabytes of RAM, 1/Y gigabytes of RAM should be allocated to Apache"? In absence of a user-specified value in public.yml
or secret.yml
we could calculate such a value.
Meza can be unstable, even with 2GB of RAM, unless configured properly
In our staging environment on AWS, using t2.small instances, our DB server tends to crash. The simple reason for this is that Meza does not configure Apache for performance, and the defaults are far too high for a small server. (Apache ends up using all the RAM, and the OS ends up killing MySQL)
Environment
Note: I do NOT recommend using t2.small instances at all, and find much better pound for pound performance at Digital Ocean compared to AWS.
clear ; w ; echo '' ; df -h ; echo '' ; free -m ; echo '' ; service httpd status ; service mysqld status
Issue details
As described here, MySQL can crash when the system is starved of memory. It's not Meza's fault. It's not MySQL's fault. It's just a symptom of an overloaded machine. Apache hogs too much memory and the Linux kernel's OOM process reaper sacrifices MySQL to keep the system up. This is most likely to happen if you're forced to deploy in a monolith (everything on one node); or "mixed" environment (where your DB server is also an app-server.)
In Meza, the default
innodb_buffer_pool
size is 256M - which is hardly 'too big'. It's just that depending on the size of the environment you're trying to run on, this may be in fact "too big for you". From src/roles/database/defaults/main.ymlmysql_innodb_buffer_pool_size: "256M"
You can change this value, or you can override it with a '.cnf' file using the
mysql_config_include_files
Meza option.You can alleviate some issues if you make sure that the database server is dedicated to being ONLY a database server in Meza.
On the other hand, you can limit Apache to take up less memory if you're forced to deploy in a monolith or "mixed" environment (meaning your DB server is also an app-server). I've created a discussion thread over at https://discourse.equality-tech.com/t/how-do-i-optimize-apache/115 to focus on the performance tuning of Apache for Meza
Not related to MySQL or Apache; or even system stability, but if you run into memory errors during play execution, you can set the "forks" option in Ansible to 1 by either editing the system-wide config in
/etc/ansible/ansible.cfg
, or the Meza-specific config at/opt/meza/config/core/ansible.cfg
Finally, if Meza were to support or convert to running on NginX, then it would likely have lower memory requirements.