Dashboard traffic graphs increase CPU load when collapsed
-
My pfsense has 3 LANs and a 8-line mlppp WAN. Since each DSL line brings in about 5.25 mbps, my total WAN-LAN throughput is not more than 42mbps (and inter-LAN traffic is minimal). Thus, a net5501 with its 500MHz Geode is well sized for the routing it does.
By contrast, with pfsense's Dashboard loaded in my browser, including the Traffic Graphs widget, my CPU usage goes way up. You can see in the attached screenshot that from 00:00 until aproximately 12:20, the Dashboard was loaded in the browser. From 12:20 to the end of the graph it was not. Throughput during this time averaged 1.73mbps; during peak throughput with the Dashboard no loaded in the browser, CPU usage tends to hover 50-60%, at which point there is enough CPU to route, but not really enough to route and simultaneously display the dashboard.
I know this is no critical bug or anything, and I can work around it by reducing the refresh interval or not having traffic graphs display on my dashboard, but still, it seems silly to me that the interface to throughput ratio for CPU usage should be greater than one.
So the fix I would propose would be to not draw the graphs for interfaces that are collapsed. In fact, I think this was the behaviour in some of the snapshots from a few months back. Is there a reason it was changed? Yeah, it's nice to expand a graph and have it already drawn, but I think the user should at least have the option to turn that off. In the case of PPPoE users especially, we normally have no need to view the throughput on the physical interface, since we already have a graph for the PPPoE interface, so why throw away those CPU cycles to redundancy?
I've never touched php before, but I wouldn't mind taking a stab at this one if nobody else feels it's a priority. Could somebody give me a hint at what file I would need to edit? I'm thinking the Traffic Graph widget's settings dialog would be the place to add a radio button to disable drawing of collapsed graphs. Or if somebody wanted to get really fancy they could put a button beside the hide button on every graph to disable the drawing of individual interfaces' graphs.
-
The collapsed graphs have always been drawn.
What changed recently is that there was a very nasty bug that caused every interface update to be staggered with an ever-increasing counter so every interface was getting updated less and less frequently, causing the ones at the bottom to always be farther and farther behind the upper graphs.
Now the graphs are kept in line with each other, but that will cause increased CPU usage. No matter how you try to stagger the graph updates they will always align at certain intervals.
It may be possible to disable the minimized graphs, though I'd have to look at the code to confirm that. There are several files involved in making the graphs, though mostly you'd want to look at the files in the /usr/local/www/widgets directory for the graphs, and also /usr/local/www/index.php /usr/local/www/getstats.php and /usr/local/www/javascript/index/ajax.js