Reference:
How do I avoid Gunicorn excessively blocking in os.fchmod
?
Gunicorn FAQ - Trouble Shooting
Gunicorn’s heartbeat system call os.fchmod
on temporary file handlers, which on Ubuntu systems is a disk-backed filesystem.
$ df /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 65876900 14405276 51455240 22% /
This causes Gunicorn workers to sometimes hang for half a minute.
Fortunately, Ubuntu already has tmpfs
mount at /dev/shm
$ df /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 4076240 0 4076240 0% /dev/shm
To solve this problem, we must set the parameter --worker-tmp-dir /dev/shm on the supervisor.conf
command=/home/frappe/bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 4 -t 120 frappe.app:application --preload --worker-tmp-dir /dev/shm
Would it be good to have worker-tmp-dir parameter in the common_site_config.json file to set this temporary directory parameter of gunicorn?