the ultimate dependency manager shootout
play

The Ultimate Dependency Manager Shootout Xander Uiterlinden - PowerPoint PPT Presentation

The Ultimate Dependency Manager Shootout Xander Uiterlinden @uiterlix Sander Mak @sander_mak Luminis Technologies Who we are S ander Mak http://branchandbound.net @sander_mak X ander Uiterlinden http://blog.uiterlinden.nl @uiterlix


  1. The Ultimate Dependency Manager Shootout Xander Uiterlinden @uiterlix Sander Mak @sander_mak � Luminis Technologies

  2. Who we are S ander Mak http://branchandbound.net @sander_mak X ander Uiterlinden http://blog.uiterlinden.nl @uiterlix @uiterlix @sander_mak

  3. Agenda OSGi Services Dependency Managers Comparison Overview/community Code Performance Conclusion @uiterlix @sander_mak

  4. OSGi Services

  5. OSGi Services api + impl package dependency Provider Bundle � new MyServiceImpl() Consumer api.MyService Bundle impl.MyServiceImpl Strong coupling to implementation � What if provider bundle not available/stops? � What about con fi guration? @uiterlix @sander_mak

  6. OSGi Services only api package dependency Provider Bundle � Consumer � api.MyService Bundle impl.MyServiceImpl lookup register OSGi Service Registry Decoupling through interfaces Inversion of Control Service dynamics @uiterlix @sander_mak

  7. Dependency Managers

  8. Why Dependency Managers? @uiterlix @sander_mak

  9. Why Dependency Managers? Cut down the boilerplate Decouple from OSGi APIs Dependency Injection Testability Components…? � Component models � org.apache.felix.ipojo.annotations. Component � Aspects org.osgi.service.component.annotations. Component aQute.bnd.annotation.component. Component � org.apache.felix.dm.annotation.api. Component � Adapters org.springframework.stereotype. Component � …. Etc. � Notions: contract-based, reactive, explicit lifecycle @uiterlix @sander_mak

  10. Comparison

  11. The lineup Felix Felix Service Declarative Dependency Component Services � Manager Runtime � � Equinox � KnopflerFish Eclipse Gemini Felix iPojo Blueprint Blueprint � � Apache Aries Compendium Implementations Speci fi cations @uiterlix @sander_mak

  12. The lineup: disclaimer We primarily work with (and on) Felix DM @uiterlix @sander_mak

  13. Declarative Services Since R4 (2005) Bundle 1 Bundle 2 DS 1.1 with R4.2, DS 1.2 with R5 reference XML based Component � Component � Service Instance Instance True POJOs provide Component � Component � Description Description Or: DS annotations to generate XML � Additional abstractions: ComponentContext for each component ComponentFactory: client initiates instantiation @uiterlix @sander_mak

  14. Felix SCR Apache 2.0 License 2007 Since March 2014 Last release ~50 msg User list Open issues 25 @uiterlix @sander_mak

  15. Eclipse Gemini Blueprint 2009 DM Server Gemini Blueprint Spec since R4.2 (2009) Bundle 1 Bundle 2 Familiar for Spring devs Application Application reference Context Context Declarative: XML based Bean Service Bean Bean Annotations in Aries, but not in spec (or Gemini) export Bean Bean Components proxied: ‘Dampens’ service dynamics @uiterlix @sander_mak

  16. Eclipse Gemini Blueprint EPL License 2009 Since August 2012 Last release ~60 msg User list Open issues 17 Lots of 404s :( @uiterlix @sander_mak

  17. Felix Dependency Manager DSL for component de fi nition in Activator Service Bundle 1 Bundle 2 Programmatic aspect reference Component � Component � Annotation based (bnd plugin) Instance Instance Service adapt Embraces service dynamics Component � Instance Service’ publish Additional abstractions: Aspect: intercept and republish service Adapter: publish service with adapted interface @uiterlix @sander_mak

  18. Felix Dependency Manager Apache 2.0 License 2004 Since Januari 2013 Last release ~1 msg User list Open issues 22 @uiterlix @sander_mak

  19. Felix iPojo Programmatic API, XML and annotations Bundle 1 Bundle 2 provide Proxy based Component Component Bytecode manipulation Service require Component � Component � instance instance � Additional abstractions: � Composites: intra-bundle mechanism Scoped service registries Pluggable handlers @uiterlix @sander_mak

  20. Felix iPojo Apache 2.0 License 2008 Since March 2014 Last release ~130 msg User list Open issues 30 Best site among DMs! @uiterlix @sander_mak

  21. Comparison: code

  22. The example http://bit.ly/dmshootout @uiterlix @sander_mak

  23. Extender pattern Service Registry register Some-Header: … services Application bundle 1 SCR/iPojo/Blueprint/(DM � Application bundle 2 runtime) bundle Application bundle 3 @uiterlix @sander_mak

  24. Declarative Services Temperate Sensor Bundle META-INF/MANIFEST.MF � OSGI-INF/temp.xml � � TemperatureSensor.class @uiterlix @sander_mak

  25. Declarative Services Dashboard Bundle @uiterlix @sander_mak

  26. Declarative Services No direct fi eld injection Defaults: Delayed component (activate on use) Static policy -> many reactivations � What if Static Dynamic � ‘better’ Reluctant Do nothing Rebind optionals � service Greedy Reactivate Rebind arrives? @uiterlix @sander_mak

  27. BluePrint Temperate Sensor Bundle Bundle-Blueprint header optional META-INF/MANIFEST.MF � OSGI-INF/blueprint/temp.xml � � TemperatureSensor.class @uiterlix @sander_mak

  28. BluePrint snipped 10+ lines of namespaces :( Dashboard Bundle @uiterlix @sander_mak

  29. BluePrint � Strong focus on intra-bundle composition Hides dynamicity (until TimeOutException…) If dependency goes away, component is not stopped. If service is exposed, unregisters it. No lazy activation like DS Whole ‘applicationContext’ started or not (Custom) TypeConverters Constructor/setter injection, no fi eld injection Namespace hell :( @uiterlix � @sander_mak

  30. Felix Dependency Manager Temperate Sensor Bundle META-INF/MANIFEST.MF � � Activator.class � TemperatureSensor.class @uiterlix @sander_mak

  31. Felix Dependency Manager Dashboard Bundle @uiterlix @sander_mak

  32. Felix Dependency Manager It’s code : dynamically create and depend on services Annotations available (+ bnd plugin) Field injection, NullObject pattern Manual mgmt. of list of dependencies :( Services registered eagerly from Activator Features: aspects, adapters � DM 4 coming up… @uiterlix @sander_mak

  33. Felix Dependency Manager https://bitbucket.org/uiterlix/ravioli � @uiterlix @sander_mak

  34. Felix iPojo Temperate Sensor Bundle � TemperatureSensor.class � metadata.xml � � META-INF/MANIFEST.MF � Generated by IDE plugin by processing annotations and metadata.xml @uiterlix @sander_mak

  35. Felix iPojo @uiterlix @sander_mak

  36. Felix iPojo Both ‚static’ con fi guration and con fi guration using code Dependency manager with the most advanced features: External handlers Service binding interceptors Stereotypes Annotations limited to declaring components and ‚simple’ instances. XML recommended for declaring instances. Shell commands for component inspection � @uiterlix @sander_mak

  37. Comparison: performance

  38. Benchmarks Don’t be afraid of too many services ? Promises… � „ Each bundle may register zero or more services. Each bundle may also use zero or more services. There exists no limit on the number of services, more than the ones given by memory limits or java security permissions. ” (Knopler fi sh tutorial) @uiterlix @sander_mak

  39. Benchmark scenario � � Temperature sensors for each postal code in the Nederlands 463860 Sensor services � Service properties: - Province - Municipality - City - PostalCode @uiterlix @sander_mak

  40. Benchmarks Publishing Sensor services Felix, Equinox, Knopler fi sh Plain OSGi, DM, iPojo � Consuming Sensor services Whiteboard; all sensors in Amsterdam 
 (&(province=Noord-Holland)(municipality=Amsterdam)) Felix, Equinox, Knopler fi sh DS, DM, iPojo, Blueprint @uiterlix @sander_mak

  41. Disclaimer Results are as-is, no further investigation done No optimizations done � You can repeat these tests yourself. Projects are available on github http://bit.ly/dmshootout @uiterlix @sander_mak

  42. Register services (Equinox) OSGi DM iPojo ipojo 700000 525000 Duration in ms. 350000 175000 DM OSGi 0 10000 30000 50000 70000 90000 110000 130000 150000 170000 190000 210000 230000 250000 270000 290000 310000 330000 350000 370000 390000 410000 430000 450000 @uiterlix @sander_mak

  43. Register services (Felix) OSGi DM iPojo 250000 iPojo 200000 150000 DM 100000 OSGi 50000 0 10000 30000 50000 70000 90000 110000 130000 150000 170000 190000 210000 230000 250000 270000 290000 310000 330000 350000 370000 390000 410000 430000 450000 @uiterlix @sander_mak

  44. Register services (Knopler fi sh) OSGi DM iPojo 250000 iPojo 200000 150000 100000 50000 DM OSGi 0 10000 30000 50000 70000 90000 110000 130000 150000 170000 190000 210000 230000 250000 270000 290000 310000 330000 350000 370000 390000 410000 430000 450000 @uiterlix @sander_mak

  45. Register services (combined) OSGi equinox DM equinox iPojo equinox OSGi felix DM felix iPojo felix OSGi knoplerfish DM knoplerfish iPojo knoplerfish 700000 iPojo Equinox 600000 500000 400000 300000 iPojo Felix & Knopler fi sh 200000 OSGi & DM Felix 100000 0 10000 30000 50000 70000 90000 110000 130000 150000 170000 190000 210000 230000 250000 270000 290000 310000 330000 350000 370000 390000 410000 430000 450000 OSGi & DM Equinox & Knopler fi sh @uiterlix @sander_mak

Recommend


More recommend