bertrandmartel / speed-test-lib

:cloud: JSpeedTest : speed test client library for Java/Android
MIT License
381 stars 119 forks source link

bitrate is very very high!! (not correct) #22

Open mjhram opened 7 years ago

mjhram commented 7 years ago

Hi, The bitrate I obtained in upload (.startFixedUpload("2.testdebit.info", 80, "/", 10000000, 10000);) is very high, which indicates an error in calculation somewhere... following is sample of output. real bitrate should be around 100kbps, but output is ~262Mbps.

V/speedtest: [UL PROGRESS] progress : 0.6554%
V/speedtest: [UL PROGRESS] rate in bit/s   : 262140000.0000
V/speedtest: [UL PROGRESS] progress : 1.3107%
V/speedtest: [UL PROGRESS] rate in bit/s   : 262140000.0000
V/speedtest: [UL PROGRESS] progress : 1.966%
V/speedtest: [UL PROGRESS] rate in bit/s   : 262140000.0000
V/speedtest: [UL PROGRESS] progress : 2.6214%
V/speedtest: [UL PROGRESS] rate in bit/s   : 299588571.4288
bertrandmartel commented 7 years ago

The issue is the same as #11 the problem is with flush() socket method. In some versions of Android, socket is not actually flushing (SO post). This behavior happens at the upload beginning and stabilizes after that. The workaround is to calculate only after a setup time for instance :

speedTestSocket.setUploadSetupTime(4000);
speedTestSocket.startFixedUpload("2.testdebit.info", 80, "/", 10000000, 10000);
mjhram commented 7 years ago

Hi, I noticed another issue, which I don't know its reason: When I try the DownloadFileExample with host="download.thinkbroadband.com" & uri="/20MB.zip", from PC, the file is downloaded correctly. Whey I try the android example with the same host&uri on mobile, the file starts downloading and then stopped, as if the host is waiting something, then off course timeout is raised. The download rate of the mobile is about 2.4Mbps and for PC, I used the mobile as a hotspot. Thanks

bertrandmartel commented 7 years ago

I've tried your endpoint and it's working fine for me on Android & PC (tried also with access point), what's your Android version ? Did you try another server URL, do you see the same behavior ?

mjhram commented 7 years ago

Thanks for your reply. I am using Galaxy S5 with Android 6.0.1. Following are some tries:

  1. I installed xampp and downloading from local server. The download completed without any issue.
  2. I used my own file on external server (http://ajerlitaxi.com/3gtests/files_db/dummy.bin), but also have the same issue. Download stopped after downloading about ~11MB. I think the issue is in TCP protocol, but I cannot find it. I am looking for some way to capture packets. I tried tPacketCapture (which uses VPN), but it has some issues. Now I am looking for someway without VPN.
mjhram commented 7 years ago

I capture packets using PC Wireshark: dump.pcapng Now, I used the PC as a hotspot and connect the mobile to it, so that I can capture packets using WireShark. If you can have a look, and help me find what is wrong, I would be appreciated. I think the peer ip is: 157.240.9.50 (Wireshark filter: ip.addr == 157.240.9.50)

bertrandmartel commented 7 years ago

I've tested your server and it's working fine for me on PC, mobile with 4G, mobile with Wifi (even with very low speed 1XX ko/s). Can you test with Mobile Wifi, do you see the same behavior ? Is it the same with other speed test server from this list

157.240.9.50 seems to be facebook.com, and the traffic is TLS so it's not related to your problem. The IP is 66.96.147.168 and I didn't find it in your capture

You should see something like : speed

By the way, could you check you haven't some download data limitation app or anything application related on your mobile. You can test on other smartphone to look if you have the same behavior

mjhram commented 7 years ago

I tried using rooted device with Android Icecream Sandwich and capture using "tcpdump" tool. I used two different mobiles as hotspot with different data plans (low and high data rate). I select a host from the Server List http://spt001.gorannet.net/speedtest/random3000x3000.jpg (ip: 95.159.66.9). Same issue happened. Following are dump files:

bertrandmartel commented 7 years ago

There seems to be a packet loss that trigger the whole dupACK, but this won't tell us the problem to fix. I will give you a version where you can modify socket parameter to test if that helps. For instance disabling KeepAlive among other things. I will try also 3G/2G, 2G only and 3G only to see if that change something for me

bertrandmartel commented 7 years ago

I've made some experiences with LTE networks since then but couldn't reproduce your issue. Did you make some progress with this ?

mjhram commented 7 years ago

Unfortunately no