Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a performance difference between using 20 jars and using only one repacking them?

My program uses around 20 jars (for a total size of about 30mb). For now, they are all added to the classpath for the released version, and all jars are deployed with the rest.

Would there be a performance impact if I was unpacking them and repacking them into one jar?

like image 984
Gnoupi Avatar asked Aug 02 '10 21:08

Gnoupi


2 Answers

No, but there would not be any advantages either.

Personally I think you should deploy the very same jars that you develop on, unless you have a good reason not to. Repackaging can lead to subtle issues, if the original jars were sealed, but for an experienced team who likes an occasional challenge these are easily handled.

like image 149
Thorbjørn Ravn Andersen Avatar answered Sep 25 '22 20:09

Thorbjørn Ravn Andersen


The most obvious impact is the number of file handles open which is sometimes an issue on linux. Though if running out of file handles is an issue, the number of jars is unlikely to the problem point.

As I understand the index file keeps things pretty close to constant time to find anything in the jar.

Unpacking them all into directories (or a single directory) might give you a little boost. It would be short lived, though, as once the class is in the perm gen space that's all that is needed. It would have a long lived benefit on any non-class files you may read from the classpath via getResource() calls.

like image 30
David Blevins Avatar answered Sep 25 '22 20:09

David Blevins