Hi all,

I realized that I do not really know how memory works. I recently found my mail server was very slow and when I looked at the memory usage with htop, I noticed that NetBSD was swapping. I though that ~4 GB of memory was sufficient for programs that I considered light: Postfix, Dovecot, OpenSSH, NGINX (only for proxy). I think the fatest program is Rspamd.

When I boot the VM, the memory usage is correct: 218M. I do not know what the SIZE column is. The manual of top says it is the total size of the process. I am surprised that an instance of sshd is about 80 MB. I see the RES column seems more consistent with what I could expect: 4368 KB for sshd seems correct. My question is probably naive, but what is the difference? What could sshd do with 76 MB of memory?

load averages: 0.23, 0.12, 0.05; up 0+00:03:39 09:34:55
61 processes: 59 sleeping, 2 on CPU
CPU states: 0.1% user, 0.0% nice, 0.4% system, 0.1% interrupt, 99.4% idle
Memory: 218M Act, 112K Wired, 25M Exec, 111M File, 3661M Free
Swap: 8192M Total, 8192M Free

PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND 881 rspamd 85 0 162M 15M kqueue/0 0:00 0.00% 0.00% rspamd-2.1 652 rspamd 85 0 161M 11M kqueue/0 0:00 0.00% 0.00% rspamd-2.1 670 rspamd 85 0 161M 10M kqueue/0 0:00 0.00% 0.00% rspamd-2.1 758 root 85 0 160M 7168K kqueue/1 0:00 0.00% 0.00% rspamd-2.1
 1037 root      85    0   116M 8908K nanosl/1   0:03  0.00%  0.00% perl
104 rrdcache 43 0 116M 2840K parked/0 0:00 0.00% 0.00% rrdcached
   75 postfix   85    0    80M 7940K kqueue/0   0:00  0.00%  0.00% smtpd
   66 root      85    0    80M 5856K select/1   0:00  0.00%  0.00% sshd
 1198 triaxx    85    0    80M 4368K select/0   0:00  0.00%  0.00% sshd
 1108 triaxx    85    0    80M 4384K select/0   0:00  0.00%  0.00% sshd
  370 root      85    0    80M 5848K select/0   0:00  0.00%  0.00% sshd
 1260 triaxx    85    0    80M 4360K select/1   0:00  0.00%  0.00% sshd
 1021 root      85    0    80M 5852K select/1   0:00  0.00%  0.00% sshd
  130 postfix   85    0    79M 8008K lockf/0    0:00  0.00%  0.00% smtpd
  354 postfix   85    0    79M 8020K lockf/0    0:00  0.00%  0.00% smtpd
   73 postfix   85    0    79M 7972K kqueue/1   0:00  0.00%  0.00% smtpd
 1095 postfix   85    0    79M 7952K lockf/0    0:00  0.00%  0.00% smtpd
1023 postfix 85 0 79M 6544K kqueue/0 0:00 0.00% 0.00% tlsmgr 1111 root 85 0 75M 4136K kqueue/1 0:00 0.00% 0.00% master
  581 postfix   85    0    75M 6188K kqueue/1   0:00  0.00%  0.00% qmgr
  989 postfix   85    0    75M 6212K kqueue/0   0:00  0.00%  0.00% anvil
853 postfix 85 0 75M 6196K kqueue/1 0:00 0.00% 0.00% proxymap

After some days (~7), I get a more problematic memory usage. I see that rspamd took a little weight, but it is not alarming. However, I have now 2647 MB of active memory and 2328 of them are for files. I would be very grateful of any advice that could help me to understand what is the issue and which program consumes so much memory.

load averages: 0.04, 0.07, 0.07; up 7+05:18:48 09:29:51
68 processes: 66 sleeping, 2 on CPU
CPU states: 0.6% user, 0.0% nice, 1.0% system, 0.0% interrupt, 98.4% idle Memory: 2647M Act, 1308K Inact, 132K Wired, 115M Exec, 2328M File, 818M Free
Swap: 8192M Total, 8192M Free

PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND 891 rspamd 85 0 255M 120M kqueue/0 0:21 0.05% 0.05% rspamd-1.9.4 824 rspamd 85 0 163M 13M kqueue/1 0:26 0.00% 0.00% rspamd-1.9.4 719 rspamd 85 0 163M 15M kqueue/0 ??? 0.00% 0.00% rspamd-1.9.4 697 root 85 0 161M 7680K kqueue/1 0:01 0.00% 0.00% rspamd-1.9.4 870 rrdcache 43 0 118M 2852K parked/0 ??? 0.00% 0.00% rrdcached
  169 root      85    0   116M 9172K nanosl/0    ???  0.00%  0.00% perl
 1108 triaxx    85    0    83M 4324K select/0    ???  0.00%  0.00% sshd
   74 root      85    0    82M 5788K select/0   0:00  0.00%  0.00% sshd
  137 triaxx    85    0    81M 4336K select/0    ???  0.00%  0.00% sshd
  418 root      85    0    80M 5796K select/1   0:00  0.00%  0.00% sshd
21804 triaxx    85    0    80M 4388K select/0   0:01  0.00%  0.00% sshd
15853 root      85    0    80M 5892K select/1   0:00  0.00%  0.00% sshd
  773 triaxx    85    0    80M 4396K select/0   2:26  0.00%  0.00% sshd
 1060 root      85    0    80M 5804K select/0   0:00  0.00%  0.00% sshd
24791 postfix   85    0    79M 8408K lockf/0    0:00  0.00%  0.00% smtpd
29154 postfix   85    0    79M 8376K select/0    ???  0.00%  0.00% smtpd
28912 postfix   85    0    79M 8328K kqueue/1    ???  0.00%  0.00% smtpd
21134 postfix   85    0    79M 8312K lockf/0     ???  0.00%  0.00% smtpd
 7654 postfix   85    0    79M 8100K select/0    ???  0.00%  0.00% smtpd
12732 postfix   85    0    79M 8092K kqueue/0    ???  0.00%  0.00% smtpd
27146 postfix   85    0    79M 8328K select/0    ???  0.00%  0.00% smtpd
1085 postfix 85 0 79M 6584K kqueue/1 0:01 0.00% 0.00% tlsmgr

Reply via email to