Consumo excessivo de RAM - Travamento



  • Prezados,

    Bom dia!

    Tenho observado nos últimos meses, a necessidade de reiniciar meu PF, pois vem apresentando picos de 98% de uso da memória RAM e em determinados momentos a navegação trava ou apresenta lentidão.
    Minhas configurações

    code
    Version	2.4.2-RELEASE (amd64) 
    built on Mon Nov 20 08:12:56 CST 2017 
    FreeBSD 11.1-RELEASE-p4 
    
    CPU Type	Intel(R) Core(TM) i5-3570T CPU @ 2.30GHz
    Current: 2300 MHz, Max: 2301 MHz
    4 CPUs: 1 package(s) x 4 core(s)
    AES-NI CPU Crypto: Yes (inactive)
    

    Temperatura de uso do processador = 27.9°C
    Processamento e Uso de memória

    code
    Load average	
    0.37, 0.34, 0.26
    CPU usage	
    15%
    Memory usage	
    98% of 7851 MiB
    SWAP usage	
    54% of 4096 MiB
    Disk usage:	
         /	
    2% of 140GiB - ufs
         /var/run	
    4% of 3.4MiB - ufs in RAM
    

    Comando TOP

    code
    Primeira medição 
    last pid: 15796;  load averages:  0.16,  0.13,  0.15    up 7+00:10:55  10:20:59
    58 processes:  2 running, 56 sleeping
    CPU:  1.4% user, 11.9% nice,  3.2% system,  0.0% interrupt, 83.6% idle
    Mem: 306M Active, 233M Inact, 6017M Laundry, 961M Wired, 253M Buf, 117M Free
    Swap: 4096M Total, 2212M Used, 1883M Free, 54% Inuse
    
      PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
    72799 root       12005 20    0  8581M  6717M sigwai  2 141:35   6.13% e2guardia
    97538 root          1  25    0 20056K  3316K CPU1    1   0:00   1.28% top
    70597 root          1  52    0   263M 28088K accept  3   0:00   0.08% php-fpm
    49415 root          1  20    0 39756K  4608K kqread  0   0:36   0.05% nginx
    44659 root          1  52   20 13084K   980K piperd  0   0:41   0.04% sh
    25014 unbound       4  20    0 89312K 26532K kqread  3   1:46   0.03% unbound
    79917 root          1  20    0 78840K  7648K select  2   0:00   0.01% sshd
    65085 dhcpd         1  20    0 16652K  3232K select  3   0:31   0.01% dhcpd
    11094 root          5  52    0 10980K  2008K uwait   0   0:41   0.01% dpinger
    13548 root          1  20    0 10480K  2068K select  2   0:20   0.01% syslogd
    10648 root          5  52    0 10980K  2008K uwait   2   0:41   0.01% dpinger
    50613 root          1  20    0 24608K 12428K select  2   0:19   0.00% ntpd
    30816 root          1  20    0 12696K  1868K bpf     2   0:25   0.00% filterlog
      321 root          1  20    0   259M 14896K kqread  2   0:09   0.00% php-fpm
    84277 proxy         1  20    0 10348K   984K kqread  0   0:02   0.00% ftp-proxy
    54702 root       6779  20    0  5201M   108M urdlck  2  53:36   0.00% filterdns
    49319 root          1  20    0 39756K  4176K kqread  1   0:31   0.00% nginx
    last pid: 29287;  load averages:  0.15,  0.13,  0.14                                                             up 7+00:10:57  10:21:01
    56 processes:  1 running, 55 sleeping
    CPU:  0.0% user,  0.0% nice,  2.6% system,  0.0% interrupt, 97.4% idle
    Mem: 304M Active, 235M Inact, 6017M Laundry, 961M Wired, 253M Buf, 117M Free
    Swap: 4096M Total, 2212M Used, 1883M Free, 54% Inuse
    
      PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
    97538 root          1  23    0 20056K  3432K CPU1    1   0:00  15.26% top
    72799 root       12005 20    0  8581M  6717M sigwai  2 141:35   2.78% e2guardian
    25014 unbound       4  20    0 89312K 26532K kqread  2   1:46   0.13% unbound
    79917 root          1  20    0 78840K  7684K select  2   0:00   0.10% sshd
    10648 root          5  52    0 10980K  2008K uwait   2   0:41   0.03% dpinger
    65085 dhcpd         1  20    0 16652K  3232K select  0   0:31   0.02% dhcpd
    54702 root       6779  20    0  5201M   108M urdlck  2  53:36   0.00% filterdns
    44659 root          1  52   20 13084K   980K wait    3   0:41   0.00% sh
    11094 root          5  52    0 10980K  2008K uwait   0   0:41   0.00% dpinger
    49415 root          1  20    0 39756K  4608K kqread  0   0:36   0.00% nginx
    49319 root          1  20    0 39756K  4176K kqread  1   0:31   0.00% nginx
    30816 root          1  20    0 12696K  1868K bpf     2   0:25   0.00% filterlog
    13548 root          1  20    0 10480K  2068K select  2   0:20   0.00% syslogd
    50613 root          1  20    0 24608K 12428K select  3   0:19   0.00% ntpd
    49176 root          1  20    0 37708K  4264K kqread  0   0:18   0.00% nginx
      321 root          1  20    0   259M 14896K kqread  2   0:09   0.00% php-fpm
    49984 root          1  46    0 12496K   752K nanslp  1   0:03   0.00% cron
    84277 proxy         1  20    0 10348K   984K kqread  0   0:02   0.00% ftp-proxy
    48984 root          1  20    0 37708K  3864K kqread  0   0:01   0.00% nginx
     3553 _dhcp         1  20    0 10528K  2132K select  0   0:00   0.00% dhclient
    48960 root          1  20    0 37708K  1344K kqread  0   0:00   0.00% nginx
    70597 root          1  52    0   263M 28116K accept  1   0:00   0.00% php-fpm
      350 root          1  20    0  9556K   948K select  0   0:00   0.00% devd
    19197 root          1  37    0  8224K   336K nanslp  3   0:00   0.00% minicron
    98603 root          1  52    0 10528K  2072K select  2   0:00   0.00% dhclient
    29256 _dhcp         1  20    0 10528K  1948K select  0   0:00   0.00% dhclient
      335 root          1  40   20 19440K     0K kqread  2   0:00   0.00% <check_reload_stat>
    19831 root          1  20    0  8224K   336K nanslp  3   0:00   0.00% minicron
    24171 root          1  20    0 10528K  2016K select  3   0:00   0.00% dhclient
    54162 root          2  20    0 10580K  2024K piperd  2   0:00   0.00% sshlockout_pf
    95025 root          1  52    0 13392K  3632K pause   0   0:00   0.00% tcsh
    96072 root          1  52   20 13084K     0K wait    0   0:00   0.00% <sh>
    53178 root          1  52    0 39432K     0K wait    3   0:00   0.00% <login>
    92043 root          1  52    0 13084K  2384K wait    1   0:00   0.00% sh
    last pid:  1626;  load averages:  0.22,  0.14,  0.14                                                                                                                                                                 up 7+00:14:06  10:24:10
    56 processes:  1 running, 55 sleeping
    CPU:  0.3% user,  0.0% nice,  1.1% system,  0.3% interrupt, 98.4% idle
    Mem: 302M Active, 240M Inact, 6017M Laundry, 961M Wired, 253M Buf, 114M Free
    Swap: 4096M Total, 2212M Used, 1883M Free, 54% Inuse
    
      PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
    97538 root          1  20    0 20056K  3660K CPU3    3   0:02   1.99% top
    72799 root       12005 20    0  8581M  6719M sigwai  1 141:46   0.08% e2guardian
    61880 root          1  20    0 13084K  2620K wait    1   0:00   0.04% sh
    25014 unbound       4  20    0 89312K 26532K kqread  3   1:46   0.03% unbound
    79917 root          1  20    0 78840K  7700K select  2   0:00   0.02% sshd
    11094 root          5  52    0 10980K  2008K uwait   0   0:41   0.01% dpinger
    30816 root          1  20    0 12696K  1868K bpf     3   0:25   0.01% filterlog
    13548 root          1  20    0 10480K  2068K select  2   0:20   0.01% syslogd
    65085 dhcpd         1  20    0 16652K  3232K select  0   0:31   0.01% dhcpd
    50613 root          1  20    0 24608K 12428K select  1   0:19   0.01% ntpd
    10648 root          5  52    0 10980K  2008K uwait   2   0:41   0.01% dpinger
      321 root          1  20    0   259M 14896K kqread  2   0:09   0.00% php-fpm
    49415 root          1  20    0 39756K  4608K kqread  1   0:36   0.00% nginx
    54702 root       6779  20    0  5201M   108M urdlck  2  53:36   0.00% filterdns
    44659 root          1  52   20 13084K   980K wait    1   0:41   0.00% sh
    49319 root          1  20    0 39756K  4176K kqread  1   0:31   0.00% nginx
    49176 root          1  20    0 37708K  4264K kqread  1   0:18   0.00% nginx
    49984 root          1  46    0 12496K   752K nanslp  1   0:03   0.00% cron
    84277 proxy         1  20    0 10348K   984K kqread  1   0:02   0.00% ftp-proxy
    48984 root          1  20    0 37708K  3864K kqread  3   0:01   0.00% nginx
     3553 _dhcp         1  20    0 10528K  2132K select  3   0:00   0.00% dhclient
    30043 root          1  52    0   265M 28804K accept  0   0:00   0.00% php-fpm
    48960 root          1  20    0 37708K  1344K kqread  3   0:00   0.00% nginx
      350 root          1  20    0  9556K   948K select  0   0:00   0.00% devd
    19197 root          1  37    0  8224K   336K nanslp  2   0:00   0.00% minicron
    98603 root          1  52    0 10528K  2072K select  2   0:00   0.00% dhclient
    29256 _dhcp         1  20    0 10528K  1948K select  1   0:00   0.00% dhclient
      335 root          1  40   20 19440K     0K kqread  2   0:00   0.00% <check_reload_stat>
    19831 root          1  20    0  8224K   336K nanslp  3   0:00   0.00% minicron
    24171 root          1  52    0 10528K  2016K select  0   0:00   0.00% dhclient
    54162 root          2  20    0 10580K  2024K piperd  2   0:00   0.00% sshlockout_pf
    95025 root          1  52    0 13392K  3632K pause   0   0:00   0.00% tcsh
    96072 root          1  52   20 13084K     0K wait    0   0:00   0.00% <sh>
    53178 root          1  52    0 39432K     0K wait    3   0:00   0.00% <login>
    92043 root          1  52    0 13084K  2384K wait    1   0:00   0.00% sh
    54197 root          1  52    0 13084K     0K wait    2   0:00   0.00% <sh>
     7610 root          1  20    0 53492K  5336K select  0   0:00   0.00% sshd
    54259 root          1  52    0 13084K  1996K ttyin   1   0:00   0.00% sh
    53315 root          1  52    0 10388K  1732K ttyin   2   0:00   0.00% getty
    53787 root          1  52    0 10388K  1732K ttyin   3   0:00   0.00% getty
    48687 root          1  52    0 35660K     0K pause   3   0:00   0.00% <nginx>
    53568 root          1  52    0 10388K  1732K ttyin   3   0:00   0.00% getty
    53523 root          1  52    0 10388K  1732K ttyin   3   0:00   0.00% getty
    53862 root          1  52    0 10388K  1732K ttyin   2   0:00   0.00% getty
    53863 root          1  52    0 10388K  1732K ttyin   2   0:00   0.00% getty
    53566 root          1  52    0 10388K  1732K ttyin   1   0:00   0.00% getty
    20481 root          1  20    0  8224K   336K nanslp  0   0:00   0.00% minicron
     1626 root          1  21    0  6172K  1928K nanslp  3   0:00   0.00% sleep
    99376 root          1  52   20  6172K     0K nanslp  3   0:00   0.00% <sleep>
    94614 root          1  52   20  6172K  1928K nanslp  0   0:00   0.00% sleep
    61738 root          1  20    0 12496K  1728K piperd  1   0:00   0.00% cron
    95183 root          1  20    0 12496K  1684K piperd  3   0:00   0.00% cron
    18986 root          1  52    0  8224K     0K wait    1   0:00   0.00% <minicron>
    20047 root          1  52    0  8224K     0K wait    0   0:00   0.00% <minicron>
    19470 root          1  52    0  8224K     0K wait    1   0:00   0.00% <minicron>
    
    Segunda Medição
    
    last pid: 51455;  load averages:  0.25,  0.22,  0.17                                                                                                                                                                 up 7+00:19:28  10:29:32
    56 processes:  1 running, 55 sleeping
    CPU:  1.4% user,  0.0% nice,  1.1% system,  0.0% interrupt, 97.4% idle
    Mem: 352M Active, 21M Inact, 6125M Laundry, 961M Wired, 254M Buf, 175M Free
    Swap: 4096M Total, 2218M Used, 1878M Free, 54% Inuse
    
      PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
    72799 root       12005 20    0  8597M  6662M sigwai  3 142:14   2.62% e2guardian
    22649 root          1  52    0   265M 28124K accept  3   0:00   1.46% php-fpm
    30614 root          1  20    0 20056K  3208K CPU3    3   0:02   1.22% top
    49319 root          1  20    0 39756K  4180K kqread  1   0:31   0.06% nginx
    79917 root          1  20    0 78840K  7300K select  0   0:00   0.01% sshd
    11094 root          5  52    0 10980K  2008K uwait   0   0:41   0.01% dpinger
    25014 unbound       4  20    0 89312K 26532K kqread  0   1:47   0.01% unbound
    10648 root          5  52    0 10980K  2008K uwait   2   0:41   0.01% dpinger
    65085 dhcpd         1  20    0 16652K  3104K select  3   0:31   0.01% dhcpd
    50613 root          1  20    0 24608K 12428K select  2   0:19   0.01% ntpd
    13548 root          1  20    0 10480K  2024K select  2   0:20   0.01% syslogd
    84277 proxy         1  20    0 10348K   984K kqread  3   0:02   0.00% ftp-proxy
      321 root          1  20    0   259M 14892K kqread  2   0:09   0.00% php-fpm
    30816 root          1  20    0 12696K  1868K bpf     1   0:25   0.00% filterlog
    54702 root       6779  20    0  5201M   108M urdlck  2  53:36   0.00% filterdns
    44659 root          1  52   20 13084K   920K wait    0   0:41   0.00% sh
    49415 root          1  20    0 39756K  4604K kqread  2   0:36   0.00% nginx
    49176 root          1  20    0 37708K  4032K kqread  1   0:18   0.00% nginx
    49984 root          1  31    0 12496K   724K nanslp  3   0:03   0.00% cron
    48984 root          1  20    0 37708K   736K kqread  3   0:01   0.00% nginx
     3553 _dhcp         1  20    0 10528K  2116K select  3   0:00   0.00% dhclient
    48960 root          1  20    0 37708K    16K kqread  0   0:00   0.00% nginx
      350 root          1  20    0  9556K   472K select  1   0:00   0.00% devd
    19197 root          1  37    0  8224K   336K nanslp  2   0:00   0.00% minicron
    98603 root          1  52    0 10528K  2060K select  2   0:00   0.00% dhclient
    29256 _dhcp         1  20    0 10528K  1948K select  1   0:00   0.00% dhclient
      335 root          1  40   20 19440K     0K kqread  2   0:00   0.00% <check_reload_stat>
    19831 root          1  20    0  8224K     0K nanslp  3   0:00   0.00% <minicron>
    95025 root          1  20    0 13392K     0K pause   0   0:00   0.00% <tcsh>
    24171 root          1  52    0 10528K  2016K select  0   0:00   0.00% dhclient
    54162 root          2  20    0 10580K  1992K piperd  2   0:00   0.00% sshlockout_pf
    96072 root          1  52   20 13084K     0K wait    0   0:00   0.00% <sh>
    53178 root          1  52    0 39432K     0K wait    3   0:00   0.00% <login>
    95175 root          1  20    0 13084K  2504K wait    0   0:00   0.00% sh
    92043 root          1  52    0 13084K     0K wait    1   0:00   0.00% <sh>
    54197 root          1  52    0 13084K     0K wait    2   0:00   0.00% <sh>
     7610 root          1  20    0 53492K  5116K select  0   0:00   0.00% sshd
    54259 root          1  52    0 13084K  1996K ttyin   1   0:00   0.00% sh
    53315 root          1  52    0 10388K  1732K ttyin   2   0:00   0.00% getty
    53787 root          1  52    0 10388K  1732K ttyin   3   0:00   0.00% getty
    48687 root          1  52    0 35660K     0K pause   3   0:00   0.00% <nginx>
    53568 root          1  52    0 10388K  1732K ttyin   3   0:00   0.00% getty
    53523 root          1  52    0 10388K  1732K ttyin   3   0:00   0.00% getty
    53862 root          1  52    0 10388K  1732K ttyin   2   0:00   0.00% getty
    53863 root          1  52    0 10388K  1732K ttyin   2   0:00   0.00% getty
    53566 root          1  52    0 10388K  1732K ttyin   1   0:00   0.00% getty
    20481 root          1  20    0  8224K     0K nanslp  0   0:00   0.00% <minicron>
    49965 root          1  20    0  6172K  1928K nanslp  1   0:00   0.00% sleep
    99376 root          1  52   20  6172K     0K nanslp  3   0:00   0.00% <sleep>
    35161 root          1  52   20  6172K  1928K nanslp  3   0:00   0.00% sleep
    94624 root          1  20    0 12496K  1708K piperd  0   0:00   0.00% cron
    95183 root          1  20    0 12496K  1684K piperd  3   0:00   0.00% cron
    18986 root          1  52    0  8224K     0K wait    1   0:00   0.00% <minicron>
    20047 root          1  52    0  8224K     0K wait    0   0:00   0.00% <minicron>
    19470 root          1  52    0  8224K     0K wait    1   0:00   0.00% <minicron>
    
    

    Pacotes instalados

    code
    Installed Packages
    Name	Category	Version	Description	Actions
    Cron	sysutils	0.3.7_2	
    E2guardian5	www	0.5.0.4_1	
    
    Package Dependencies:
      squid-3.5.24_2 	  e2guardian5-5.0.2_8 	  ca_root_nss-3.30.2 			
    FTP_Client_Proxy	ftp	0.3_3	
    
    Package Dependencies:
      sarg-2.3.11 		
    Service_Watchdog	sysutils	1.8.4	
    
    Package Dependencies:
      vnstat-1.15 
    

    Quantidade de usuários pendurados no PF: 20
    Sempre que chega nesse nível, tenho que reiniciar o servidor para evitar travamentos e afins.

    Alguma dica para melhorar este cenário?



  • Acredito que pode ser essa versão, eu tinha um problema grave de uso de memória pelo snort não me recordo a qual versão que era, qual comando na console que você usou para exibir esses dados?



  • @dreivi vi que há atualização do pacote, mas receio que haja a necessidade de subir para o PF2.4.4, não?
    Na tentativa de atualizar apresenta a mensagem

    WARNING: Current pkg repository has a new PHP major
             version. pfSense should be upgraded before
             installing any new package.
    Failed