Network Traffic Sense Mode

Want something added? Ask for it here.
Post Reply
hl2guide
Jr. Member
Jr. Member
Posts: 71
Joined: August 31st, 2016, 3:17 am

Network Traffic Sense Mode

Post by hl2guide »

Please consider "network traffic sensing" for specific processes or a network adapter.

e.g:
"JDownloader2.exe"
OR
"Network Adapter #1"

It could sense traffic from the other process/adapter and then pause the queue.
Auto-resuming when the other process/adapter has no/little traffic.

It would be useful to play nice with other downloaders, especially one that have hosts with quotas and time limits. 8)
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Network Traffic Sense Mode

Post by sander »

Yeah, I like that!

To make it OS independent: python offers psutil to measure traffic over interfaces. See below.

But that way you don't take into account traffic by other devices on your LAN / Internet connection. To tackle it all: keep pinging to 1.1.1.1 or 8.8.8.8, and as soon as the ping time is relatively high, SAB could throttle down.

Code: Select all

>>> import psutil
>>> psutil.net_io_counters(pernic=True)
{'veth89f324e': snetio(bytes_sent=8482919, bytes_recv=867900, packets_sent=24290, packets_recv=2530, errin=0, errout=0, dropin=0, dropout=0), 'br-adc818727e59': snetio(bytes_sent=0, bytes_recv=0, packets_sent=0, packets_recv=0, errin=0, errout=0, dropin=0, dropout=0), 'vethd18f0b4': snetio(bytes_sent=68740585, bytes_recv=0, packets_sent=196196, packets_recv=0, errin=0, errout=0, dropin=0, dropout=0), 'wlo1': snetio(bytes_sent=788082436, bytes_recv=13777769664, packets_sent=4653808, packets_recv=12630144, errin=0, errout=0, dropin=0, dropout=0), 'lo': snetio(bytes_sent=24231863, bytes_recv=24231863, packets_sent=239782, packets_recv=239782, errin=0, errout=0, dropin=0, dropout=0), 'docker0': snetio(bytes_sent=317765562, bytes_recv=4542384, packets_sent=260835, packets_recv=50049, errin=0, errout=0, dropin=0, dropout=0), 'eno1': snetio(bytes_sent=0, bytes_recv=0, packets_sent=0, packets_recv=0, errin=0, errout=0, dropin=0, dropout=0), 'teredo': snetio(bytes_sent=1152, bytes_recv=826, packets_sent=17, packets_recv=9, errin=0, errout=0, dropin=0, dropout=0)}
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Network Traffic Sense Mode

Post by sander »

And, the first step would be to create an external script, talking to SAB's API to throttle down and up.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Network Traffic Sense Mode

Post by sander »

On my wired fiber connection, downloading at full line speed does NOT influence the ping time. Weird.

However, on wifi DSL, downloading at full line speed DOES influence the ping time. And it makes Internet slow. So

Code: Select all

# SAB not active, no baseline ping

$ ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=60 time=17.6 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=60 time=13.8 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=60 time=13.0 ms
64 bytes from 1.1.1.1: icmp_seq=4 ttl=60 time=12.7 ms
64 bytes from 1.1.1.1: icmp_seq=5 ttl=60 time=17.0 ms
64 bytes from 1.1.1.1: icmp_seq=6 ttl=60 time=12.4 ms
64 bytes from 1.1.1.1: icmp_seq=7 ttl=60 time=14.9 ms
64 bytes from 1.1.1.1: icmp_seq=8 ttl=60 time=12.2 ms
64 bytes from 1.1.1.1: icmp_seq=9 ttl=60 time=11.9 ms
64 bytes from 1.1.1.1: icmp_seq=10 ttl=60 time=16.7 ms

# SAB starts downloading .. ping goes up

64 bytes from 1.1.1.1: icmp_seq=11 ttl=60 time=181 ms
64 bytes from 1.1.1.1: icmp_seq=12 ttl=60 time=335 ms
64 bytes from 1.1.1.1: icmp_seq=13 ttl=60 time=1103 ms
64 bytes from 1.1.1.1: icmp_seq=14 ttl=60 time=277 ms
64 bytes from 1.1.1.1: icmp_seq=15 ttl=60 time=136 ms
64 bytes from 1.1.1.1: icmp_seq=16 ttl=60 time=52.1 ms
64 bytes from 1.1.1.1: icmp_seq=17 ttl=60 time=777 ms
64 bytes from 1.1.1.1: icmp_seq=18 ttl=60 time=550 ms
64 bytes from 1.1.1.1: icmp_seq=19 ttl=60 time=523 ms
64 bytes from 1.1.1.1: icmp_seq=20 ttl=60 time=203 ms
64 bytes from 1.1.1.1: icmp_seq=21 ttl=60 time=170 ms
64 bytes from 1.1.1.1: icmp_seq=22 ttl=60 time=766 ms
64 bytes from 1.1.1.1: icmp_seq=23 ttl=60 time=622 ms
64 bytes from 1.1.1.1: icmp_seq=24 ttl=60 time=253 ms
64 bytes from 1.1.1.1: icmp_seq=25 ttl=60 time=161 ms
64 bytes from 1.1.1.1: icmp_seq=26 ttl=60 time=694 ms
64 bytes from 1.1.1.1: icmp_seq=27 ttl=60 time=419 ms
64 bytes from 1.1.1.1: icmp_seq=28 ttl=60 time=389 ms
64 bytes from 1.1.1.1: icmp_seq=29 ttl=60 time=180 ms
64 bytes from 1.1.1.1: icmp_seq=30 ttl=60 time=175 ms
64 bytes from 1.1.1.1: icmp_seq=31 ttl=60 time=609 ms
64 bytes from 1.1.1.1: icmp_seq=32 ttl=60 time=397 ms

# SAB pauses, ping goes back to normal again

64 bytes from 1.1.1.1: icmp_seq=33 ttl=60 time=12.3 ms
64 bytes from 1.1.1.1: icmp_seq=34 ttl=60 time=14.3 ms
64 bytes from 1.1.1.1: icmp_seq=35 ttl=60 time=13.0 ms
64 bytes from 1.1.1.1: icmp_seq=36 ttl=60 time=12.7 ms
64 bytes from 1.1.1.1: icmp_seq=37 ttl=60 time=60.3 ms
On this wifi ADSL line, max speed is 2 - 3 MB/s
When I limit SAB speed to 2 MB/s, ping stays high
When I lower it to 1 MB/s, ping goes to nice values:

Code: Select all

64 bytes from 1.1.1.1: icmp_seq=197 ttl=60 time=13.6 ms
64 bytes from 1.1.1.1: icmp_seq=198 ttl=60 time=16.4 ms
64 bytes from 1.1.1.1: icmp_seq=199 ttl=60 time=12.7 ms
64 bytes from 1.1.1.1: icmp_seq=200 ttl=60 time=14.8 ms
64 bytes from 1.1.1.1: icmp_seq=201 ttl=60 time=41.9 ms
64 bytes from 1.1.1.1: icmp_seq=202 ttl=60 time=18.2 ms
Ah, nice: the Wrench speed test reports "Internet Bandwidth 3 MB/s", so very actual, so a good baseline for SAB setting it's max speed.

Manual PoC: measuring ping time => setting SAB speed => measuring ping time => etc

Code: Select all

sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=1'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=30'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.5'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.8'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.2'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.4'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.3'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.2'
ok
Oh, and absolute values:

Code: Select all

sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=2.2M'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=30M'
ok
sander@witte2004:~$ curl 'http://127.0.0.1:8080/api?mode=config&name=speedlimit&value=1.1M'
ok
Nice.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Network Traffic Sense Mode

Post by sander »

@hl2guide ... can you show your ping time during Paused and Downloading?
Post Reply