This should be enough support to add the most significant improvement in a while better real time bandwidth monitoring.
Current:
We sample the bandwidth once every 10 seconds and save that to a file.
The user cannot change this interval since it will break the calculations.
We also need to perform a write every 10 seconds and a calculation every 10 seconds including a divide by 10 which is expensive.
Improvments:
We can have our service sample at a much longer interval say every 1-5min instead of every 10 seconds. The service will only be used for book keeping or to put it another way the service will only be used to to track total bandwidth used.
A php service can acquire the current total bytes in real time.this allows our script to sample however fast it wishes in order to get the bandwidth.
Proposed implementation:
a php service will be installed to jffs/www this service when polled will return a page containing the raw output of console command iptables which can be consumed by the angular script.
the angular script needs to be adjusted to handle all bandwidth calculations on its own.essentially it will be working out the details of the update section of bwmon.sh from now on.
overall result should be a far more responsive UI that requires zero load on the router when not viewing the bandwidth monitoring page.
the polling interval can be adjusted by default it will be set to 3 seconds.
This should be enough support to add the most significant improvement in a while better real time bandwidth monitoring.
Current: We sample the bandwidth once every 10 seconds and save that to a file. The user cannot change this interval since it will break the calculations. We also need to perform a write every 10 seconds and a calculation every 10 seconds including a divide by 10 which is expensive.
Improvments:
Proposed implementation: