Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Nanoservices and Microservices with Java

11,430 views

Published on

Nanoservices are smaller than Microservices. This presentation shows how technologies like Amazon Lambda, OSGi and Java EE can be used to enable such small services.

Published in: Technology
  • Hi All, We are planning to start new devops online batch on this week... If any one interested to attend the demo please register in our website... For this batch we are also provide everyday recorded sessions with Materials. For more information feel free to contact us : siva@keylabstraining.com. For Course Content and Recorded Demo Click Here : http://www.keylabstraining.com/devops-online-training-tutorial
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Nanoservices and Microservices with Java

  1. 1. Microservices & Nanoservices with Java Eberhard Wolff Fellow, innoQ @ewolff
  2. 2. http://microservices-buch.de/ http://microservices-book.com/
  3. 3. http://microservices-book.com/primer.html FREE!!!!
  4. 4. Microservice Definition
  5. 5. Server Server Microservices: Definition > Independent deployment units > Separate VM / process > Any technology > Any infrastructure Micro Service Micro Service
  6. 6. Microservices= Independent Deployment Units
  7. 7. Components Collaborate Micro Service Micro Service Link Data Replication REST Messaging
  8. 8. Online Shop Order Catalog Search Billing Customer HTML / HTTP
  9. 9. Online Shop Elasticsearch Spring Batch Oracle Spring MVC MongoDB Order Catalog Search Billing
  10. 10. Microservices Stack
  11. 11. Docker > Linux (soon Windows) > Shared kernel > Filesystem just stores diffs > Extremely light weight > Can run in cluster (e.g. Kubernetes, Mesosphere etc)
  12. 12. Spring Boot > One build file > One Java class > = REST service + embedded Tomcat > Deploy: One Java Fat JARs > Alternatives: Dropwizard, Wildfly Swarm… > https://github.com/ewolff/spring-boot-demos
  13. 13. Microservice = Fat JAR + Java EE programming model possible!
  14. 14. Ideal size of a Microservice Team size Modularization Infrastructure Distributed Communication No absolute value! Replaceability Microservice Size
  15. 15. Nanoservices
  16. 16. Nanoservices?
  17. 17. Nanoservices? #SRSLY?
  18. 18. #SRSLY? YES!
  19. 19. Nanoservices!= Microservices
  20. 20. Nanoservices< Microservices
  21. 21. Ideal size of a Microservice Team size Modularization Infrastructure Distributed Communication No absolute value! Replaceability Microservice Size
  22. 22. Microservices= Independent Deployment Units
  23. 23. Nanoservices= Independent Deployment Units
  24. 24. Nanoservices use more light weight technologies
  25. 25. Amazon Lambda
  26. 26. Amazon Lambda > Service in the Amazon Cloud > Allows you to install individual functions > Java, JavaScript, Python
  27. 27. Lambda Function Command Line S3 Event Kinesis Stream DynamoDB SNS: Simple Notification Service SES: Simple EMail Service Cognito CloudWatch CloudFormation API Gateway (e.g. REST) Scheduled Events
  28. 28. Amazon Lambda adds e.g. trigger to DynamoDB.
  29. 29. Amazon Lambda + API Gateway = REST services.
  30. 30. public class Main { public String myHandler(int myCount, Context context) { LambdaLogger logger = context.getLogger(); logger.log("received : " + myCount); return "Hi"+myCount; } }
  31. 31. Deploy
  32. 32. Deploy
  33. 33. Invoke
  34. 34. Amazon Lambda vs. PaaS > Commercial model: Pay-per-call > Fine grained (e.g. database trigger, HTTP GET) > First million requests FREE! > Can edit Python / JavaScript function in the browser
  35. 35. Amazon Lambda > Can add any other Amazon Service to complete the system > i.e. Beanstalk PaaS, EC2 IaaS … > Or databased (DynamoDB, RDS...)
  36. 36. OSGi
  37. 37. OSGi: Bundles > Partition system into – "bundles” > Bundles can be installed, started, stopped, uninstalled and updated > ...at runtime
  38. 38. OSGi: Code Sharing > Bundles can export and import packages > Updating code requires other bundles to start fresh
  39. 39. OSGi: Services > Bundles can publish services… dynamically! > Service = Java Object > Service Registry allows other bundles to consume services > Services come and go at runtime > Quite easy with OSGi Blueprints or OSGi Declarative Services
  40. 40. Calling Bundle Bundle (interface code) Bundle (implementation and service) Service Package (interface code) Package (interface code) Update to service in running application
  41. 41. (Almost) Independent Deployment Units
  42. 42. Java EE
  43. 43. Java EE > JARs e.g. for EJBs > WARs e.g. for web application > EARs for JARs and WARs > Completely separated code > …unlike OSGi
  44. 44. Java EE > Relevant: Deployment model > i.e. application server > Not programming model
  45. 45. Java EE Nanoservices? > Local calls not possible > No shared code e.g. for interfaces
  46. 46. Tomcat Java EE Server order.war customer.war catalog.warCustomer
  47. 47. (Almost) Independent Deployment Units
  48. 48. Comparison
  49. 49. Independent Deployment > THE feature of Micro-/Nanoservices > Simplifies to put new features in production > Docker Fat JAR: ++ > Amazon Lambda: ++ > OSGi: + Restart the whole JVM? > Java EE: + Restart the whole JVM?
  50. 50. Benefits of Nanoservices
  51. 51. Effort per Service > How hard is it to create another service? > All: Create another project/JAR/WAR > Amazon Lambda: ++ > OSGi: ++ > Java EE: ++ > Docker Fat JAR : - (Docker container etc)
  52. 52. Cost per Service > Hardware, software cost > Amazon Lambda: ++ > OSGi: ++ > Java EE: ++ > Docker Fat JAR: -- (need Docker container etc, separat JVM Heap)
  53. 53. Local Communcation > Call without network stack > Docker Fat JAR : -- > Amazon Lambda: -- > OSGi: ++ > Java EE: --
  54. 54. Challenges of Nanoservices
  55. 55. Independent Scaling > Start more instances of a single service > Docker Fat JAR: ++ > Amazon Lambda: ++ > OSGi: ? > Java EE: --
  56. 56. Isolation > CPU / Memory consumption/crash influences other services > Docker Fat JAR: ++ > Amazon Lambda: ++ > OSGi: -- > Java EE: --
  57. 57. Resilience & Isolation > Resilience: System can handle crash of other services > Needs isolation > Problem for OSGi/Java EE
  58. 58. Technology Freedom > Using different technologies > Docker Fat JAR: ++ (whatever) > Amazon Lambda: + (Java, JavaScript, Python) > OSGi: -- (Java) > Java EE: -- (Java)
  59. 59. Conclusion
  60. 60. Nanoservices!= Microservices
  61. 61. Nanoservices< Microservices
  62. 62. Conclusion > Nanoservice technologies compromise > …to allow smaller services > …to allow local communication > OSGi and Java EE deployment model don’t fully support independent deployment > …might therefore not be “true” Nanoservices
  63. 63. Conclusion > OSGi and Java EE weak concerning > Independent scaling > Isolation > Technology freedom > Amazon Lambda a lot stronger
  64. 64. Might also consider… > Vert.x: polyglot, distributed and module concept > Erlang: support update to running system and processes in other languages
  65. 65. Thank You! @ewolff http://microservices-buch.de/ http://microservices-book.com/primer.html http://aws.amazon.com/lambda/getting-started/

×