Is OSGi
adapted for high performance application servers?
OSGi
helps a lot to produce highly modular applications but what is the impact on performance since the model of execution is different than regular Java applications (since I understand that the OSGi
applications run on specific platform, as Apache Felix
).
What are your experiences with the different implementations in term of performance?
Thanks
In my experience, moving applications from non-OSGi to an OSGi environment (using Felix) has made no impact on performance. Each build I produce is subjected to stress tests; the results of the stress tests have indicated no drop in performance.
It might depend on what your application does. I'll discount explicit OSGi concepts such as services as such new code will need your own testing and I'm assuming you're asking what the impact is on existing POJO code.
The implicit impact of an OSGi environment is mainly on class loading. As you probably know, OSGi mandates separate class loaders for each bundle, and provides a way of wiring code in bundles to dependencies in other bundles. When a class in a bundle calls a class in a different bundle, it is the second bundle's classloader that is responsible for loading that second class class.
It might be (but probably won't be) that this class loading logic consumes a little extra work than the default class loaders used in a vanilla Java environment. However, unless your code is itself re-creating and reloading classes constantly, which is unlikely, any performance impact is likely to be negligible. And in any case, that's just a theoretical possibility. It's up to the implementation you choose to be as efficient as possible.
There is also a small impact on memory footprint. It's best to take a heap dump and use something like mat to analyse this.
You'll spend much more time getting your head around OSGi conceptually, differences between OSGi containers, tools, version management and more than you will waiting for classes to load, believe me ;)
OSGi can result in a very small performance increase due to faster classloading. It can also result in a very small increase in memory consumption due to multiple classloaders.
Contrary to the assertion in your question: OSGi does not change the Java execution model.
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