Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microservices with Micronaut - practical approach

Microservices with Micronaut - practical approach

1. Micronaut: A New Hope
2. Reflection-based approach to DI/AOP
3. Micronaut compile-time approach to DI/AOP
4. Sample Project: LAB Insurance Sales Portal
5. Accessing Relational Database with JPA
6. Mock Database for Testing
7. Accessing MongoDB
8. Exposing REST Exposing - simple way
9. Talking to Other Services Using Kafka
10. Talking to Other Services with HttpClient
11. Service Discovery with Consul
12. Client-Side Load Balancing with Ribbon
13. Securing Services with JWT
14. Running Scheduled Tasks
15. Tracing with Zipkin
16. Management and Monitoring
17. Deployment

Robert Witkowski

November 09, 2018
Tweet

More Decks by Robert Witkowski

Other Decks in Programming

Transcript

  1. Wojciech Suwała, Head Architect, ASC LAB Robert Kuśmierek, Lead Software

    Engineer, ASC LAB Robert Witkowski, Senior Software Engineer, ASC LAB Microservices with Micronaut - practical approach
  2. Micronaut: A New Hope • lightweight and reactive • producing

    small and fast executables • supports Java, Kotlin, Groovy development • supports Maven/Gradle as build tools • designed with microservices and cloud computing in mind with a lot of cloud-native features like: – service discovery, – distributed tracing and logging, – asynchronous communication using Kafka, – retriable HTTP clients, – circuit breakers, – scalability and load balancing
  3. Reflection-based approach to DI/AOP • no common reflection cache in

    Java, each library/framework produces a unique reflection cache. This makes it extremely difficult to optimize memory consumption • reflective calls are much more difficult for the JIT to optimize • traditional AOP is the heavy reliance on runtime proxy creation which slows app performance, makes debugging harder and increases memory consumption
  4. Micronaut compile-time approach to DI/AOP • uses Ahead of Time

    (AOT) compilation via annotation processors or AST transforms for Groovy • improves startup performance • reduces memory consumption • reducing proxies and stack trace sizes • improving debugging
  5. 8 Accessing Relational Database with JPA pom.xml application.yml * REMARK:

    in newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  6. 11 Accessing MongoDB pom.xml application.yml * REMARK: in newest version

    all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  7. 16 Talking to Other Services Using Kafka pom.xml application.yml *

    REMARK: in newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  8. 20 Service Discovery with Consul pom.xml application.yml * REMARK: in

    newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  9. 21 Client-Side Load Balancing with Ribbon pom.xml application.yml * REMARK:

    in newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  10. 22 Securing Services with JWT pom.xml application.yml * REMARK: in

    newest version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  11. 24 Tracing with Zipkin pom.xml application.yml * REMARK: in newest

    version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  12. 25 Management and Monitoring pom.xml application.yml * REMARK: in newest

    version all artifacts from io.micronaut* started from “micronaut-” Example: <artifactId>micronaut-jdbc-hikari</artifactId>
  13. Deployment • docker-compose – localhost only – consul-based service- discovery

    • kubernetes – local & cloud – dns-based service- discovery