Memory usuage after reboot



  • pfsense 64bit on home pc 4gb ram using 17 to 18 percent ram no changes to install no add ons. After reboot pfsense using only 7 percent memory. If an update is available and pfsense reboots it will go back to 18 percent until reboot then drops back to 7 percent. Any ideas?



  • Is it even an issue if it only goes to 18%? After all, you paid for 100% of it...
    Or are you just curious? Are you running /tmp and /var in ramdisks?
    My own is sitting at 32% of 1.5GB after 3 days, and I'm fine with that.



  • @provels I believe 18 percent is the correct usuage, when it only uses 7 percent it seems slower all around, internet and gui. Ifs like after reboot pfsense cannot load as much of itself into ram. But if update happens it reboots and uses 18 percent again runs fast all is well. Problem is if i make changes reboots are needed which lowers the ram usage again and it seems slow


  • Netgate Administrator

    Have you been able to measure any perceived slowness?

    Try running top -aSH at the command line. What is using or not using the RAM?

    Steve



  • @stephenw10 said in Memory usuage after reboot:

    top -aSH

    Also dsl reports speed test has random spikes up to 2000ms down and upload as it cant keep up clearing the queue

    last pid: 87120; load averages: 0.25, 0.19, 0.17 up 0+16:39:35 20:36:05
    181 processes: 5 running, 156 sleeping, 20 waiting

    Mem: 25M Active, 109M Inact, 224M Wired, 32M Buf, 3311M Free
    Swap: 2862M Total, 2862M Free

    PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND
    11 root 155 ki31 0K 64K CPU0 0 998:03 100.00% [idle{idle: cpu0}]
    11 root 155 ki31 0K 64K CPU3 3 997:51 100.00% [idle{idle: cpu3}]
    11 root 155 ki31 0K 64K CPU2 2 997:01 100.00% [idle{idle: cpu2}]
    11 root 155 ki31 0K 64K RUN 1 998:17 98.88% [idle{idle: cpu1}]
    18086 root 26 0 88640K 32404K piperd 2 0:02 0.88% php-fpm: pool nginx (php-fpm)
    375 root 52 0 88512K 32468K accept 0 0:02 0.20% php-fpm: pool nginx (php-fpm)
    0 root -92 - 0K 432K - 1 1:26 0.00% [kernel{em0 que}]
    0 root -92 - 0K 432K - 3 0:35 0.00% [kernel{em1 que}]
    12 root -60 - 0K 320K WAIT 0 0:31 0.00% [intr{swi4: clock (0)}]
    0 root -16 - 0K 432K swapin 1 0:30 0.00% [kernel{swapper}]
    19 root -16 - 0K 16K pftm 1 0:11 0.00% [pf purge]
    21746 root 52 20 6968K 2600K wait 0 0:06 0.00% /bin/sh /var/db/rrd/updaterrd.sh
    80767 unbound 20 0 65056K 41420K kqread 0 0:04 0.00% /usr/local/sbin/unbound -c /var/unbound/unbound.conf{unbound}
    80767 unbound 20 0 65056K 41420K kqread 1 0:04 0.00% /usr/local/sbin/unbound -c /var/unbound/unbound.conf{unbound}
    80767 unbound 20 0 65056K 41420K kqread 3 0:04 0.00% /usr/local/sbin/unbound -c /var/unbound/unbound.conf{unbound}
    80767 unbound 20 0 65056K 41420K kqread 2 0:02 0.00% /usr/local/sbin/unbound -c /var/unbound/unbound.conf{unbound}
    64649 root 20 0 6900K 2344K nanslp 3 0:02 0.00% [dpinger{dpinger}]
    85390 root 20 0 12396K 12500K select 3 0:02 0.00% /usr/local/sbin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid{ntpd}



  • @abailey10

    State table size
    0% (168/378000) Show states
    MBUF Usage
    0% (4056/1000000)
    Temperature
    30.7°C
    Load average
    0.08, 0.15, 0.16
    CPU usage
    0%
    Memory usage
    7% of 3786 MiB
    SWAP usage
    0% of 2862 MiB
    Disk usage:
    /
    2% of 51GiB - ufs
    /tmp
    0% of 248MiB - ufs in RAM
    /var
    8% of 248MiB - ufs in RAM



  • No one else has this problem or even notice it? 50 percent drop in memory is significant when the os is loaded to ram


  • LAYER 8 Netgate

    @abailey10 said in Memory usuage after reboot:

    Any ideas?

    This looks like a complete non-problem to me. The operating system and the running applications uses memory for many things. If it is there, why not use it?

    This is what really matters:
    SWAP usage
    0% of 2862 MiB



  • @abailey10 said in Memory usuage after reboot:

    No one else has this problem or even notice it? ....

    What ? I missed something ?

    Using a bare bone, retired desktop PC with : an Intel(R) Pentium(R) 4 CPU 3.20GHz - 2 CPUs: 1 package(s) x 2 hardware threads

    (2 WAN, 3 LAN, some 20 devices on LAN and a boatload of captive portal users )

    @abailey10 said in Memory usuage after reboot:

    Also dsl reports speed test has random spikes up to 2000ms down and upload as it cant keep up clearing the queue

    This one http://www.dslreports.com/speedtest ?
    Just tested :

    88438c89-2392-4d63-ad95-b8b98ce0dbf0-image.png

    That's a less general discussion, and has it's own forum here.

    @abailey10 said in Memory usuage after reboot:

    as it cant keep up clearing the queue

    What queue ?
    The spikes can be removed, that's no a big issue.
    What stays : your LAN's are probably much faster as your WAN-to-the-Net-connection.
    So, pfSense will buffer while your uplink is being pushed to the max. Upstream signal 'converters' like cable or ADSL modems also inject there part of delays.



  • @Gertjan Lets stay to the point, the speed test was just to show performance drop at some point the gateway's access time spikes and the test show random high spikes happens on downloads only. The point is 18 percent memory on first install and everything works great. After rebooting pfsense it only uses 7 percent memory and the gateways have high access times and download has random spikes again.

    And by the way this network card has two hardware queue's 1 per port.



  • @abailey10 Im using fx 4100 3.6ghz quad core , 4gb ddr3 1333 cas 9, 2 port intel pro 1000pt, network card is plugged into pcie 2.0 x16.

    This wasnt a problem on earlier builds, but has been for the last several. As long as i never reboot after update it uses 18 percent memory again and all works great.


  • Netgate Administrator

    Mmm, I think the memory usage you are seeing there is probably not directly related to any slowness you're seeing.

    2000ms ping spike are obviously an issue. If that's actually caused by the firewall I would expect to see a big CPU spike recorded at that time. I have seen systems present like that if they get stuck in a filter-reload loop on occasion. You would see that in the system log though.
    If it's something else upstream it might cleared by re-connecting the WAN or rebooting your modem maybe.

    Steve



  • pfsense seems to have memory issues, i tired 3 other firewalls including opensense , they all work without this issue.



  • @abailey10 I would just use something else then.



  • pfSense is the factor that we all have in common : version 2.4.4-p3.
    Believe me, it's all identical code for all of us.

    Difference are :
    Hardware - and thus (FreeBSD) drivers used.
    Installed packages ...
    An last but not least : settings.

    Yet, you draw this conclusion :

    @abailey10 said in Memory usuage after reboot:

    pfsense seems to have memory issues,

    Let say you ommitted two words :

    ... for me


  • LAYER 8 Moderator

    @abailey10 said in Memory usuage after reboot:

    pfsense seems to have memory issues, i tired 3 other firewalls including opensense , they all work without this issue.

    Yeah... right... not. Besides every freaking web service out there being lower on memory after a restart, your conclusions with 1 (your) testcase is simple lopsided. If the software stack itself had memory problems that would have rang alarm bells all over the place for a multitude of people. Don't you think? So it's down to the list @Gertjan wrote: HW, installed packages and mostly your configuration (base & packages). Simple as that.

    Also if you want to get to the bottom of your usage, try top with shift+m to sort for processes that have the most memory allocated or do some ps axwww etc. output before and after your "too much memory in use" condition to check who the culprit eating your RAM may be.

    But with years almost two decades of web application hosting knowledge I have to say that everything that either doesn't run into a memory leak draining memory until swap (would be seen eating your memory until 100% in use) or is a wrong configured host/services that simply allocates far too much memory is simply normal. Anything being it the OS, webserver, services etc. may reserve some memory if it is readily available. So pages like https://www.linuxatemyram.com/ don't come from nowhere. We always have people asking where their RAM went and always have to make them acknowledge, that it isn't something bad. OK we're using BSD here, but never mind that :)


  • LAYER 8

    watching the top the first thing that come to my mind... could be related to unbound that restart with dhcp registration if you see mem go up and down ?


  • LAYER 8 Moderator

    Perhaps. As we don't have a complete psoutput and don't know which packets are in play, something like pfB-NG could very well add a big dent into unbounds RAM usage. But that's all speculation until a much more in depth look can be done with more intel about the system and installation as well as additional packages.



  • From my understanding, he's complaining that it's not using enough RAM. Says it's slow after reboot until the system gets cached. Whatever, I think it's a non-issue. DSLReports speedtest issues can be anything from ISP to modem.


  • Netgate Administrator

    Yeah the memory usage might possibly be a related symptom but it's not a cause here.

    It's almost certainly CPU usage causing those ping spikes. Check the system log like I suggested earlier. If some process is triggering it you should be able to see that firing when you see the ping issues.

    Steve



  • I thought pfsense ran from ramdisk once loaded from ssd. If so then why would 50 percent lower memory usage not be a red flag. Its not cpu spikes as it has never been past 20 percent during high load and gui with monitors usually never see more than 1 to 6 percent. This could be hardware related, except if i get an update and it reboots memory usage will be 18 percent which is normal not 7 percent. My internet is 100 down 10 up, no way its stress a quad core at 3.8ghz without power savings of any kind or turbo , this cpu is not power or heat throttling. Its like pfsense cant load all of itself into the ramdisk after reboot


  • LAYER 8 Netgate

    Please understand that this is a problem you and you alone are experiencing. It might take some time to determine what is peculiar in your environment. Especially on an internet forum from remote locations given little information.

    It might just be that pfSense doesn't run well on your specific hardware.


  • LAYER 8 Moderator

    @abailey10 said in Memory usuage after reboot:

    I thought pfsense ran from ramdisk once loaded from ssd. If so then why would 50 percent lower memory usage not be a red flag.

    No it won't if you haven't told it so. There was the old nanoBSD version, that was pre-configured to run with ramdisk support but that is old news and if you didn't set up the ramdisk under System > Adv. Settings it will not run on any kind of ramdisk at all.

    Its like pfsense cant load all of itself into the ramdisk after reboot

    Again, no ramdisk if not told so! Don't jump to conclusions that you haven't configured.

    @abailey10 said in Memory usuage after reboot:

    This could be hardware related, except if i get an update and it reboots memory usage will be 18 percent which is normal not 7 percent

    Now I'm confused. You told us above that after a reboot it only uses 7%, not 18% and that this is (in your opinion) the point why it runs "flaky" somehow. Now you say it reboots and is 18% not 7%? Huh?

    In the end you have to give us much more to "debug" that non-problem if you want to have a conclusion or explanation. But without ANY data at all - that you were told to please post here - there's not much to say other than: it's your isolated case so please show us more details, logs etc. or live with it. Explanations for ups and downs of memory were already given in spades.



  • @JeGr Only time it uses 18 percent memory is when first install with no reboots, or after update. All reboots result in drop in memory to 7 percent. Yes I set up /var /tmp ramdisk also for 250mb each which equals 500mb yet memory usage is still 8 percent. Although /var default 3.4mb on install uses only 5 percent, just increasing the space /var grows to 8 percent of 250mb which is alot more considering no changes made to the install, no packages added, no tweaks, no qos , just default install. So if it set up a ram disk, why dont i see 500mb being used or reserved? And Im looking for help, not a forum that just looks to defend pfsense blindly. I like pfsense but it has issues also.


  • Netgate Administrator

    The RAM usage is almost certainly either unrelated or some side effect of whatever is actually causing the latency you're seeing IMO.
    However to track down what is using it we need to see what's actually changing so maybe the first 20 lines or so from top aS sorted by RES in each condition.

    Steve


  • LAYER 8 Moderator

    @abailey10 said in Memory usuage after reboot:

    not a forum that just looks to defend pfsense blindly

    It has nothing to do with "defending" blindly. It just isn't an issue as you try to make it one. I don't see a problem with RAM going up and down. You do. And you try to construct a generic pfsense software problem from it besides Netgate staff telling you, it is not.

    So if you have a problem with it besides the RAM up/down in your setup and installation - e.g. your point with pfsense being slow/laggy after reboot and not really responsive - then I'd describe and submit logs to that so we can try and help fixing that.

    I like pfsense but it has issues also.

    No one said otherwise or told you "the product is flawless". If it were, we'd not have patches and updates. But ranting on about a non issue (e.g. RAM) is pretty much useless if all you do is give an opinion about it but NO logs whatsoever so we could actually have a look at it. @Gertjan @stephenw10 and @Derelict already posted multiple hypothesis about the problem with the plea to give us something to work with. Yet all you do is rant on about memory issues instead of showing outputs from top, ps, etc. How about some help?


  • Netgate Administrator

    It is possible that this is some entirely new issue and this is first time we are seeing it reported.

    However the memory usage or lack of it is only an indication of some change, it's not itself a problem. And it might be a completely unrelated change.

    @abailey10 Do you know a specific build that was not affected by this? Can you test the RAM usage in that? Can you test a 2.5 snapshot?

    Steve


  • LAYER 8 Moderator

    @stephenw10 said in Memory usuage after reboot:

    It is possible that this is some entirely new issue and this is first time we are seeing it reported.

    Not to be misunderstood: I'm totally for debugging that. But then I'd like to see some actual data, logs and readings instead of accusations and ramblings and textblocks ;) As I said, give us some data to work with :)


Log in to reply