[Samsung Galaxy Nexus] lioux:
Let's try fq_codel: it implements fair share across multiple flows using CoDel algorithm. You can notice it easily if you start an upload THEN simultaneously try to browse, use VoIP, play a network game... anything that would require low latency. It fights bufferbloat, read the top post for further information on it.

fq_codel+upload tests should yield results closer to the ones without an upload. fq_codel should help maintain better latency than any other scheduling algorithm. The upload speed rates should remain mostly unaffected by fq_codel.

The tests were conducted on a stock 4.2.2 maguro Galaxy Nexus with

latest AK 3.0.67+~ak.710.422.Cylon kernel. I did the tests between 01:00 and 03:00 local time (GMT-3).

root@android:/ # uname -a
Linux localhost 3.0.67+~ak.710.422.Cylon #1 SMP PREEMPT Wed Feb 27 06:54:36 CET 2013 armv7l GNU/Linux

Read the full post to gather an idea of what to expect. root access is required to perform these series of tests.

Here follows a simple upload + several ping/latency test guide. The ping tests are done against 187.7.117.32 (www.google.com).

1) Install the following applications from Play Store

1.1) Fing

1.2) Net Ping

1.3) Network Latency Checker

1.4) Terminal

2) Copy a huge file to your Galaxy Nexus. We will upload it later to create the upload test environment.

3) Connect your Galaxy Nexus to your WIFI network.

4) Make sure there is no other traffic on your network: no downloads, youtube, nothing.

5) Make sure fq_codel is not enabled.

5.1) Open Terminal

5.2) Type the following commands to make sure fq_codel is disabled

su
tc qdisc del dev wlan0 root fq_codel
tc -s qdisc

5.3) You should get a result similar to the following. The wlan0 qdisc should read pfifo_fast.

root@android:/ # su
root@android:/ # tc qdisc del dev wlan0 root fq_codel
Android does not support qdisc 'fq_codel'
root@android:/ # tc -s qdisc
Android does not support qdisc 'prio'
qdisc pfifo_fast 0: dev rmnet0 root refcnt 2 [cannot parse qdisc parameters]
Sent 2889806 bytes 15890 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
Android does not support qdisc 'prio'
qdisc pfifo_fast 0: dev p2p0 root refcnt 2 [cannot parse qdisc parameters]
Sent 8892 bytes 114 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
Android does not support qdisc 'prio'
qdisc pfifo_fast 0: dev wlan0 root refcnt 2 [cannot parse qdisc parameters]
Sent 25272 bytes 438 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0

6) Let's stablish a baseline. We will conduct all tests without any traffic on your network. Furthermore, note that fq_codel is not enabled.

7) Start Fing

7.1) Click Gear Icon

7.1.1) Host Tools -> Ping -> 187.7.117.32

7.2) Copy the results somewhere

8) Start Net Ping

8.1) Settings

8.1.1) Packet Count -> 100

8.1.2) Statistics -> Enable

8.1.3) Click Back

8.2) Ping 187.7.117.32

8.3) Copy the results somewhere

9) Start Network Latency Checker

9.1) Select 100 request , 0s delay , DNS

9.2) Click Check

9.3) Copy the results somewhere

9.4) Select 100 request , 0s delay , HTTP

9.5) Click Check

9.6) Copy the results somewhere

10) On your Galaxy Nexus, add the huge file from step 2 to your Google Drive. The upload will begin immediatly. If the upload finishes during any test, remove the file from Google Drive, upload it again then restart the given test.

11) Repeat Fing test

11.1) Copy the results somewhere

12) Repeat Net Ping test

12.1) Copy the results somewhere

13) Repeat Network Latency Checker test

13.1) Copy the results somewhere

14) Enable fq_codel. If the upload finishes, remove the file from Google Drive and upload it again.

14.1) Open Terminal

14.2) Type the following commands to make sure fq_codel is disabled

su
tc qdisc add dev wlan0 root fq_codel
tc -s qdisc

14.3) You should get a result similar to the following. The wlan0 qdisc should read fq_codel.

root@android:/ # su
root@android:/ # tc qdisc del dev wlan0 root fq_codel
Android does not support qdisc 'fq_codel'
root@android:/ # tc -s qdisc
Android does not support qdisc 'prio'
qdisc pfifo_fast 0: dev rmnet0 root refcnt 2 [cannot parse qdisc parameters]
Sent 2889806 bytes 15890 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
Android does not support qdisc 'prio'
qdisc pfifo_fast 0: dev p2p0 root refcnt 2 [cannot parse qdisc parameters]
Sent 8892 bytes 114 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
Android does not support qdisc 'fq_codel'
qdisc fq_codel 8001: dev wlan0 root refcnt 2 [cannot parse qdisc parameters]
Sent 525997 bytes 6231 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0

15) Repeat Fing test

15.1) Copy the results somewhere

16) Repeat Net Ping test

16.1) Copy the results somewhere

17) Repeat Network Latency Checker test

17.1) Copy the results somewhere

-----

For instance, here follows my personal results. The upload tests were conducted with a 150Mb upload to Google Drive as fast as my ADSL would allow it. My ADSL has an upload max speed rate of 512KiB.

1) Fing

1.1) Results with neither upload nor fq_codel

64 average ping
6% package loss
60 minimum ping
112 maximum ping
0 std dev ping
5 estimated hops

1.2) Results with upload but without fq_codel

226 average ping
2% package loss
68 minimum ping
580 maximum ping
2 std dev ping
5 estimated hops

1.3) Results with both upload and fq_codel

180 average ping
6% package loss
67 minimum ping
510 maximum ping
3 std dev ping
5 estimated hops

2) Net Ping

2.1) Results with neither upload nor fq_codel

187.7.117.32 min-max: 60.6-161ms
187.7.117.32 avg/stddev: 69.9/15.1ms

2.2) Results with upload but without fq_codel

187.7.117.32 min-max: 69.6-510ms
187.7.117.32 avg/stddev: 251/110ms

2.3) Results with both upload and fq_codel

187.7.117.32 min-max: 68.5-454ms
187.7.117.32 avg/stddev: 220/93.4ms

3) Network Latency Checker: 100 request , 0s delay , DNS

3.1) Results with neither upload nor fq_codel

Min: 166 Max: 9338 Avg: 554

3.2) Results with upload but without fq_codel

Min: 176 Max: 9306 Avg: 629

3.3) Results with both upload and fq_codel

Min: 82 Max: 9649 Avg: 554

4) Network Latency Checker: 100 request , 0s delay , HTTP

4.1) Results with neither upload nor fq_codel

Min: 260 Max: 3280 Avg: 342

4.2) Results with upload but without fq_codel

Min: 239 Max: 10021 Avg: 1017

4.3) Results with both upload and fq_codel

Min: 81 Max: 3477 Avg: 560

The Network Latency Checker results present fq_codel as the best possible option on all cases. This was unexpected. I repeated those tests several times but fq_codel was always the best. I'll have to further review the Network Latency Checker tests. Can you reproduce these "weird" results?

I can say that I am really satisfied with fq_codel on Android. It gave better performance than plain pfifo_fast with little extra cost.

You can also try the exact same tests using 3G instead of WIFI. Replacing wlan0 with rmnet0 on the aforementioned steps should be enough. Check which interface is UP when you're using radio with the "netcfg" command on Terminal.

I reached out to bufferbloat mailing list for suggestions on how to better test and tune the code for Android phones. :)

[Bloat] Testing fq_codel on Android Galaxy Nexus AK kernel

Anarkia, thanks a lot for your continuous work on improving the Galaxy Nexus experience.

Please, do not hesitate to suggest improvements or corrections to this post.