microservices and osgi
play

Microservices and OSGi running with Apache Karaf Agenda No free - PowerPoint PPT Presentation

Microservices and OSGi running with Apache Karaf Agenda No free Lunch - microservices microservices or Service? Free Lunch? - OSGi Services Services in the Apache Karaf ecosystem Showcase: https:/


  1. Microservices and OSGi running with Apache Karaf

  2. Agenda • No free Lunch - microservices • microservices or µService? • Free Lunch? - OSGi µServices • µServices in the Apache Karaf ecosystem Showcase: • https:/ /github.com/ANierbeck/Karaf-Microservices-Tooling • https:/ /github.com/ANierbeck/Karaf-Microservices 2

  3. @anierbeck Senior IT-Consultant @codecentric Apache Karaf PMC Apache Member OPS4j Pax Web Project lead Co-Author Apache Karaf Cookbook 3

  4. No Free Lunch - with micro services_ 4

  5. No Free Lunch - with micro services_ Operations overhead Instead of one Application (cluster) micro applications that need to be clustered / Orchestrated / Operated 01

  6. No Free Lunch - with micro services_ DevOps Skills Required old school: One AppServer one application now: applications that might run on different infrastructure Instead of bigger boats, more boats are needed 01

  7. No Free Lunch - with micro services_ Implicit Interfaces Changes in: • syntax • semantics 01

  8. No Free Lunch - with micro services_ Distributed System Complexity network latency fault tolerance message serialization distributed transactions 01

  9. No Free Lunch - with micro services_ A/Synchronicity 
 is Difficult! communication is much more asynchronous it gets complex when you need to correlate messages or distributed transactions 01

  10. No Free Lunch - with micro services_ Testability Challenges testing a single service is easy monitoring the dynamic environment is hard —> less testing, more monitoring 01

  11. µService - comparison of two definition_ 11

  12. “What I am promoting is the idea of µServices, the concepts of an OSGi service as a design primitive.” —Peter Kriens, March 2010 http:/ /blog.osgi.org/2010/03/services.html 12

  13. “In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare mininum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.” –Martin Fowler, March 2014 13

  14. in detail_ • One main reason for using services as components (rather than libraries) is that services are independently deployable 
 OSGi Bundle • you can expect many single service changes to only require that service to be redeployed 
 OSGi Service / Bundle • cohesive service boundaries and evolution mechanisms in the service contracts 
 OSGi Versioning • Often it's only documentation and discipline that prevents clients breaking a component's encapsulation, leading to overly-tight coupling between components. 
 OSGi Container enforces this 14

  15. Free Lunch? OSGi µServices_ 15

  16. Free Lunch? OSGi µServices_ Operations Overhead OSGi Bundles - containing services One container vessel One Server to know 01

  17. Apache_ 17

  18. Apache Karaf_ µServices µServices µServices µServices JAX-RS JNDI JMS JDBC OBR JPA JTA Cellar Standard JMX WAR Http Instance KAR Blueprint Features Deployer Core JAAS Config Console Logging OSGi Framework 18

  19. Free Lunch? OSGi µServices_ DevOps Skills Required requirements are reduced! - Karaf - Ops - OSGi - Devs 01

  20. Free Lunch? OSGi µServices_ Implicit Interfaces semantic versioning OSGi supports multiple versions multiple service implementations tools help 01

  21. Semantic Versioning_ 1. major Packages with versions that have di ff erent major parts are not compatible both for providers as well as consumers. For example, 1.2 and 2.3 are completely incompatible. 2. minor API consumers are compatible with exporters that have the same major number and an equal or higher minor version. API providers are compatible with exporters that have the same major and minor version number. For example, 1.2 is backward compatible with 1.1 for consumers but for providers it is incompatible. Consumers should therefore import [1.2,2) and providers should import [1.2,1.3). 3. micro A di ff erence in the micro part does not signal any backward compatibility issues. The micro number is used to fix bugs that do not a ff ect either consumers or providers of the API. 4. qualifier The qualifier is usually used to indicate a build identity, for example a time stamp. Di ff erent qualifiers do not signal any backward compatibility issues. 21

  22. Semantic Versioning - Tools_ maven-bundle-plugin 22

  23. Semantic Versioning - Tools_ Release - Baselining Fix version 1.0.0 Baseline new version with 1.0.0 version 01

  24. Semantic Versioning - Baselining_ Baselining • Comparing bundle service-api version 1.0.0-SNAPSHOT to version 1.0.0-SNAPSHOT 
 PACKAGE_NAME DELTA CUR_VER BASE_VER REC_VER WARNINGS 
 = ================================================== ========== ========== ========== ========== ========== 
 de.nierbeck.microservices.karaf.calculator unchanged 1.0.0 1.0.0 1.0.0 - 
 ----------------------------------------------------------------------------------------------------------- 
 de.nierbeck.microservices.karaf.calculator.values unchanged 1.0.0 1.0.0 1.0.0 - 
 ----------------------------------------------------------------------------------------------------------- 
 Baseline analysis complete, 0 error(s), 0 warning(s) 24

  25. Free Lunch? OSGi µServices_ Distributed System Complexity complexity reduced -> one container no network traffic service calls -> method calls from services found in service registry. Clustering: Apache Karaf Cellar Remote: DOSGi —> CXF, Cellar 01

  26. Free Lunch? OSGi µServices_ A/Synchronicity 
 is Difficult! in JVM communication service calls - transparent call stateless services event communication Out-Of-The-Box 01

  27. Free Lunch? OSGi µServices_ Testability Challenges POJO tests for business logic Pax EXAM - Integration tests of OSGi services. Shift Focus: More Testing, less monitoring 01

  28. Service tests - Pax EXAM - Continous Integration_ 28

  29. µServices in the Apache Karaf ecosystem_ 29

  30. µServices in the Apache Karaf ecosystem_ microservices made of µServices … 30

  31. µServices in the Apache Karaf ecosystem_ Apache Karaf Cellar Hazelcast based cluster Groups and Nodes Services across Clusters Failover Load balanced 01

  32. µServices in the Apache Karaf ecosystem_ Apache Karaf Cave OSGi Repository Bundle Requirements Capabilities 01

  33. µServices in the Apache Karaf ecosystem_ Apache Karaf Decanter Monitor Elasticsearch Kibana 01

  34. Continous Delivery with Apache Karaf_ 34

  35. Continous Deployment_ 35

  36. Continous Deployment_ • deployment via REST • Jolokia - REST • JMX Management • Maven Plugin { "type":"EXEC", "mbean":"org.apache.karaf:type=bundle,name=root", "operation":"install(java.lang.String,boolean)", "arguments":["mvn:${project.groupId}/${project.artifactId}/${project.version}", true] } 36

  37. µServices - sum of all services_ 37

  38. µServices - sum of all services_ Should I do microservices YES! Monolithic blocks are bad Use: - Low Coupling - High Cohesion 01

  39. µServices - sum of all services_ The Silver Bullet? NO! OSGi isn’t the silver Bullet A lot of issues which exist with µ-Services are already solved in the OSGi - Eco system 01

  40. µServices - sum of all services_ Blueprint? YES! Use it as blueprint for transition to microservices OSGi - µServices will help in breaking up the Monolith 01

  41. µServices - sum of all services_ microservice based on µServices instead of building micro-monolith base on OSGi services. 01

  42. Questions ?

  43. END_ Links: • images found at flickr - thanks to that • No Free Lunch with Microservices 
 http:/ /highscalability.com/blog/2014/4/8/microservices-not-a- free-lunch.html • http:/ /karaf.apache.org/ • http:/ /blog.osgi.org/2010/03/services.html Showcase: • https:/ /github.com/ANierbeck/Karaf-Microservices-Tooling • https:/ /github.com/ANierbeck/Karaf-Microservices 43

  44. 44

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend