[LINUX] Bandwith Limit with Trickle

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
plittlefield
Posts: 83
Joined: 09 Mar 2014, 19:15

[LINUX] Bandwith Limit with Trickle

Post by plittlefield » 01 Jul 2018, 12:02

Hello everyone,

I am trying to use the TCP bandwidth control software called TRICKLE (https://manurevah.com/blah/en/p/trickle-bandwith-shaper) to control how much of my internet download is used when using FileBot.

The script I wrote runs FileBot on a SSHFS mounted filesystem from my seedbox in another country.

The command I run to limit the download bandwidth to 128K

Code: Select all

/usr/bin/trickle -d 128 /usr/bin/filebot -script /home/paully/.filebot/scripts/amc_.groovy --output "/home/paully/Plex" etc
It runs but but when I look at the Linux process tree, trickle is not running at all and Java seems to be the main process.

Java CAN use trickle because it had the libc stack...

Code: Select all

ldd /usr/bin/java
        linux-vdso.so.1 =>  (0x00007ffc94dfc000)
        libjli.so => not found
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1cbf191000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1cbf561000)
How can I get the extra command '/usr/bin/trickle' in the /usr/bin/filebot when Java is called?

Does anyone else use trickle or is there a clever add-on or switch for FileBot to limit TCP bandwidth?

Thanks in advance,

:-)

Paully
FileBot 4.8.2 (r5789)
JNA Native: 5.2.2
MediaInfo: 18.05
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-09-28 (r535)
Groovy: 2.5.1
JRE: Java(TM) SE Runtime Environment 10.0.2
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 3 GB Max Memory / 64 MB Used Memory
OS: Linux (amd64)
HW: Linux nas 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Package: DEB

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [LINUX] Bandwith Limit with Trickle

Post by rednoah » 01 Jul 2018, 12:48

1.
You could run a local proxy server that throttles bandwidth, and then have all your apps connect through that: https://vinusumi.wordpress.com/2016/07/ ... uid-proxy/


2.
FileBot / Java do not have an easy way to throttle IO bandwidth. How did you confirm that trickle indeed works with java processes? Java is basically an entire OS in itself, with it's own network stack, so there's a good chance it's not using the libc TCP stack at all.

Note that /usr/bin/filebot just links to a shell script that in turn executes java. Modifying filebot.sh and putting trickle -d 128 right before the java call might work (assuming that java is using libc for TCP on Linux).
:idea: Please read the FAQ and How to Request Help.

plittlefield
Posts: 83
Joined: 09 Mar 2014, 19:15

Re: [LINUX] Bandwith Limit

Post by plittlefield » 21 Nov 2018, 23:03

Would this work in FileBot?

https://github.com/lucabox/Java-BandwidthLimiter

Regards,

Paul
FileBot 4.8.2 (r5789)
JNA Native: 5.2.2
MediaInfo: 18.05
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-09-28 (r535)
Groovy: 2.5.1
JRE: Java(TM) SE Runtime Environment 10.0.2
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 3 GB Max Memory / 64 MB Used Memory
OS: Linux (amd64)
HW: Linux nas 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Package: DEB

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [LINUX] Bandwith Limit with Trickle

Post by rednoah » 22 Nov 2018, 07:32

Unfortunately, no. Support for bandwidth limits in the application layer is not planned (as it would be extremely difficult to actually make work well on this layer of abstraction).

Using network layer tools, such as VPNs, or Proxies, or switches / routers with bandwidth limit features is generally recommended.
:idea: Please read the FAQ and How to Request Help.

plittlefield
Posts: 83
Joined: 09 Mar 2014, 19:15

Re: [LINUX] Bandwith Limit with Trickle

Post by plittlefield » 22 Nov 2018, 07:58

Okay, fair enough.
FileBot 4.8.2 (r5789)
JNA Native: 5.2.2
MediaInfo: 18.05
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-09-28 (r535)
Groovy: 2.5.1
JRE: Java(TM) SE Runtime Environment 10.0.2
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 3 GB Max Memory / 64 MB Used Memory
OS: Linux (amd64)
HW: Linux nas 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Package: DEB

Post Reply