Boost Startup and Java/FileBot/Groovy Performance Tuning

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Boost Startup and Java/FileBot/Groovy Performance Tuning

Post by rednoah »

Level: Advanced

Here's an interesting article on how to improve JVM startup speeds:
https://github.com/jruby/jruby/wiki/Imp ... artup-time

On my DS213j (ARM) it takes 2500ms to run filebot without CDS, and it goes down to 1900ms with CDS.

CDS (class data sharing) is enabled by default, you may need to generate the shared class data once with this command once:

Code: Select all

java -Xshare:dump
On 32-bit system the Client VM is default. That's already optimized for initial speed. I've tried -client and -server options and it takes 25s and 45s respectively to initialize FileBot/Groovy and run scripts. Somehow Groovy class loading is really slow on my ARM-powered NAS.

On 64-bit systems where only the Server VM is available these options can boost startup speed at the expense of runtime performance:

Code: Select all

-XX:+TieredCompilation -XX:TieredStopAtLevel=1
Especially if you're calling FileBot Groovy scripts on a 64-bit systems then these options can really do make a big difference for startup performance.

e.g. calling time filebot yields the following results:

Code: Select all

time filebot -script "g:println 'Hello World'"
Server VM:

Code: Select all

real	0m7.086s
user	0m11.336s
sys	0m0.254s
Server VM with -XX:+TieredCompilation -XX:TieredStopAtLevel=1 (this should then work similar to the Client VM then)

Code: Select all

real	0m3.596s
user	0m4.632s
sys	0m0.192s
Although runtime performance will be lower, saving 4s right out of the box for every script call is probably worth it. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply