Coder Social home page Coder Social logo

Comments (6)

DarrenWhite99 avatar DarrenWhite99 commented on July 30, 2024

I tried speedtest today for the first time, and was disappointed to discover that it would only crash!

Further testing demonstrated that the program was failing because a latency test could not be completed, because one of the three closest servers was unreachable for me. The issue described above sounds like failures are handled, even if it is not as clean as you like. I tested 0.7.2 and 0.7.4, 32 and 64 bit builds (all on my Windows 8.1 Pro x64 machine, from elevated and standard level prompts). It appears that the issue changed from not being clean to complete program failure.

Here are three back to back runs:
1 - FAIL - Using the defaults (failure when #3 is checked, http://spd101.sfo101.googlefiber.net/)
2 - SUCCESS - Using only two servers (which skipped the bad server)
3 - FAIL - Using only two, but I blocked traffic to server #2 (http://ookla-a.equinix-sj.sonic.net/) and had the same failure as run #1.

RUN #1 ------------------------------------------------------------------------------------------------------------------------
RUN #1 ------------------------------------------------------------------------------------------------------------------------

Microsoft Windows Version 6.3.9600 2013 Microsoft Corporation. All rights reserved.

C:\temp>speedtest-64-v0.7.4.exe -d
2015/04/10 20:50:14 Debugging on...
Loading config from speedtest.net
Config: &{71.92.246.10 37.0692 -121.5567 Charter Communications}
Environment report
Arch: amd64
OS: windows
IP: 71.92.246.10
Lat: 37.0692
Lon: -121.5567
ISP: Charter Communications
Getting servers list...(3545) found
2015/04/10 20:50:15 Finding 3 closest servers...
2015/04/10 20:50:15 Finding fastest server..
2015/04/10 20:50:15 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:50:15 Run took: 78.4604ms
2015/04/10 20:50:15 Quickest latency so far: 78.4604ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:50:15 Run took: 53.9418ms
2015/04/10 20:50:15 Quickest latency so far: 53.9418ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:50:15 Run took: 29.9561ms
2015/04/10 20:50:15 Quickest latency so far: 29.9561ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:50:15 Run took: 27.578ms
2015/04/10 20:50:15 Quickest latency so far: 27.578ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:50:15 Run took: 28.0479ms
2015/04/10 20:50:15 Quickest latency so far: 27.578ms
2015/04/10 20:50:15 Total runs took: 27.578
2015/04/10 20:50:15 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:50:15 Run took: 74.0725ms
2015/04/10 20:50:15 Quickest latency so far: 74.0725ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:50:15 Run took: 84.3871ms
2015/04/10 20:50:15 Quickest latency so far: 74.0725ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:50:15 Run took: 76.6229ms
2015/04/10 20:50:15 Quickest latency so far: 74.0725ms
2015/04/10 20:50:15 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:50:16 Run took: 77.1877ms
2015/04/10 20:50:16 Quickest latency so far: 74.0725ms
2015/04/10 20:50:16 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:50:16 Run took: 79.0938ms
2015/04/10 20:50:16 Quickest latency so far: 74.0725ms
2015/04/10 20:50:16 Total runs took: 74.0725
2015/04/10 20:50:16 Testing latency: Palo Alto, Ca (Google Fiber)
2015/04/10 20:50:37 Cannot test latency of 'http://spd101.sfo101.googlefiber.net
/speedtest/latency.txt' - 'Cannot contact server'
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x0 pc=0x48ec9d]

goroutine 1 [running]:
github.com/zpeters/speedtest/sthttp.GetLatency(0xc0822e3a00, 0x39, 0x4042b6f0068
db8bb, 0xc05e88d6a161e4f7, 0xc0822f8e10, 0xd, 0xc0822f8e30, 0xd, 0xc0822f8e48, 0
x2, ...)
/Users/zachpeters/go/src/github.com/zpeters/speedtest/sthttp/sthttp.go:2
22 +0x91d
github.com/zpeters/speedtest/sthttp.GetFastestServer(0x5, 0xc08266e000, 0x3, 0xf
c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Users/zachpeters/go/src/github.com/zpeters/speedtest/sthttp/sthttp.go:2
70 +0xb0
main.main()
/Users/zachpeters/go/src/github.com/zpeters/speedtest/speedtest.go:234 +
0x10fa

goroutine 8 [IO wait]:
net.(_pollDesc).Wait(0xc082088170, 0x72, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/fd_poll_runtime.go:84 +0x4e
net.(_ioSrv).ExecIO(0xc082042058, 0xc082088060, 0x6ec8d0, 0x7, 0x779518, 0x0, 0x
0, 0x0)
/Users/zachpeters/src/go/src/net/fd_windows.go:188 +0x305
net.(_netFD).Read(0xc082088000, 0xc082013000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/fd_windows.go:470 +0x180
net.(_conn).Read(0xc082042068, 0xc082013000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/net.go:121 +0xe3
net/http.noteEOFReader.Read(0x283288, 0xc082042068, 0xc08205e108, 0xc082013000,
0x1000, 0x1000, 0x665740, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/http/transport.go:1270 +0x75
net/http.(_noteEOFReader).Read(0xc082004e40, 0xc082013000, 0x1000, 0x1000, 0xc08
2016000, 0x0, 0x0)
:125 +0xdb
bufio.(_Reader).fill(0xc082044660)
/Users/zachpeters/src/go/src/bufio/bufio.go:97 +0x1d5
bufio.(_Reader).Peek(0xc082044660, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/zachpeters/src/go/src/bufio/bufio.go:132 +0xf7
net/http.(_persistConn).readLoop(0xc08205e0b0)
/Users/zachpeters/src/go/src/net/http/transport.go:842 +0xab
created by net/http.(*Transport).dialConn
/Users/zachpeters/src/go/src/net/http/transport.go:660 +0xca6

goroutine 9 [select]:
net/http.(_persistConn).writeLoop(0xc08205e0b0)
/Users/zachpeters/src/go/src/net/http/transport.go:945 +0x424
created by net/http.(_Transport).dialConn
/Users/zachpeters/src/go/src/net/http/transport.go:661 +0xcc3

RUN #2 ------------------------------------------------------------------------------------------------------------------------
RUN #2 ------------------------------------------------------------------------------------------------------------------------
RUN #2 ------------------------------------------------------------------------------------------------------------------------
RUN #2 ------------------------------------------------------------------------------------------------------------------------

C:\temp>speedtest-64-v0.7.4.exe -d -nc=2
2015/04/10 20:51:02 Debugging on...
Loading config from speedtest.net
Config: &{71.92.246.10 37.0692 -121.5567 Charter Communications}
Environment report
Arch: amd64
OS: windows
IP: 71.92.246.10
Lat: 37.0692
Lon: -121.5567
ISP: Charter Communications
Getting servers list...(3545) found
2015/04/10 20:51:03 Finding 2 closest servers...
2015/04/10 20:51:03 Finding fastest server..
2015/04/10 20:51:03 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:51:03 Run took: 72.1194ms
2015/04/10 20:51:03 Quickest latency so far: 72.1194ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:51:03 Run took: 35.753ms
2015/04/10 20:51:03 Quickest latency so far: 35.753ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:51:03 Run took: 45.0337ms
2015/04/10 20:51:03 Quickest latency so far: 35.753ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:51:03 Run took: 30.0027ms
2015/04/10 20:51:03 Quickest latency so far: 30.0027ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:51:03 Run took: 27.9833ms
2015/04/10 20:51:03 Quickest latency so far: 27.9833ms
2015/04/10 20:51:03 Total runs took: 27.9833
2015/04/10 20:51:03 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:51:03 Run took: 78.0529ms
2015/04/10 20:51:03 Quickest latency so far: 78.0529ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:51:03 Run took: 78.0773ms
2015/04/10 20:51:03 Quickest latency so far: 78.0529ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:51:03 Run took: 74.0237ms
2015/04/10 20:51:03 Quickest latency so far: 74.0237ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:51:03 Run took: 82.0188ms
2015/04/10 20:51:03 Quickest latency so far: 74.0237ms
2015/04/10 20:51:03 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:51:04 Run took: 66.9818ms
2015/04/10 20:51:04 Quickest latency so far: 66.9818ms
2015/04/10 20:51:04 Total runs took: 66.9818
Server: {http://speedtest.sjc01.softlayer.com/speedtest/speedtest/upload.php %!s
(float64=37.3041) %!s(float64=-121.8727) San Jose, CA United States US SoftLayer
Technologies, Inc. 4042 %!s(float64=38.297209368463456) %!s(float64=27.9833)} i
s the fastest server
4042 | SoftLayer Technologies, Inc. (San Jose, CA, United States)

2015/04/10 20:51:04 Testing download speed
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om350x350.jpg
2015/04/10 20:51:04 Starting test at: 2015-04-10 20:51:04.0360113 -0700 PDT
2015/04/10 20:51:04 Dl Speed: 7.73377372405403
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om500x500.jpg
2015/04/10 20:51:04 Starting test at: 2015-04-10 20:51:04.2948498 -0700 PDT
2015/04/10 20:51:04 Dl Speed: 16.040702715180146
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om750x750.jpg
2015/04/10 20:51:04 Starting test at: 2015-04-10 20:51:04.5489818 -0700 PDT
2015/04/10 20:51:04 Dl Speed: 25.03599305247453
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om1000x1000.jpg
2015/04/10 20:51:04 Starting test at: 2015-04-10 20:51:04.907232 -0700 PDT
2015/04/10 20:51:05 Dl Speed: 42.59248428407119
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om1500x1500.jpg
2015/04/10 20:51:05 Starting test at: 2015-04-10 20:51:05.2813095 -0700 PDT
2015/04/10 20:51:05 Dl Speed: 64.75182553019671
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om2000x2000.jpg
2015/04/10 20:51:05 Starting test at: 2015-04-10 20:51:05.8363545 -0700 PDT
2015/04/10 20:51:07 Dl Speed: 29.58218097572782
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om2500x2500.jpg
2015/04/10 20:51:07 Starting test at: 2015-04-10 20:51:07.9758687 -0700 PDT
2015/04/10 20:51:12 Dl Speed: 20.789108707304887
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om3000x3000.jpg
2015/04/10 20:51:12 Starting test at: 2015-04-10 20:51:12.7536501 -0700 PDT
2015/04/10 20:51:19 Dl Speed: 20.785431008815888
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om3500x3500.jpg
2015/04/10 20:51:19 Starting test at: 2015-04-10 20:51:19.6120712 -0700 PDT
2015/04/10 20:51:28 Dl Speed: 20.785812371403424
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om4000x4000.jpg
2015/04/10 20:51:28 Starting test at: 2015-04-10 20:51:28.9510439 -0700 PDT
2015/04/10 20:51:41 Dl Speed: 20.78123651776371

2015/04/10 20:51:41 Testing upload speed
Upload Test Run: 0
2015/04/10 20:51:41 Starting test at: 2015-04-10 20:51:41.1416349 -0700 PDT
2015/04/10 20:51:41 Finishing test at: 2015-04-10 20:51:41.8566416 -0700 PDT
Upload Test Run: 1
2015/04/10 20:51:41 Starting test at: 2015-04-10 20:51:41.8766559 -0700 PDT
2015/04/10 20:51:43 Finishing test at: 2015-04-10 20:51:43.6158511 -0700 PDT
Upload Test Run: 2
2015/04/10 20:51:43 Starting test at: 2015-04-10 20:51:43.6558776 -0700 PDT
2015/04/10 20:51:46 Finishing test at: 2015-04-10 20:51:46.2788476 -0700 PDT
Upload Test Run: 3
2015/04/10 20:51:46 Starting test at: 2015-04-10 20:51:46.3679066 -0700 PDT
2015/04/10 20:51:50 Finishing test at: 2015-04-10 20:51:50.3008783 -0700 PDT
Upload Test Run: 4
2015/04/10 20:51:50 Starting test at: 2015-04-10 20:51:50.3809278 -0700 PDT
2015/04/10 20:51:55 Finishing test at: 2015-04-10 20:51:55.6255144 -0700 PDT

Ping (Average): 27.98 ms | Download (Max): 64.75 Mbps | Upload (Max): 3.20 Mbps

RUN #3 ------------------------------------------------------------------------------------------------------------------------
RUN #3 ------------------------------------------------------------------------------------------------------------------------
RUN #3 ------------------------------------------------------------------------------------------------------------------------
RUN #3 ------------------------------------------------------------------------------------------------------------------------

C:\temp>speedtest-64-v0.7.4.exe -d -nc=2
2015/04/10 20:52:16 Debugging on...
Loading config from speedtest.net
Config: &{71.92.246.10 37.0692 -121.5567 Charter Communications}
Environment report
Arch: amd64
OS: windows
IP: 71.92.246.10
Lat: 37.0692
Lon: -121.5567
ISP: Charter Communications
Getting servers list...(3545) found
2015/04/10 20:52:17 Finding 2 closest servers...
2015/04/10 20:52:17 Finding fastest server..
2015/04/10 20:52:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:52:17 Run took: 77.051ms
2015/04/10 20:52:17 Quickest latency so far: 77.051ms
2015/04/10 20:52:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:52:17 Run took: 32.0232ms
2015/04/10 20:52:17 Quickest latency so far: 32.0232ms
2015/04/10 20:52:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:52:17 Run took: 33.7706ms
2015/04/10 20:52:17 Quickest latency so far: 32.0232ms
2015/04/10 20:52:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:52:17 Run took: 28.0976ms
2015/04/10 20:52:17 Quickest latency so far: 28.0976ms
2015/04/10 20:52:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/10 20:52:17 Run took: 28.0492ms
2015/04/10 20:52:17 Quickest latency so far: 28.0492ms
2015/04/10 20:52:17 Total runs took: 28.0492
2015/04/10 20:52:17 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/10 20:52:38 Cannot test latency of 'http://ookla-a.equinix-sj.sonic.net/
mini/speedtest/latency.txt' - 'Cannot contact server'
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x0 pc=0x48ec9d]

goroutine 1 [running]:
github.com/zpeters/speedtest/sthttp.GetLatency(0xc0823b8240, 0x3d, 0x4042aaa9930
be0df, 0xc05e79999999999a, 0xc0822f98d0, 0xc, 0xc0822f98f0, 0xd, 0xc0822f9908, 0
x2, ...)
/Users/zachpeters/go/src/github.com/zpeters/speedtest/sthttp/sthttp.go:2
22 +0x91d
github.com/zpeters/speedtest/sthttp.GetFastestServer(0x5, 0xc08267e000, 0x2, 0xf
c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Users/zachpeters/go/src/github.com/zpeters/speedtest/sthttp/sthttp.go:2
70 +0xb0
main.main()
/Users/zachpeters/go/src/github.com/zpeters/speedtest/speedtest.go:234 +
0x10fa

goroutine 8 [IO wait]:
net.(_pollDesc).Wait(0xc082088170, 0x72, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/fd_poll_runtime.go:84 +0x4e
net.(_ioSrv).ExecIO(0xc082042058, 0xc082088060, 0x6ec8d0, 0x7, 0x779518, 0x0, 0x
0, 0x0)
/Users/zachpeters/src/go/src/net/fd_windows.go:188 +0x305
net.(_netFD).Read(0xc082088000, 0xc082013000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/fd_windows.go:470 +0x180
net.(_conn).Read(0xc082042068, 0xc082013000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/net.go:121 +0xe3
net/http.noteEOFReader.Read(0x1832c0, 0xc082042068, 0xc08205e108, 0xc082013000,
0x1000, 0x1000, 0x665740, 0x0, 0x0)
/Users/zachpeters/src/go/src/net/http/transport.go:1270 +0x75
net/http.(_noteEOFReader).Read(0xc082004e20, 0xc082013000, 0x1000, 0x1000, 0xc08
2016000, 0x0, 0x0)
:125 +0xdb
bufio.(_Reader).fill(0xc082044660)
/Users/zachpeters/src/go/src/bufio/bufio.go:97 +0x1d5
bufio.(_Reader).Peek(0xc082044660, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/Users/zachpeters/src/go/src/bufio/bufio.go:132 +0xf7
net/http.(_persistConn).readLoop(0xc08205e0b0)
/Users/zachpeters/src/go/src/net/http/transport.go:842 +0xab
created by net/http.(*Transport).dialConn
/Users/zachpeters/src/go/src/net/http/transport.go:660 +0xca6

goroutine 9 [select]:
net/http.(_persistConn).writeLoop(0xc08205e0b0)
/Users/zachpeters/src/go/src/net/http/transport.go:945 +0x424
created by net/http.(_Transport).dialConn
/Users/zachpeters/src/go/src/net/http/transport.go:661 +0xcc3

C:\temp>

Thank You,

Darren

from speedtest.

zpeters avatar zpeters commented on July 30, 2024

I haven't put a lot of thought into this yet, but what would you want to happen when a test server is down/unavailable? I'm thinking that it gets pulled from the list and the next ideal server is used. I'd also like to display some sort of prompt or warning that the server was down.

I will put some more thought into this and look into coding a work around. Let me know if you have any questions or thoughts. Your bug report is very appreciated

from speedtest.

zpeters avatar zpeters commented on July 30, 2024

I threw together some rough code to test the concept of "failing out" a server that doesn't respond. Only looking at latency checks right now, but this could be extended to download and upload tests.

Would you mind testing this in your situation and let me know what results you get?

Thank you,

http://media.thehelpfulhacker.net/index.php?dir=speedtest/testing/ge69e0bb/

from speedtest.

DarrenWhite99 avatar DarrenWhite99 commented on July 30, 2024

Thanks for the quick turn around.

The new build (only tested the 32bit build from my Win8.1Pro x64 laptop) successfully completed without crashing. Debug run output included below. The execution time is greatly increased while it waits almost 2 minutes for the bad server to timeout 5 times. One suggestion would be to consider shortening the connection timeout if possible.

Another suggestion would be to consider dropping the failed server and selecting a new server from the list in the event of any timeouts. Define the number of tests requested, the maximum number of servers to check (double the requested number for up to 50% failures?) and skip a server if it fails any latency tests. Stop testing once the requested number of servers successfully checked is reached, the maximum number of servers to test is reached, or you checked all possible servers. Use the lowest latency run of the successfully tested Servers as the selected ServerID for testing, then continue.

Consider this possible pseudocode if it helps show the logic I was suggesting?
InitializeVariables
Define Array "ServerArraySortedByDistance.ID"
Define Array "ServerArraySortedByDistance.Name"
Define Array "ServerArraySortedByDistance.URL"
Define NumberOfKnownServers=CountOfRecords (ServerArraySortedByDistance.ID)
Define ServersToCheck=3
Define MaxServersToCheck=ServersToCheck * 2
Define LatencyTestCount=5
Define LowestLatencyMS=60000
Define ClosestServerID=0
Define ServerTestedCounter=0
Define ServerResultCounter=0

Main Routine
LABEL BeginLatencyOuterLoop
Define ServerTestedCounter=ServerTestedCounter+1
Define ServerResultCounter=ServerResultCounter+1
Define InnerLoopCounter=0
Define TempLowestLatencyMS=LowestLatencyMS
If ServerTestedCounter > MaxServersToCheck GOTO EndLatencyOuterLoop
Define ServerURLToTest=ServerArraySortedByDistance.URL[LoopCounter]
Define ServerIDToTest=ServerArraySortedByDistance.ID[LoopCounter]
Define ServerNameToTest=ServerArraySortedByDistance.ID[LoopCounter]
Write "Testing Server (" + ServerIDToTest + ") " + ServerNameToTest
LABEL BeginLatencyInnerLoop
Define InnerLoopCounter=InnerLoopCounter+1
Define CurrentServerLatency=PerformLatencyCheck(ServerURLToTest) (which returns tested server latency, -1 if timeout)
IF CurrentServerLatency < 0 (
Write "Latency Test Fail - Discarding Server Results. Testing next available server"
Define ServerResultCounter=ServerResultCounter-1
GOTO BeginLatencyOuterLoop
)
Write "Server Latency Result = " + CurrentServerLatency + " ms"
IF CurrentServerLatency < TempLowestLatencyMS (
Define TempLowestLatencyMS=CurrentServerLatency
)
Write "Lowest Latency Result = " + TempLowestLatencyMS + " ms"
IF InnerLoopCounter<LatencyTestCount GOTO BeginLatencyInnerLoop
IF TempLowestLatencyMS < LowestLatencyMS (
Define LowestLatencyMS=TempLowestLatencyMS
Define ClosestServerID=ServerIDToTest
)
IF ServerTestedCounter<NumberOfKnownServers GOTO BeginLatencyOuterLoop
LABEL EndLatencyOuterLoop
IF ClosestServerID=0 (
WRITE "No Servers selected could complete the testing requirements."
EXIT
)
WRITE "The lowest latency server tested was " + ClosestServerID + " - " + LowestLatencyMS + " ms."
DoSpeedTests (ClosestServerID)

Run output below:

C:\temp>speedtest-32-v0.7.4-1-ge69e0bb.exe -d
2015/04/13 15:11:16 Debugging on...
Loading config from speedtest.net
Config: &{71.92.246.10 37.0692 -121.5567 Charter Communications}
Environment report
Arch: 386
OS: windows
IP: 71.92.246.10
Lat: 37.0692
Lon: -121.5567
ISP: Charter Communications
Getting servers list...(3541) found
2015/04/13 15:11:17 Finding 3 closest servers...
2015/04/13 15:11:17 Finding fastest server..
2015/04/13 15:11:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 116.9323ms
2015/04/13 15:11:17 Quickest latency so far: 116.9323ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 29.5015ms
2015/04/13 15:11:17 Quickest latency so far: 29.5015ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 34.0027ms
2015/04/13 15:11:17 Quickest latency so far: 29.5015ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 28.6993ms
2015/04/13 15:11:17 Quickest latency so far: 28.6993ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (SoftLayer Technologies, Inc.)

2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 25.9009ms
2015/04/13 15:11:17 Quickest latency so far: 25.9009ms
2015/04/13 15:11:17 Total runs took: 25.9009
2015/04/13 15:11:17 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 127.0338ms
2015/04/13 15:11:17 Quickest latency so far: 127.0338ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 79.4913ms
2015/04/13 15:11:17 Quickest latency so far: 79.4913ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 75.7833ms
2015/04/13 15:11:17 Quickest latency so far: 75.7833ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 125.3289ms
2015/04/13 15:11:17 Quickest latency so far: 75.7833ms
2015/04/13 15:11:17 Testing latency: San Jose, CA (Sonic.net, Inc)
2015/04/13 15:11:17 deferring close body...
2015/04/13 15:11:17 setting finish...
2015/04/13 15:11:17 reading body...
2015/04/13 15:11:17 Run took: 66.5662ms
2015/04/13 15:11:17 Quickest latency so far: 66.5662ms
2015/04/13 15:11:17 Total runs took: 66.5662
2015/04/13 15:11:17 Testing latency: Palo Alto, Ca (Google Fiber)
2015/04/13 15:11:38 Cannot test latency of 'http://spd101.sfo101.googlefiber.net
/speedtest/latency.txt' - 'Cannot contact server'
2015/04/13 15:11:38 Run took: 1m0s
2015/04/13 15:11:38 Quickest latency so far: 1m0s
2015/04/13 15:11:38 Testing latency: Palo Alto, Ca (Google Fiber)
2015/04/13 15:11:59 Cannot test latency of 'http://spd101.sfo101.googlefiber.net
/speedtest/latency.txt' - 'Cannot contact server'
2015/04/13 15:11:59 Run took: 1m0s
2015/04/13 15:11:59 Quickest latency so far: 1m0s
2015/04/13 15:11:59 Testing latency: Palo Alto, Ca (Google Fiber)
2015/04/13 15:12:20 Cannot test latency of 'http://spd101.sfo101.googlefiber.net
/speedtest/latency.txt' - 'Cannot contact server'
2015/04/13 15:12:20 Run took: 1m0s
2015/04/13 15:12:20 Quickest latency so far: 1m0s
2015/04/13 15:12:20 Testing latency: Palo Alto, Ca (Google Fiber)
2015/04/13 15:12:41 Cannot test latency of 'http://spd101.sfo101.googlefiber.net
/speedtest/latency.txt' - 'Cannot contact server'
2015/04/13 15:12:41 Run took: 1m0s
2015/04/13 15:12:41 Quickest latency so far: 1m0s
2015/04/13 15:12:41 Testing latency: Palo Alto, Ca (Google Fiber)
2015/04/13 15:13:02 Cannot test latency of 'http://spd101.sfo101.googlefiber.net
/speedtest/latency.txt' - 'Cannot contact server'
2015/04/13 15:13:02 Run took: 1m0s
2015/04/13 15:13:03 Quickest latency so far: 1m0s
2015/04/13 15:13:03 Total runs took: 60000
Server: {http://speedtest.sjc01.softlayer.com/speedtest/speedtest/upload.php %!s
(float64=37.3041) %!s(float64=-121.8727) San Jose, CA United States US SoftLayer
Technologies, Inc. 4042 %!s(float64=38.297209368463456) %!s(float64=25.9009)} i
s the fastest server
4042 | SoftLayer Technologies, Inc. (San Jose, CA, United States)

2015/04/13 15:13:03 Testing download speed
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om350x350.jpg
2015/04/13 15:13:03 Starting test at: 2015-04-13 15:13:03.0054509 -0700 PDT
2015/04/13 15:13:03 Dl Speed: 2.943940916751321
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om500x500.jpg
2015/04/13 15:13:03 Starting test at: 2015-04-13 15:13:03.6722795 -0700 PDT
2015/04/13 15:13:04 Dl Speed: 4.9574188167681
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om750x750.jpg
2015/04/13 15:13:04 Starting test at: 2015-04-13 15:13:04.4890948 -0700 PDT
2015/04/13 15:13:05 Dl Speed: 7.116453981606901
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om1000x1000.jpg
2015/04/13 15:13:05 Starting test at: 2015-04-13 15:13:05.7469057 -0700 PDT
2015/04/13 15:13:07 Dl Speed: 9.267260896514287
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om1500x1500.jpg
2015/04/13 15:13:07 Starting test at: 2015-04-13 15:13:07.4711678 -0700 PDT
2015/04/13 15:13:09 Dl Speed: 14.828854488388346
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om2000x2000.jpg
2015/04/13 15:13:09 Starting test at: 2015-04-13 15:13:09.8817335 -0700 PDT
2015/04/13 15:13:11 Dl Speed: 36.43844428347351
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om2500x2500.jpg
2015/04/13 15:13:11 Starting test at: 2015-04-13 15:13:11.6188667 -0700 PDT
2015/04/13 15:13:16 Dl Speed: 21.321260607290533
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om3000x3000.jpg
2015/04/13 15:13:16 Starting test at: 2015-04-13 15:13:16.2744736 -0700 PDT
2015/04/13 15:13:23 Dl Speed: 20.54298665359383
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om3500x3500.jpg
2015/04/13 15:13:23 Starting test at: 2015-04-13 15:13:23.2330244 -0700 PDT
2015/04/13 15:13:32 Dl Speed: 20.61415169360591
Download Test Run: http://speedtest.sjc01.softlayer.com/speedtest/speedtest/rand
om4000x4000.jpg
2015/04/13 15:13:32 Starting test at: 2015-04-13 15:13:32.6487568 -0700 PDT
2015/04/13 15:13:44 Dl Speed: 20.53736457611101

2015/04/13 15:13:44 Testing upload speed
Upload Test Run: 0
2015/04/13 15:13:44 Starting test at: 2015-04-13 15:13:44.9991445 -0700 PDT
2015/04/13 15:13:45 Finishing test at: 2015-04-13 15:13:45.6777366 -0700 PDT
Upload Test Run: 1
2015/04/13 15:13:45 Starting test at: 2015-04-13 15:13:45.6997492 -0700 PDT
2015/04/13 15:13:47 Finishing test at: 2015-04-13 15:13:47.3889022 -0700 PDT
Upload Test Run: 2
2015/04/13 15:13:47 Starting test at: 2015-04-13 15:13:47.4309331 -0700 PDT
2015/04/13 15:13:50 Finishing test at: 2015-04-13 15:13:50.2686834 -0700 PDT
Upload Test Run: 3
2015/04/13 15:13:50 Starting test at: 2015-04-13 15:13:50.3387301 -0700 PDT
2015/04/13 15:13:55 Finishing test at: 2015-04-13 15:13:55.0464691 -0700 PDT
Upload Test Run: 4
2015/04/13 15:13:55 Starting test at: 2015-04-13 15:13:55.1345261 -0700 PDT
2015/04/13 15:14:01 Finishing test at: 2015-04-13 15:14:01.0729638 -0700 PDT

Ping (Average): 25.90 ms | Download (Max): 36.44 Mbps | Upload (Max): 3.09 Mbps

from speedtest.

zpeters avatar zpeters commented on July 30, 2024

@DarrenWhite99 I didn't get quite as sophisticated as your pseudo-code but i did adopt most of the ideas for the new dev build. I am now grabbing all possible servers (ranked by closeness) then testing each one until we get the top X close servers then finding the fastest one. Still a lot of code to clean up and testing to do but i wanted to get this out in case you find any new bugs.

Thank you for your feedback and suggestions, it has been very helpful and motivational.

http://media.thehelpfulhacker.net/index.php?dir=speedtest/v0.07.5/

from speedtest.

DarrenWhite99 avatar DarrenWhite99 commented on July 30, 2024

Sorry to just get around to testing. The program took under 30 seconds to fail the unreachable server 5 times, which is hugely improved. And of course, the program worked correctly and did not crash despite the invalid server in the selection.

I think that it should be less tolerant of this type of failure (server not responding). Packet loss for an ICMP packet is acceptable, sending multiples to measure is reasonable. But I think if a server drops or fails to initialize a TCP session that should be grounds for immediately skipping the server. If there is any difficulty encountered just trying to open and close a session initially, it wont likely make a good testing server attempting to upload and download multiple files as quickly as possible.

Thank You again for taking your time to create and improve this tool.

from speedtest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.