
I found a nifty trick for measuring the resource consumption of various services using systemd. This was while trying to gauge the differences between Mailman v2 and Mailman v3 resource management. I have ranted about how much more expensive MM3 is in resource consumption (basically, about ¾ of a 2GB RAM VPS is consumed). I wanted further details. What I found was, a setting (or several) that systemd provides: There are a couple methods for enabling the *Accounting= features: Edit /etc/systemd/system.conf and enabling: DefaultCPUAccounting=yes DefaultIOAccounting=yes DefaultIPAccounting=yes DefaultBlockIOAccounting=yes DefaultMemoryAccounting=yes DefaultTasksAccounting=yes If one wants it for a single service, also a couple methods: systemctl set-property mailman3 TasksAccounting=yes MemoryAccounting=yes systemctl daemon-reload Or add these lines (my preferred method, no systemctl daemon-reload needed): # systemctl edit mailman3 [Service] MemoryAccounting=yes TasksAccounting=yes Or: do it manually This makes it really easy to measure resources used by a service that has many processes running, i.e.: # systemctl status mailman ... Tasks: 9 (limit: 2256) Memory: 46.5M CGroup: /system.slice/mailman.service ├─1054 /usr/bin/python2 /usr/lib/mailman/bin/mailmanctl ├─1056 /usr/bin/python2 /var/lib/mailman/bin/qrunner ├─1057 /usr/bin/python2 /var/lib/mailman/bin/qrunner ├─1058 /usr/bin/python2 /var/lib/mailman/bin/qrunner ├─1067 /usr/bin/python2 /var/lib/mailman/bin/qrunner ├─1068 /usr/bin/python2 /var/lib/mailman/bin/qrunner ├─1071 /usr/bin/python2 /var/lib/mailman/bin/qrunner ├─1083 /usr/bin/python2 /var/lib/mailman/bin/qrunner └─1084 /usr/bin/python2 /var/lib/mailman/bin/qrunner And for comparison, mailman 3 (which has TWO service files): # systemctl status mailman3 ... Tasks: 17 Memory: 889.9M CGroup: /system.slice/mailman3.service ├─4112698 /opt/mailman/venv/bin/python ├─4112711 /opt/mailman/venv/bin/python ├─4112712 /opt/mailman/venv/bin/python ├─4112713 /opt/mailman/venv/bin/python ├─4112714 /opt/mailman/venv/bin/python ├─4112715 /opt/mailman/venv/bin/python ├─4112717 /opt/mailman/venv/bin/python ├─4112718 /opt/mailman/venv/bin/python ├─4112719 /opt/mailman/venv/bin/python ├─4112720 /opt/mailman/venv/bin/python ├─4112721 /opt/mailman/venv/bin/python ├─4112725 /opt/mailman/venv/bin/python ├─4112726 /opt/mailman/venv/bin/python ├─4112790 /opt/mailman/venv/bin/python └─4112791 /opt/mailman/venv/bin/python # systemctl status mailman3-web ... Tasks: 12 Memory: 182.4M CGroup: /system.slice/mailman3-web.service ├─4112890 /opt/mailman/venv/bin/uwsgi ├─4112904 /opt/mailman/venv/bin/uwsgi ├─4112905 /opt/mailman/venv/bin/uwsgi ├─4112906 /bin/sh ... ├─4112908 /opt/mailman/venv/bin/python ├─4112910 /opt/mailman/venv/bin/python ├─4112912 /opt/mailman/venv/bin/python ├─4112913 /opt/mailman/venv/bin/python ├─4112914 /opt/mailman/venv/bin/python └─4112915 /opt/mailman/venv/bin/python It's now quite clear: mm2 uses 9 process and < 50 MB RAM, but MM3 uses 17+12=29 processes (and that's with the default NNTP bridge disabled), and 889.9+182.4=1072.3 MB RAM. That's a *lot* of Python processes! Also, both require Apache (or NGINX), and MM3 requires PostgreSQL. As it is, I can see a lot of small mailing list users abandoning MM3 over this issue (plus its complexity). For my list, that's about one Python interpreter loaded into RAM for each list subscriber!