Swap usage with 16gb of RAM o.O



  • Hello guys!

    I have a Mac mini with 16gb of RAM installed, but I just noticed that the pfsense box is using 1% of the 32gb of Swap. Is this normal, is this a bug?

    I will try to post as much info as I can below:

    top -o size command output

    last pid: 25917;  load averages:  1.08,  0.91,  0.61                           up 17+19:30:31  15:47:17
    54 processes:  1 running, 53 sleeping
    CPU:  8.4% user,  0.0% nice,  6.4% system,  8.3% interrupt, 76.9% idle
    Mem: 1768M Active, 11G Inact, 2238M Wired, 185M Cache, 1843M Buf, 67M Free
    Swap: 32G Total, 298M Used, 32G Free
    
      PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
    76785 proxy      17  20    0  4710M  4216M uwait   1  27:03  54.98% squid
    22577 root       15  20    0  1275M  1076M kqread  2 259:55   2.73% ntopng
    30460 unbound     4  20    0   583M   507M kqread  0 535:03   0.00% unbound
    22560 root        1  20    0   253M 23736K nanslp  1  26:51   0.00% php
    14054 root        1  23    0   233M 26620K accept  2   0:00   0.98% php-fpm
      246 root        1  24    0   229M 11524K kqread  3   1:13   0.00% php-fpm
    76447 proxy       1  52    0 73644K  6804K wait    2   0:00   0.00% squid
    45423 root        1  20    0 71040K 10964K select  3   7:53   0.00% bsnmpd
    28114 root        1  20    0 65076K  4828K kqread  2   1:38   0.00% lighttpd
     9459 root        1  20    0 56752K  7156K kqread  1   5:31   0.00% lighttpd_pfb
    75081 root        1  20    0 55628K  5992K select  3   0:00   0.00% sshd
    19663 root        1  52    0 43568K  1784K wait    3   0:00   0.00% login
     7820 root        1  20    0 32424K  3780K select  0   0:00   0.00% sshd
    87302 root        1  20    0 28344K 18104K select  3   2:49   0.00% ntpd
    22985 root        1  20    0 28328K  2020K piperd  3   0:26   0.00% rrdtool
    19298 root        3  37    0 28156K  4948K uwait   2  34:59   0.00% redis-server
    37858 dhcpd       1  20    0 24844K  5284K select  1   2:20   0.00% dhcpd
    15139 proxy       1  20    0 24080K  2924K select  2   0:21   0.00% pinger
    75247 proxy       1  20    0 24080K  2920K select  2   0:19   0.00% pinger
    63326 proxy       1  20    0 24080K  2920K select  0   0:15   0.00% pinger
    53369 proxy       1  20    0 24080K  2920K select  3   0:06   0.00% pinger
     5578 proxy       1  20    0 24080K  2540K select  3   0:28   0.00% pinger
    77105 proxy       1  20    0 24080K  2528K select  3   0:27   0.00% pinger
    83503 root        1  20    0 21988K  2976K CPU1    1   0:00   0.00% top
    17674 root        1  20    0 21732K  4664K select  1   8:10   0.00% openvpn
    53296 root        1  20    0 21160K  4228K select  1   4:56   0.00% miniupnpd
      261 root        1  40   20 19024K  1980K kqread  0   0:00   0.00% check_reload_status
      263 root        1  52   20 19024K  1748K kqread  3   0:00   0.00% check_reload_status
    19584 root        1  20    0 18780K  1960K select  1   0:00   0.00% inetd
    82779 root        1  44    0 17476K  3492K pause   2   0:00   0.00% tcsh
    80773 root        1  52    0 17136K  2348K wait    2   0:00   0.00% sh
    74340 root        1  25    0 17136K  2272K wait    2   0:05   0.00% sh
    48779 root        1  52   20 17136K  1956K wait    3   3:53   0.00% sh
    20417 root        1  29    0 17136K  1888K ttyin   2   0:00   0.00% sh
    20168 root        1  52    0 17136K  1888K wait    0   0:00   0.00% sh
    

    uname -a output

    [2.2.6-RELEASE][admin@fserver.home]/root: uname -a
    FreeBSD fserver.home 10.1-RELEASE-p25 FreeBSD 10.1-RELEASE-p25 #0 c39b63e(releng/10.1)-dirty: Mon Dec 21 15:20:13 CST 2015 root@pfs22-amd64-builder:/usr/obj.RELENG_2_2.amd64/usr/pfSensesrc/src.RELENG_2_2/sys/pfSense_SMP.10  amd64
    

    General statistics

    Services running



  • Hello! Anyone has any ideas on what's going on? I have plenty of RAM available, so I'm not sure why the system is using my Swap one!



  • The swap usage is quite low, I would not be worried about it.
    Do you notice any performance hit?

    You can always disable swap, go to /etc/fstab and comment out or delete the swap mount line.



  • @Sova:

    The swap usage is quite low, I would not be worried about it.
    Do you notice any performance hit?

    You can always disable swap, go to /etc/fstab and comment out or delete the swap mount line.

    I didn't notice any performance hit to be honest, but it's quite intriguing why it's using swap when there's almost 80% free RAM!

    thanks!



  • I see squid running. I bet you had a memory spike once or more that caused some pages to get swapped out, but those pages have yet to be referenced again and just stay in limbo until the next time they are needed. Also, you don't need to reach 100% memory usage to get paging. Memory gets fragmented and if there are no large enough contiguous segments, the kernel may need to swap out pages to effectively defrag the memory.