System tools
Collecting the contents of every .htaccess file of a website
Section titled “Collecting the contents of every .htaccess file of a website”Since we use NGINX and not Apache, the contents of the .htaccess files have to be checked to know what needs to be implemented as an equivalent NGINX rule:
collect-htaccess.sh <user> [subdirectory]Measuring the memory footprint of a gunicorn worker
Section titled “Measuring the memory footprint of a gunicorn worker”Workers are forked from the master and share part of their pages: RSS therefore counts the same memory several times. PSS is the figure to read.
for pid in $(cat /sys/fs/cgroup/system.slice/<service>.service/cgroup.procs); do printf '%6s %5s MB %s\n' "$pid" \ "$(( $(awk '/^Pss:/{print $2}' /proc/$pid/smaps_rollup) / 1024 ))" \ "$(tr '\0' ' ' < /proc/$pid/cmdline | cut -c1-60)"doneThe first PID is the master, the following ones are the workers. The total for the service, as a cross-check:
systemctl show -p MemoryCurrent <service>.serviceMeasure after real traffic, not right after startup: the footprint grows with loaded modules and caches. The value of one worker, rounded up, goes into per_worker_mb of the site's hiera declaration, which is used to compute the number of workers. Repeat after a major version upgrade or after adding a heavy dependency.
