Project

General

Profile

Actions

Todo #15780

open

Speed up MBUF Usage command in system information widget

Added by GChuf 6 2 months ago. Updated 15 days ago.

Status:
Pull Request Review
Priority:
Normal
Assignee:
-
Category:
Dashboard
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
25.03
Release Notes:
Default

Description

PR: https://github.com/pfsense/pfsense/pull/4703

Possibly linked to: https://redmine.pfsense.org/issues/6614

The MBUF usage command is responsible for a huge amount of cpu utilization and time needed to execute getstats.php (relative to other commands needed for system information widget).

Tested on a throttled virtualized system, v2.7.2 (idle was close to 100% without web console used):

Original system information widget (getstats.php)
CPU idle: 45% (avg of 15 runs)
time to execute: min=48ms, max=128ms

Original system information widget WITHOUT MBUF
CPU idle: 77% (avg of 15 runs)
time to execute: min=17ms, max=19ms

System information widget after changes in PR:
CPU idle: 75% (avg of 15 runs)
time to execute: min=20ms, max=22ms

Instead of using:

/usr/bin/netstat -mb | /usr/bin/grep "mbuf clusters in use" | /usr/bin/awk '{ print $1 }'

I tried using:

/usr/bin/vmstat -z | /usr/bin/grep mbuf_cluster | /usr/bin/grep -v debugnet | /usr/bin/awk '{print $3,$4,$5}'

I also tried to simplify the logic by only using 1 function, and only returning 1 value. I think the code looks cleaner now.

I am not sure if this works on all architectures.

Actions #1

Updated by Jim Pingle 2 months ago

  • Target version set to 2.8.0
  • Plus Target Version set to 25.01

See my comments on the PR for an alternate method since the one used isn't viable as-is.

Actions #2

Updated by GChuf 6 2 months ago

Updated the code.
More info on github.

Actions #3

Updated by Jim Pingle 15 days ago

  • Plus Target Version changed from 25.01 to 25.03
Actions

Also available in: Atom PDF