The Ultimate Dependency Manager Shootout (QCon NY 2014)

1,113 views

Published on

Working with micro-services is arguably the best part of OSGi development. However, everyone agrees that tracking service dependencies with the bare-bones OSGi API is not ideal. So, you pick one of the available dependency managers: either Declarative Services, Felix Dependency manager, Blueprint or iPojo.

But how do you pick the right one? Easy! After this shoot-out you’ll know all about the performance, usability and other aspects of the existing dependency managers. We show the strengths and weaknesses of the implementations side-by-side. How usable is the API? What about performance, does it scale beyond trivial amounts of services? Does it matter which OSGi framework you run the dependency manager in?

Make up your mind with the facts presented in this session.

Published in: Software, Technology
1 Comment
3 Likes
Statistics
Notes
  • Just wanted to note that Declarative Service also supports annotations. Granted, they are generated into XML, but from a developer's point of view they work with annotations. This is briefly mentioned in one of the slides, but doesn't really come out too well in the deeper comparison.

    Additionally, on slides 51/59 Blueprint is blamed for many lines of namespaces. I believe the namespaces referred to are Gemini-specific extensions, because OSGi Blueprint only defines one single namespace.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
1,113
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
5
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

The Ultimate Dependency Manager Shootout (QCon NY 2014)

  1. 1. Xander Uiterlinden Sander Mak ! Luminis Technologies @uiterlix @sander_mak The Ultimate Dependency Manager Shootout
  2. 2. @uiterlix @sander_mak Who we are Sander Mak http://branchandbound.net @sander_mak http://blog.uiterlinden.nl @uiterlix Xander Uiterlinden
  3. 3. @uiterlix @sander_mak Agenda OSGi Services Dependency Managers Comparison Overview/community Code Performance Conclusion
  4. 4. OSGi Services
  5. 5. @uiterlix @sander_mak OSGi Services Provider Bundle! api.MyService impl.MyServiceImpl Consumer Bundle new MyServiceImpl() Strong coupling to implementation ! What if provider bundle not available/stops? ! What about configuration? api + impl package dependency
  6. 6. @uiterlix @sander_mak register OSGi Service Registry Provider Bundle! api.MyService impl.MyServiceImpl Consumer! Bundle lookup only api package dependency Decoupling through interfaces Inversion of Control Service dynamics OSGi Services
  7. 7. Dependency Managers
  8. 8. @uiterlix @sander_mak Why Dependency Managers?
  9. 9. @uiterlix @sander_mak Why Dependency Managers?
  10. 10. @uiterlix @sander_mak Why Dependency Managers?
  11. 11. @uiterlix @sander_mak Why Dependency Managers? Cut down the boilerplate Decouple from OSGi APIs Dependency Injection Testability Component models Aspects Adapters Etc.
  12. 12. @uiterlix @sander_mak Why Dependency Managers? Cut down the boilerplate Decouple from OSGi APIs Dependency Injection Testability Component models Aspects Adapters Etc. Components…?! ! org.apache.felix.ipojo.annotations.Component! org.osgi.service.component.annotations.Component aQute.bnd.annotation.component.Component! org.apache.felix.dm.annotation.api.Component! org.springframework.stereotype.Component! …. ! Notions: contract-based, reactive, explicit lifecycle
  13. 13. Comparison
  14. 14. @uiterlix @sander_mak The lineup Felix Dependency Manager Felix iPojo Declarative Services Blueprint
  15. 15. @uiterlix @sander_mak The lineup Felix Dependency Manager Felix iPojo Compendium Specifications Declarative Services Blueprint
  16. 16. @uiterlix @sander_mak The lineup Felix Dependency Manager Felix iPojo Implementations Compendium Specifications Declarative Services Blueprint
  17. 17. @uiterlix @sander_mak The lineup Felix Dependency Manager Felix iPojo Implementations Compendium Specifications Declarative Services ! ! KnopflerFish ! ! Equinox ! ! Apache Aries Felix Service Component Runtime Eclipse Gemini Blueprint Blueprint
  18. 18. @uiterlix @sander_mak The lineup: disclaimer We primarily work with (and on) Felix DM
  19. 19. @uiterlix @sander_mak Since R4 (2005) DS 1.1 with R4.2, DS 1.2 with R5 XML based True POJOs Or: DS annotations to generate XML ! Declarative Services
  20. 20. @uiterlix @sander_mak Since R4 (2005) DS 1.1 with R4.2, DS 1.2 with R5 XML based True POJOs Or: DS annotations to generate XML ! Additional abstractions: ComponentContext for each component ComponentFactory: client initiates instantiation Bundle 1 Component! Instance Component! Description Bundle 2 Component! Instance Component! Description Service reference provide Declarative Services
  21. 21. @uiterlix @sander_mak Felix SCR Last release User list License March 2014 ~50 msg Apache 2.0 Open issues 25 Since 2007
  22. 22. @uiterlix @sander_mak Eclipse Gemini Blueprint DM Server Gemini Blueprint Spec since R4.2 (2009) Familiar for Spring devs Declarative: XML based Annotations in Aries, but not in spec (or Gemini) Components proxied: ‘Dampens’ service dynamics 2009
  23. 23. @uiterlix @sander_mak Eclipse Gemini Blueprint DM Server Gemini Blueprint Spec since R4.2 (2009) Familiar for Spring devs Declarative: XML based Annotations in Aries, but not in spec (or Gemini) Components proxied: ‘Dampens’ service dynamics 2009 Bundle 1 Application Context Bundle 2 Service reference export Bean Bean Bean Application Context Bean Bean
  24. 24. @uiterlix @sander_mak Eclipse Gemini Blueprint Last release User list License August 2012 ~60 msg EPL Open issues 17 Since 2009
  25. 25. @uiterlix @sander_mak Lots of 404s :( Eclipse Gemini Blueprint Last release User list License August 2012 ~60 msg EPL Open issues 17 Since 2009
  26. 26. @uiterlix @sander_mak Lots of 404s :( Eclipse Gemini Blueprint Last release User list License August 2012 ~60 msg EPL Open issues 17 Since 2009
  27. 27. @uiterlix @sander_mak Felix Dependency Manager DSL for component definition in Activator Programmatic Annotation based (bnd plugin) Embraces service dynamics
  28. 28. @uiterlix @sander_mak Felix Dependency Manager DSL for component definition in Activator Programmatic Annotation based (bnd plugin) Embraces service dynamics Bundle 1 Component! Instance Bundle 2 Component! Instance Component! Instance Service reference adapt Service’ publish Service aspect Additional abstractions: Aspect: intercept and republish service Adapter: publish service with adapted interface
  29. 29. @uiterlix @sander_mak Felix Dependency Manager Last release User list License Januari 2013 ~1 msg Apache 2.0 Open issues 22 Since 2004
  30. 30. @uiterlix @sander_mak Programmatic API, XML and annotations Proxy based Bytecode manipulation Felix iPojo
  31. 31. @uiterlix @sander_mak Programmatic API, XML and annotations Proxy based Bytecode manipulation Felix iPojo Bundle 1 Bundle 2 Component Component! instance Service provide Component require Component! instance ! ! Composites: intra-bundle mechanism Scoped service registries Pluggable handlers Additional abstractions:
  32. 32. @uiterlix @sander_mak Felix iPojo Last release User list License March 2014 ~130 msg Apache 2.0 Open issues 30 Since 2008
  33. 33. @uiterlix @sander_mak Felix iPojo Last release User list License March 2014 ~130 msg Apache 2.0 Open issues 30 Since 2008 Best site among DMs!
  34. 34. Comparison: code
  35. 35. @uiterlix @sander_mak The example http://bit.ly/dmshootout
  36. 36. @uiterlix @sander_mak Extender pattern Application bundle 1 Application bundle 2 Application bundle 3 SCR/iPojo/Blueprint/(DM! runtime) bundle Service Registry Some-Header: … register services
  37. 37. @uiterlix @sander_mak Declarative Services META-INF/MANIFEST.MF! OSGI-INF/temp.xml! ! TemperatureSensor.class Temperate Sensor Bundle
  38. 38. @uiterlix @sander_mak Declarative Services META-INF/MANIFEST.MF! OSGI-INF/temp.xml! ! TemperatureSensor.class Temperate Sensor Bundle
  39. 39. @uiterlix @sander_mak Declarative Services META-INF/MANIFEST.MF! OSGI-INF/temp.xml! ! TemperatureSensor.class Temperate Sensor Bundle
  40. 40. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  41. 41. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  42. 42. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  43. 43. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  44. 44. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  45. 45. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  46. 46. @uiterlix @sander_mak Declarative Services Dashboard Bundle
  47. 47. @uiterlix @sander_mak Declarative Services No direct field injection Defaults: Delayed component (activate on use) Static policy -> many reactivations ! ! ! Static Dynamic Reluctant Do nothing Rebind optionals Greedy Reactivate Rebind What if ‘better’ service arrives?
  48. 48. @uiterlix @sander_mak META-INF/MANIFEST.MF! OSGI-INF/blueprint/temp.xml! ! TemperatureSensor.class Temperate Sensor Bundle BluePrint
  49. 49. @uiterlix @sander_mak META-INF/MANIFEST.MF! OSGI-INF/blueprint/temp.xml! ! TemperatureSensor.class Temperate Sensor Bundle Bundle-Blueprint header optional BluePrint
  50. 50. @uiterlix @sander_mak META-INF/MANIFEST.MF! OSGI-INF/blueprint/temp.xml! ! TemperatureSensor.class Temperate Sensor Bundle Bundle-Blueprint header optional BluePrint
  51. 51. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  52. 52. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  53. 53. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  54. 54. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  55. 55. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  56. 56. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  57. 57. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  58. 58. @uiterlix @sander_mak BluePrint Dashboard Bundle snipped 10+ lines of namespaces :(
  59. 59. @uiterlix @sander_mak 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 field injection Namespace hell :( !
  60. 60. @uiterlix @sander_mak Felix Dependency Manager META-INF/MANIFEST.MF! ! Activator.class! TemperatureSensor.class Temperate Sensor Bundle
  61. 61. @uiterlix @sander_mak Felix Dependency Manager META-INF/MANIFEST.MF! ! Activator.class! TemperatureSensor.class Temperate Sensor Bundle
  62. 62. @uiterlix @sander_mak Felix Dependency Manager META-INF/MANIFEST.MF! ! Activator.class! TemperatureSensor.class Temperate Sensor Bundle
  63. 63. @uiterlix @sander_mak Felix Dependency Manager META-INF/MANIFEST.MF! ! Activator.class! TemperatureSensor.class Temperate Sensor Bundle
  64. 64. @uiterlix @sander_mak Felix Dependency Manager META-INF/MANIFEST.MF! ! Activator.class! TemperatureSensor.class Temperate Sensor Bundle
  65. 65. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  66. 66. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  67. 67. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  68. 68. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  69. 69. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  70. 70. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  71. 71. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  72. 72. @uiterlix @sander_mak Felix Dependency Manager Dashboard Bundle
  73. 73. @uiterlix @sander_mak 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…
  74. 74. @uiterlix @sander_mak Felix Dependency Manager https://bitbucket.org/uiterlix/ravioli !
  75. 75. @uiterlix @sander_mak Felix Dependency Manager https://bitbucket.org/uiterlix/ravioli !
  76. 76. @uiterlix @sander_mak Felix iPojo ! TemperatureSensor.class! metadata.xml! ! META-INF/MANIFEST.MF! Temperate Sensor Bundle Generated by IDE plugin by processing annotations and metadata.xml
  77. 77. @uiterlix @sander_mak Felix iPojo ! TemperatureSensor.class! metadata.xml! ! META-INF/MANIFEST.MF! Temperate Sensor Bundle Generated by IDE plugin by processing annotations and metadata.xml
  78. 78. @uiterlix @sander_mak Felix iPojo
  79. 79. @uiterlix @sander_mak Felix iPojo
  80. 80. @uiterlix @sander_mak Felix iPojo
  81. 81. @uiterlix @sander_mak Felix iPojo
  82. 82. @uiterlix @sander_mak Felix iPojo
  83. 83. @uiterlix @sander_mak Felix iPojo
  84. 84. @uiterlix @sander_mak Felix iPojo
  85. 85. @uiterlix @sander_mak Felix iPojo
  86. 86. @uiterlix @sander_mak Felix iPojo
  87. 87. @uiterlix @sander_mak Felix iPojo
  88. 88. @uiterlix @sander_mak Felix iPojo Both ‚static’ configuration and configuration 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 !
  89. 89. Comparison: performance
  90. 90. @uiterlix @sander_mak 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.” (Knoplerfish tutorial)
  91. 91. @uiterlix @sander_mak Benchmark scenario ! ! Temperature sensors for each postal code in the Nederlands 463860 Sensor services ! Service properties: - Province - Municipality - City - PostalCode
  92. 92. @uiterlix @sander_mak Benchmarks Publishing Sensor services Felix, Equinox, Knoplerfish Plain OSGi, DM, iPojo ! Consuming Sensor services Whiteboard; all sensors in Amsterdam
 (&(province=Noord-Holland)(municipality=Amsterdam)) Felix, Equinox, Knoplerfish DS, DM, iPojo, Blueprint
  93. 93. @uiterlix @sander_mak 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
  94. 94. @uiterlix @sander_mak Register services (Equinox) ipojo DM OSGi Durationinms. 0 175000 350000 525000 700000 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 iPojo
  95. 95. @uiterlix @sander_mak 0 50000 100000 150000 200000 250000 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 iPojo Register services (Felix) iPojo DM OSGi
  96. 96. @uiterlix @sander_mak 0 50000 100000 150000 200000 250000 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 iPojo Register services (Knoplerfish) iPojo DM OSGi
  97. 97. @uiterlix @sander_mak 0 100000 200000 300000 400000 500000 600000 700000 10000 30000 50000 70000 90000 110000 130000 150000 170000 190000 210000 230000 250000 270000 290000 310000 330000 350000 370000 390000 410000 430000 450000 OSGi equinox DM equinox iPojo equinox OSGi felix DM felix iPojo felix OSGi knoplerfish DM knoplerfish iPojo knoplerfish Register services (combined) iPojo Equinox OSGi & DM Felix iPojo Felix & Knoplerfish OSGi & DM Equinox & Knoplerfish
  98. 98. @uiterlix @sander_mak Register services Observations Non linear results for registering services with Felix Registering services using iPojo takes considerably longer compared to plain OSGi and DM
  99. 99. @uiterlix @sander_mak Timeinmillis 0 400 800 1200 1600 blueprint dm ds ipojo Consuming services Injecting 19021 services into a single consumer on Equinox
  100. 100. @uiterlix @sander_mak Timeinmillis 0 400 800 1200 1600 blueprint dm ds ipojo injection injection and method invocation Method invocation overhead Injecting 19021 services into a single consumer on Equinox, and invoking a method on the injected services
  101. 101. @uiterlix @sander_mak iPojo and # of services Timeinmillis 0 15000 30000 45000 60000 # services in service registry 50 100 150 200 250 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 1050 1100 1150 1200 1250 1300 1350 1400 1450 1500 1550 1600 iPojo Injecting a single service into a single consumer on Equinox
  102. 102. @uiterlix @sander_mak Performance considerations Use of LDAP filters Filter complexity, service registry scans Felix DM provides optimization though indexing service properties ! ! Bundle starting order Service tracker obtain initial versus service listener events 0 75000 150000 225000 300000 197 2878 Default With index
  103. 103. Conclusion
  104. 104. @uiterlix @sander_mak Conclusion Features ranging from simple to advanced 
 (DS, Blueprint < DM < iPojo) Annotation/XML-only frameworks are easy to use but provide less dynamics Consider the expected size of your application (services, dependencies) and run some test before choosing one! You can mix & match … but don’t do that
  105. 105. @uiterlix @sander_mak Questions? http://bit.ly/dmshootoutCode: Sander Mak http://branchandbound.net @sander_mak http://blog.uiterlinden.nl @uiterlix Xander Uiterlinden

×