Closed christasich closed 4 years ago
For starters I'll add a setting in netperf.json
which will allow users to set a specific speedtest server ID. If the setting is null speed tests will run as they do now (random server). If a server ID is specified, the test_network.py
script will use that server ID for speed tests. Since both speed test clients support targeting a specific server this change is straightforward.
As for selecting a server during the setup procedure, I'd like to implement a solution that supports both speedtest clients. I'm thinking of developing a Python script that grabs the XML master list of Ookla speed test servers, parses it, sorts servers geographically (with closest servers at the top), then exports the top 10 servers. This would integrate nicely with the existing setup script dialog mechanism. The script could be run at any time after installation to switch speed test servers.
I'd like to implement a solution that supports both speedtest clients. I'm thinking of developing a Python script that grabs the XML master list of Ookla speed test servers, parses it, sorts servers geographically (with closest servers at the top), then exports the top 10 servers.
That sounds like a very sensible solution. Great idea. Let me know if you need any help.
I have created a new branch with the changes that allow users to control speed test server selection. The system can be set to choose a server automatically, or the user can pick one specific server for performing the tests against. Note: this currently only works with the Ookla Speedtest CLI client as the open source client is a bit broken with respect to targeting a specific server ID.
To try out the changes, here are the instructions for patching your existing system:
1) install the Python requests
package:
sudo pip install requests
2) clone the new branch:
git clone -b server-selection https://github.com/mr-canoehead/network_performance_monitor.git
3) copy the new/update project files to /opt/netperf
:
sudo cp network_performance_monitor/netperf/{server_selection.sh,get_speedtest_servers.py,netperf_settings.py,setup.sh,test_network.py} /opt/netperf/
You can now run the script server_selection.sh
to choose a specific server:
sudo /opt/netperf/server_selection.sh
The script will update the new setting server_id
in /opt/netperf/config/netperf.json
.
The next time your test_network.py isp
cron job runs it will test Internet speed using the selected server.
Let me know if you encounter any issues with patching or testing this change.
Thanks, Chris
I just patched my system. It works wonderfully. Nice job!
Great! I'll do a full re-install to make sure the changes haven't broken anything, then I'll merge to the master branch.
I have merged the changes for this issue.
Cheers, Chris
Issue: The Ookla implementation results in wildly fluctuation latency values.
Cause: The issue is caused by the Ookla speedtest client using a different server at every call.
I haven't discerned the logic behind how the speedtest client chooses the server, but to me, it seems completely random.
Possible resolution 1: Use
speedtest -L
to list the ten closest servers to your location and get the server ID. Usespeedtest -s [server_id]
to query that same server every time. I can imagine scenarios where a user might want to have control over this which would complicate things, so...Possible resolution 2: If it's easy, perhaps the results from
speedtest -L
could be displayed to the user on install and they can select the server to use.