Project

General

Profile

Actions

Todo #15780

open

Speed up MBUF Usage command in system information widget

Added by GChuf 6 about 1 month ago. Updated about 1 month ago.

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

0%

Estimated time:
Plus Target Version:
25.01
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

Also available in: Atom PDF