OSGi at a Large-Scale Enterprise Lessons from eBay Justin Early, Sangjin Lee, & DebashisSaha eBay Inc.
Agenda Case for enterprise OSGi Speaking of scale... Migration challenges & observations IDE & build Tooling benefits Closing 2
Case for enterprise OSGi For all its virtues, OSGi is still a hard sell in (large scale) enterprises Why? 3
Case for enterprise OSGi Modularity: warm Runtime dynamism: not so much Operations needs predictability JavaEE containers are becoming OSGi ready: warm 4
Modularity Modularity is perhaps the best driver for OSGi in the enterprise Reduce surface areas Reduce coupling and increase cohesion However, modularity benefits are hard to quantify What is a PRACTICAL metric that demonstrates the compelling value of a modular architecture? Reduced coupling? Reduced build time? 5
Cost-benefit analysis Modularity benefits are long term, but the migration pain is immediate The very SCALE which necessitates the modularity discussion also makes migration very expensive 6
It feels like... 7
Speaking of scale... eBay’s code base has Thousands of jars Tens of thousands of packages Hundreds of thousands of classes Tens of millions of lines of code Even the simplest refactoring can become very expensive 8
Migration observations Everything needs to be in a bundle We’re finding a lot of existing problems to clean up Starting from a “super” bundle 9
Migration challenges What should be my module granularity? Package control policy Import-Package v. Require-Bundle (ala split packages) Dynamic classloading and resource loading 10
Migration challenges Limiting use of OSGi services Scale of development teams: training and support 11
Eclipse and OSGi Java Jars
Each tool adds required libraries as Bundle-Classpath entries
Convert Jars to Bundles using aQute's BND tool
Convert Library Projects into one plugin project using PDE tooling and use use it for build and compile time.
Closing It’s important to articulate WHY we need/want OSGi in the enterprise Less appetite for runtime dynamism than expected Start simple without advanced OSGi features Do not underestimate the refactoring/migration costs Putting the best and scalable IDE/build in place is supremely important 14