2.40 idle cpu usage



  • When sitting idle on the dashboard with no traffic going through pfSense (or minimal), my cpu usage hovers around 9% as a minimum.  In 2.3.4-p1, it was more like 1%.  If I leave the GUI and only use SSH, it does seem to get better.  I believe the process is php-fpm.

    Why the difference between the versions?  Here is a snapshot of TOP, although the CPU usage here doesn't quite match what's shown on the dashboard.  It goes to 99% idle when Dashboard is not running in a browser.  My board is an APU2C4 running over ZFS.  The 2.3.4-p1 was not ZFS of course (if that matters).

    
    [2.4.1-RC][admin@hidden]/root: top
    last pid: 80473;  load averages:  0.73,  0.50,  0.27                                       up 0+10:18:02  06:56:23
    67 processes:  1 running, 60 sleeping, 6 zombie
    CPU:  1.8% user,  0.0% nice,  1.1% system,  0.1% interrupt, 96.9% idle
    Mem: 22M Active, 182M Inact, 674M Wired, 18M Buf, 3036M Free
    ARC: 284M Total, 75M MFU, 198M MRU, 16K Anon, 1544K Header, 10M Other
         175M Compressed, 360M Uncompressed, 2.06:1 Ratio
    Swap: 2048M Total, 2048M Free
    
      PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
    74976 root          1  52    0   263M 26340K accept  3   0:00   5.48% php-fpm
    38737 root          1  20    0 20056K  3196K CPU1    1   0:00   0.22% top
    45347 root          1  20    0 37704K  7352K kqread  1   0:00   0.21% nginx
    28996 root          5  52    0 13028K  1944K uwait   0   0:08   0.04% dpinger
    86484 root          1  20    0 10480K  2556K select  3   0:01   0.03% syslogd
    28121 root          5  52    0 10980K  1872K uwait   1   0:08   0.03% dpinger
    50559 dhcpd         1  20    0 16652K  8328K select  0   0:09   0.03% dhcpd
    28332 root          5  52    0 10980K  1872K uwait   3   0:07   0.03% dpinger
      530 root          1  52    0   261M 18440K kqread  3   0:02   0.02% php-fpm
    28614 root          5  52    0 10980K  1872K uwait   2   0:06   0.02% dpinger
    84764 root          1  20    0 78836K  7380K select  3   0:01   0.02% sshd
    46344 root          1  20    0 24604K 12424K select  2   0:04   0.01% ntpd
    54400 root          1  20    0   106M 58524K select  1   0:07   0.01% bsnmpd
     4985 root          1  20    0 39304K  3884K bpf     3   0:03   0.01% bandwidthd
     4370 root          1  20    0 39304K  3888K bpf     0   0:03   0.01% bandwidthd
     3640 root          1  20    0 39304K  4372K bpf     3   0:03   0.01% bandwidthd
     4531 root          1  20    0 39304K  4240K bpf     0   0:03   0.00% bandwidthd
     3992 root          1  20    0 39304K  4368K bpf     2   0:03   0.00% bandwidthd
     4929 root          1  20    0 39304K  4240K bpf     3   0:03   0.00% bandwidthd
     4265 root          1  20    0 39304K  4244K bpf     3   0:03   0.00% bandwidthd
    19303 root          1  20    0 12696K  1768K bpf     0   0:02   0.00% filterlog
     4152 root          1  20    0 39304K  4244K bpf     3   0:03   0.00% bandwidthd
    39367 unbound       4  20    0 89696K 56972K kqread  2   0:27   0.00% unbound
    57470 root          1  52   20 13084K  2424K wait    0   0:23   0.00% sh
    18713 root          1  20    0 20348K  4320K select  3   0:01   0.00% openvpn
    45346 root          1  20    0 37704K  6996K kqread  2   0:01   0.00% nginx
    40360 root          1  20    0  8228K  1668K kqread  2   0:00   0.00% dhcpleases
    45849 root          1  20    0 12496K  1864K nanslp  0   0:00   0.00% cron
    98284 root          1  20    0 13392K  3372K pause   3   0:00   0.00% tcsh
      560 root          1  20    0  9556K  4712K select  2   0:00   0.00% devd
    [2.4.1-RC][admin@hidden]/root: 
    


  • Accessing the web ui can eat up quite a bit of CPU in general because of PHP. Assuming 2.3.x and 2.4.x being having roughly the same CPU usage, a reason why CPU usage may seem higher is if 2.4 is better at idling the CPU. Check your CPU frequency. I have a 3.2ghz CPU, but under most loads, it's around 300mhz because it's mostly idle and it makes PHP seem much higher because CPU load is relative to the current frequency.



  • I'm comparing an old ALIX board on 2.34 vs my new APU2 running 2.40, so that could be true.  I'll reload 2.34 on the APU2 and see what happens.  thanks!


  • LAYER 8 Global Moderator

    Very good point Harvy66.. Mine is really idle.. but cpu bounces up to 20% on esxi host monitor.. But the cpu is running at 122mhz ;)  On a really old AMD Turion II neo.. And that is with web gui open in my browser.




  • I'm not sure how much I can change on a little 'old APU2 board, but it would be interesting to test that theory on an Intel box where you disable certain Speedstep mechanisms in the BIOS and look to see what it says.  Any takers?



  • I can safely say that I do not understand the explanation. I had the same issue on 2.4 running at 29% with no extra traffic compare to the 2.3, which was around 2%.
    How can I be sure that everything is ok? What is th3 link with the cpu frequency and the cpu utilisation…For extra complexity, I am running this pfsense on a esxi and configure it with 2 CPU.
    I imagine also that the cpu frquency can change over time...Conclusion: I am lost here.

    All clarifications are welcome  :D


  • LAYER 8 Global Moderator

    Think of it this way… Pfsense is doing something all the time, even when "idle" all computers do..

    If your cpu clock is 1ghz and you see cpu usage at 1% lets call it...

    Now your cpu clocks down and is only running at 500mhz.. Your cpu is slower, so that same idle work the cpu was doing going to take more of that slow cpu to do that work.. so say 2% would be seen.  But its not that simple of ratio..

    So the point is that when a cpu clocks down from its full rate, then doing a specific amount of work would be seen at a different % then when the cpu was clocked at full % to do the same work.  You would need to make sure your cpu stays locked at full to compare them..  Which is not good for power usage, etc.

    The point being don't be so hung up on what the cpu % says when pfsense isn't doing anything.. What is doing when your using it and needing it to do its thing is more important.



  • It's not that we're pointing fingers and saying anything is necessarily wrong folks, it's all about understanding!  I just want to learn.

    If the same piece of hardware has idle CPU at 1% on 2.3 but 9% on 2.4, I just want to know why, even if it's a red herring.  In my case though, I admittedly used two different pieces of hardware so I wanted clarification that is is a bug/feature/intended.


  • LAYER 8 Global Moderator

    I don't think anyone is pointing fingers or anything is wrong.. I think your question is a very good/valid one.

    I just don't have enough indepth understanding of different cpu's etc. etc.  To know what would be a normal value for your cpu and clock and if its clocking down, etc.  Or what you might have running in the background or what pfsense might be routing/firewalling, etc.

    I personally just don't get so hung up if graph on the webgui shows 1% or 20%…. or bouncing between them.. I would prob be a bit concerned if showing high numbers and wasn't even doing anything.. Or if the device was running warm.. Or pulling more power than it should be when idle, etc.

    I don't recall the little widget cpu thing ever being all that accurate of indicator, etc.  What does your top show you would be more useful info to what is going on.  Or even iostat for that matter show you cpu usage.  systat another good one... what does that show you?

    Have you looked at top after hitting shift +s

    Or what about htop... its not a default package but it is available via the pfsense repository... just pkg install htop

    What trying to say is there lots of better ways to view what the cpu is doing and what its working on vs that little cpu widget ;)






  • It's not that we're pointing fingers and saying anything is necessarily wrong folks, it's all about understanding!  I just want to learn.

    My guess on that is that ZFS is needing more horse or cpu power and if there will be something likes encryption
    in the game on top of this it might be the answer for me why since version 2.5 AES-NI is a must be too.

    If the same piece of hardware has idle CPU at 1% on 2.3 but 9% on 2.4, I just want to know why, even if it's a red herring.  In my case though, I admittedly used two different pieces of hardware so I wanted clarification that is is a bug/feature/intended.

    Version 2.1 > 2.2 it was a huge step, version 2.2 > 2.3 was a greater step and from version 2.3 > 2.4 it was a big step
    now we are seeing perhaps something is changing from version 2.4 to 2.5 again and at least the biggest step from
    version 2.5 to 3.0 as I am seeing it right. If this will be encounter on "other systems" from other "vendors" no
    one cares and no one is asking why. MS Server is here a good example fo that; no one is hoping to get the same
    performance on hardware for MS Server 2003/2008 if he installs then MS Server 2012/2016 on it or that he
    needs real new hardware based on the drivers. And so many of the users were complaining that they were not
    able to use their beloved Alix boards anymore since version 2.3 and since 2.4 any kind of 32Bit Hardware
    and since version 2.5 when AES-NI is a must be this will be returning once more again I think.

    What is with version 2.4 and no ZFS, let it also spiking the CPU so high?
    Did you try out PowerD (high adaptive) to get not nailed on one MHz/GHz frequency?
    Is perhaps ZFS "only" needing more horse (cpu) power and no one is knowing that exactly?

    I'm comparing an old ALIX board on 2.34 vs my new APU2 running 2.40, so that could be true.  I'll reload 2.34 on the APU2 and see what happens.  thanks!

    What is with 2.4 without ZFS? Is it then slow as now again? Or is the CPU scaling up to high?
    It is not really fair to compare 32Bit hardware and system against 64Bit hardware and OS, for sure
    but as I see it right it can also be pointed to a totally other thing we all lost here. The release jump
    it self could also be causing some let us say not really wished or wanted effects, because at first
    the entire version of 2.4 should be based on the FreeBSD 11.0 version and not it is based on the
    FreeBSD version 11.1, could this also causing some things that are not really running well now?
    No Plan Survives Contact with the Internet

    In real I think only the developers will be able to tell something about the higher scaling cpu.



  • Johnpoz, you just clarify in 30 lines a 3 page article I found via google. Needless to say that I was completely confused after that article.

    Thank you. Very much appreciated.

    M.


Log in to reply