Is there an efficient way to limit the bandwidth of a certain java process?
I am familiar with solutions like trickle
to limit bandwidth of a certain process on run time
sudo trickle -s -d 1024 /path/to/app.sh
But when dealing with java processes it makes it more of a challenge because the application initiates a JVM
or in some cases a WRAPPER service that initiates a JVM
- that means that solutions like 'trickle' will not work.
I can try and limit (using trickle
) the whole java process (by wrapping / messing up with /usr/bin/java
s.link) - UGLY.
Does anyone know of a better solution for limiting the bandwidth of a java process (JVM
)?
Thanks!
Unfortunately I don't think trickle can do it. I have similar issue and I solved it via throttling bandwidth on a particular port. For example you application opens port 34567 to communicate, then you can apply firewall setting and throttle it down.
On a mac I am using "ipfw", example:
sudo ipfw pipe 1 config bw 5KByte/s
sudo ipfw add 2 pipe 1 src-port 6666
On linux I am using "tc", examples & source: http://www.cyberciti.biz/faq/linux-traffic-shaping-using-tc-to-control-http-traffic/
As a final solution, you can create bash script that monitors processes and picks ones you need and throws port throttling on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With