Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any Java libraries for adjusting IO scheduler priority on linux

Tags:

java

linux

I have a Java program running on a linux system, which I would like to give a higher IO Scheduler priority. Is there a library JNI/JNA based that would allow me to do that from within my code?

like image 333
Michael Barker Avatar asked May 16 '26 23:05

Michael Barker


2 Answers

You could spawn and external command and call ionice on your process.

like image 136
Romain Hippeau Avatar answered May 19 '26 13:05

Romain Hippeau


You can get the PID of the Java Process by using the Java Management API, at least when using the Sun JVM. Have a look at the actual implementations of the management objects, one returns the pid (don't know which for the moment).

Then I would use jnative to call the linux function, so you don't have to rely on ionice to be installed.

like image 36
Daniel Avatar answered May 19 '26 13:05

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!