ralphwetzel / theonionbox

Dashboard to monitor Tor node operations
MIT License
122 stars 17 forks source link

Very high CPU load in web client (browser) #20

Closed github-user-1 closed 7 years ago

github-user-1 commented 7 years ago

I managed to get everything up and running, however, the CPU load on my web browser is extremely high (and effectively making it almost impossible to use it). I reckon that it has something to do with the JavaScript function called "boxChart.prototype.render" (at least from a quick glance at the firefox debugger.

I'm not using JavaScript myself so don't really know what's going wrong - but maybe the updates being drawn are too quick, i.e. without a sleep() or wait(). Maybe to set it up in a way that JS is drawing a new graph only like every minute or so (just an idea; doesn't have to be the real root cause though)?

ralphwetzel commented 7 years ago

I can confirm - testing with an Atom/ION laptop I have at hand - that the huge number of charts per page significantly slows down the browser on less performant systems. I'll investigate in throttling the rendering loop.

ralphwetzel commented 7 years ago

Hi! I've made some modifications to the rendering code to draw charts only if visible to the user. Perhaps you can test if you experience the difference and usability improves? Just exchange chart.js in your script folder with this one and restart the Box.

github-user-1 commented 7 years ago

I exchanged the file /scripts/box_chart.js (there is no other file called just chart.js there) - unfortunately, no charts are showing up anymore now...

ralphwetzel commented 7 years ago

Hi! Sorry for the inconvenience. It took me some days to propagate the changes to the chart rendering code through all the files. This is incorporated in the latest RC now. Looking forward getting your feedback!

github-user-1 commented 7 years ago

Just tried the latest master version - for me it works perfectly fine now regarding the CPU load on the browser. Many thanks!

ralphwetzel commented 7 years ago

Thanks for your positive feedback!