$30 off During Our Annual Pro Sale. View Details »

A comparative review of microservice frameworks

A comparative review of microservice frameworks

In this session we will compare some of the most popular Microservice frameworks in the Java ecosystem like SpringBoot, Quarkus, Eclipse MicroProfile, and more. We will give an overview and jumpstart for each framework. Next to this we will answer questions like:

Which features do provide all of them, what are their unique selling points?
How do I start writing microservices with the different frameworks?
Which technology stack do the different frameworks use?
How do they perform in regards to startup time, and responding with different response sizes?
How large are the resulting application containers in Docker?

Hendrik Ebbers

October 20, 2020
Tweet

More Decks by Hendrik Ebbers

Other Decks in Technology

Transcript

  1. View Slide

  2. A comparative review of microservice frameworks

    View Slide

  3. This is a very very very long gag
    @hendrikEbbers
    Hendrik
    • Karakun Co-Founder
    • Founder of JUG Dortmund
    • JSR EG member
    • JavaOne Rockstar, Java Champion
    • AdoptOpenJDK TSC member

    View Slide

  4. This is a very very very long gag
    @kthoms
    Karsten
    • Open Source Enthusiast
    • Committer on several Eclipse
    projects
    • Contributor on many more
    • Speaker

    View Slide

  5. This is a very very very long gag
    @hendrikEbbers @kthoms
    Content
    • About Microservices
    • Spring Boot, Quarkus, Micronaut, Eclipse Microprofile
    • Additional Frameworks
    • Docker support
    • Conclusion

    View Slide

  6. About Microservices

    View Slide

  7. This is a very very very long gag
    @hendrikEbbers @kthoms
    Microservices
    REST SQL
    Microservice

    View Slide

  8. This is a very very very long gag
    • Microservice architecture does not depend on Java
    • You can create Microservice in any language you want
    • We concentrate on Java today
    @hendrikEbbers @kthoms
    Microservices
    Ok, maybe not in COBOL

    View Slide

  9. This is a very very very long gag
    • Microservice architecture does not depend on Java
    • You can create Microservice in any language you want
    • We concentrate on Java today
    @hendrikEbbers @kthoms
    Microservices
    Ok, maybe not in COBOL
    Lesson 1 :
    do not underestimate
    the power of the
    Internet

    View Slide

  10. This is a very very very long gag
    @hendrikEbbers @kthoms
    Microservices
    • Easy to learn and start with
    • Stable API
    • Active community
    • Active maintainers
    • LTS versions

    View Slide

  11. This is a very very very long gag
    @hendrikEbbers @kthoms
    Microservices
    • Small memory footprint
    • Deployable as container
    • Fast to serve request
    • Start-up time
    • Stateless & scaleable

    View Slide

  12. This is a very very very long gag
    @hendrikEbbers @kthoms
    Microservices
    • REST endpoints
    • Messaging & events
    • Provide & store data
    • Call Functions (e.g. map-reduce)
    • Security (SSO)
    • JSON support

    View Slide

  13. View Slide

  14. View Slide

  15. "Crafted from best-of-breed libs and standards with
    GraalVM support from ground up"

    View Slide

  16. "Standard based framework backed by multiple
    vendors with much more flexibility than Jakarta EE"

    View Slide

  17. "Mature and leading microservices framework with
    maybe the biggest community and ecosystem"

    View Slide

  18. "Non-blocking, reactive framework for microservices
    and serverless functions with GraalVM support"

    View Slide

  19. This is a very very very long gag
    @hendrikEbbers @kthoms
    Initializer
    • Project Coordinates
    • Framework Version
    • Java Version
    • Build System
    • Extensions

    View Slide

  20. This is a very very very long gag
    @hendrikEbbers @kthoms
    Releases - Spring Boot
    2018 2019 2020
    2.3.X
    Preview Releases
    Releases
    2.2.X
    2.4.X
    2.1.X
    2.0.X
    1.5.X

    View Slide

  21. This is a very very very long gag
    @hendrikEbbers @kthoms
    Releases - Eclipse MicroProfile
    2018 2019 2020
    1.4
    Preview Releases
    Releases
    2.0
    2.1
    2.2
    3.0
    3.1
    3.2
    3.3
    4.0
    Switch to JavaEE 8
    Switch to Jakarta EE 8

    View Slide

  22. This is a very very very long gag
    @hendrikEbbers @kthoms
    Releases - Micronaut
    2018 2019 2020
    1.0.x
    1.1.x
    1.2.x
    1.3.x
    2.0.x
    Preview Releases
    Releases

    View Slide

  23. This is a very very very long gag
    @hendrikEbbers @kthoms
    Releases - Quarkus
    2018 2019 2020
    Preview Releases
    Releases
    1.0
    0.1 - 0.28
    1.1
    1.2
    1.3
    1.4
    1.5
    1.6
    1.7
    1.8

    View Slide

  24. This is a very very very long gag
    public class MovieResource {
    public Movie getMovie( Long id) {
    //...
    }
    }
    @hendrikEbbers @kthoms
    REST Endpoint
    Produce JSON by
    default

    View Slide

  25. This is a very very very long gag
    public class MovieResource {
    public Movie getMovie( Long id) {
    //...
    }
    }
    @hendrikEbbers @kthoms
    REST Endpoint
    @Path("/movies")
    @Produces(MediaType.APPLICATION_JSON)
    @GET
    @Path("/{id}")
    @PathParam("id")
    JAX-RS (quarkus &
    Microprofile)
    Karsten

    View Slide

  26. This is a very very very long gag
    public class MovieResource {
    public Movie getMovie( Long id) {
    //...
    }
    }
    @hendrikEbbers @kthoms
    REST Endpoint
    @RestController
    @GetMapping("/movies")
    @RequestParam("id")
    Spring

    View Slide

  27. This is a very very very long gag
    public class MovieResource {
    public
    }
    }
    @Controller("/movies")
    @Get("/{id}")
    Single> getMovie (
    @PathVariable Long id) { //...
    @hendrikEbbers @kthoms
    REST Endpoint
    Micronaut
    RxJava 2

    View Slide

  28. This is a very very very long gag
    @hendrikEbbers @kthoms
    DB Access
    @ApplicationScoped
    public class MovieRepository implements PanacheRepository {
    public MovieEntity findByName(String name) {
    return find("name", name).firstResult();
    }
    }
    Quarkus
    Repository Pattern

    View Slide

  29. This is a very very very long gag
    @hendrikEbbers @kthoms
    DB Access
    @Repository
    public interface MovieRepository extends CrudRepository {
    Optional findOptionalByName(String name);
    }
    Spring

    View Slide

  30. This is a very very very long gag
    @hendrikEbbers @kthoms
    DB Access
    @JdbcRepository(dialect = Dialect.H2)
    public interface MovieRepository extends CrudRepository {
    Optional findByName(String name);
    }
    Micronaut

    View Slide

  31. This is a very very very long gag
    @hendrikEbbers @kthoms
    DB Access
    @ApplicationScoped
    public class MovieRepository {
    @Inject
    EntityManager manager;
    public Optional findByName(String name) {
    return manager.createNamedQuery("MovieEntity.byName", MovieEntity.class)
    .setParameter("name", name)
    .getResultList()
    .findAny();
    }
    }
    Microprofile

    View Slide

  32. This is a very very very long gag
    @hendrikEbbers @kthoms
    Additional Frameworks
    • Vert.x
    • Dropwizard
    • Spark
    • Helidon
    • Apache CXF
    • Jersey
    • RESTEasy
    • ...
    There is no concrete definition
    what a microservice must contain...
    It do not even need to
    contain HTTP - Think about
    an event based system

    View Slide

  33. Docker Container

    View Slide

  34. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    FROM adoptopenjdk/openjdk11:jdk-11.0.8_10-ubuntu-slim
    COPY target/demo-*.jar demo.jar
    EXPOSE 8080
    CMD ["java","-jar", "demo.jar"]
    Linux
    JVM
    Application
    Ubuntu + JVM as Base
    Our application
    Run !

    View Slide

  35. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    $ docker build . -t my-image
    $ docker run -p 8080:8080 my-image
    Linux
    JVM
    Application
    Build the Image with
    the actual JAR
    Start the container

    View Slide

  36. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    CREATED COMMAND SIZE
    2 minutes ago /bin/sh -c #(nop) ENTRYPOINT ["java" "-jar"… 0B
    2 minutes ago /bin/sh -c #(nop) COPY file:4e18e9cc0f417bc6… 16.5MB
    11 minutes ago /bin/sh -c #(nop) WORKDIR /opt/app 0B
    11 minutes ago /bin/sh -c #(nop) ARG JAR_FILE=target/demo-… 0B
    4 days ago /bin/sh -c #(nop) CMD ["jshell"] 0B
    4 days ago /bin/sh -c #(nop) ENV JAVA_HOME=/opt/java/o… 0B
    4 days ago /bin/sh -c set -eux; ARCH="$(dpkg --prin… 254MB
    4 days ago /bin/sh -c #(nop) COPY multi:18d710993714a6c… 16.7kB
    4 days ago /bin/sh -c #(nop) ENV JAVA_VERSION=jdk-11.0… 0B
    4 days ago /bin/sh -c apt-get update && apt-get ins… 35.7MB
    4 days ago /bin/sh -c #(nop) ENV LANG=en_US.UTF-8 LANG… 0B
    5 days ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
    5 days ago /bin/sh -c mkdir -p /run/systemd && echo 'do… 7B
    5 days ago /bin/sh -c [ -z "$(apt-get indextargets)" ] 0B
    5 days ago /bin/sh -c set -xe && echo '#!/bin/sh' > /… 745B
    5 days ago /bin/sh -c #(nop) ADD file:84f8ddc4d76e1e867… 63.2MB

    View Slide

  37. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    CREATED COMMAND SIZE
    2 minutes ago /bin/sh -c #(nop) ENTRYPOINT ["java" "-jar"… 0B
    2 minutes ago /bin/sh -c #(nop) COPY file:4e18e9cc0f417bc6… 16.5MB
    11 minutes ago /bin/sh -c #(nop) WORKDIR /opt/app 0B
    11 minutes ago /bin/sh -c #(nop) ARG JAR_FILE=target/demo-… 0B
    4 days ago /bin/sh -c #(nop) CMD ["jshell"] 0B
    4 days ago /bin/sh -c #(nop) ENV JAVA_HOME=/opt/java/o… 0B
    4 days ago /bin/sh -c set -eux; ARCH="$(dpkg --prin… 254MB
    4 days ago /bin/sh -c #(nop) COPY multi:18d710993714a6c… 16.7kB
    4 days ago /bin/sh -c #(nop) ENV JAVA_VERSION=jdk-11.0… 0B
    4 days ago /bin/sh -c apt-get update && apt-get ins… 35.7MB
    4 days ago /bin/sh -c #(nop) ENV LANG=en_US.UTF-8 LANG… 0B
    5 days ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
    5 days ago /bin/sh -c mkdir -p /run/systemd && echo 'do… 7B
    5 days ago /bin/sh -c [ -z "$(apt-get indextargets)" ] 0B
    5 days ago /bin/sh -c set -xe && echo '#!/bin/sh' > /… 745B
    5 days ago /bin/sh -c #(nop) ADD file:84f8ddc4d76e1e867… 63.2MB

    View Slide

  38. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    CREATED COMMAND SIZE
    2 minutes ago Microservice & Framework 16.5MB
    4 days ago JDK 11 254MB
    4 days ago Some Linux updates & tools 35.7MB
    5 days ago Linux basic layer 63.2MB

    View Slide

  39. This is a very very very long gag
    CREATED COMMAND SIZE
    2 minutes ago Microservice & Framework 16.5MB
    4 days ago JDK 11 254MB
    4 days ago Some Linux updates & tools 35.7MB
    5 days ago Linux basic layer 63.2MB
    @hendrikEbbers @kthoms
    Docker Container

    View Slide

  40. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    Application
    (13 MB)
    Linux (100 MB)
    JVM (250 MB)
    Application
    (16 MB)
    Application
    (10 MB)

    View Slide

  41. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container - GraalVM
    • Micronaut and Quarkus offer GraalVM
    support OOTB
    • By using GraalVM the app can be compiled
    to a native executable
    • While the compilation takes much longer
    the outcome is much smaller

    View Slide

  42. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container - GraalVM
    Linux
    (100 MB)
    Native application
    (30 MB)
    No JDK since we
    compiled the app
    0.3 s
    108 s
    Compile
    Start

    View Slide

  43. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container - MicroProfile
    • Eclipse MicroProfile is special since it
    needs an application server
    • Application server is an additional layer
    between JVM and application
    • Application layer is much smaller
    App Server
    (230 MB)
    JDK
    (250 MB)
    Linux
    (100 MB)
    Application
    (10 KB)

    View Slide

  44. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    $ docker run
    16.2 s
    8.6 s
    3.8 s
    2.3 s
    ( )
    2.0 s
    1.9 s
    0.3 s

    View Slide

  45. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Build Times
    $ docker build
    108 s
    35.7 s
    15.4 s
    10.3 s
    8.5 s
    8.0 s
    6.3 s
    ( )

    View Slide

  46. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container - jlink
    • jlink enables to create JVMs
    tailored to a specific application
    • This allows to create much smaller
    images as base for applications
    Application
    (47 MB)
    jlink based JVM
    (55 MB)
    Alpine Linux
    (10 MB)

    View Slide

  47. This is a very very very long gag
    @hendrikEbbers @kthoms
    Docker Container
    • You need to decide what is most important for you:
    • images size
    • image layer size
    • build time
    • start time
    • [memory footprint]

    View Slide

  48. Advanced features of
    Microservices

    View Slide

  49. This is a very very very long gag
    @hendrikEbbers @kthoms
    Advanced Features
    • Tracing & monitoring
    • Configuration & cloud configuration
    • Service discovery
    • Support for serverless functions
    • Reactive APIs
    • Authentication strategies

    View Slide

  50. Conclusion

    View Slide

  51. View Slide

  52. This is a very very very long gag
    @hendrikEbbers @kthoms
    Comparison (1/3)
    SpringBoot MicroProfile Micronaut Quarkus
    License Apache 2 Apache 2 Apache 2 Apache 2
    Owner Pivotal Eclipse Foundation Object Computing Red Hat
    Since 2013 2016 2018 2018
    Release Cadence (Months) 1 4 1 1
    Maintenance Releases
    Committers ++ + +
    .

    View Slide

  53. This is a very very very long gag
    @hendrikEbbers @kthoms
    Comparison (2/3)
    SpringBoot MicroProfile Micronaut Quarkus
    REST API Spring-Web JAX-RS Own JAX-RS
    SQL API Pivotal Eclipse Foundation Object Computing Red Hat
    Dependency Injection Spring-Beans CDI
    Micronaut IoC
    + JSR 330
    CDI 2.0*
    Security API Spring-Security Jakarta EE Security
    Micronaut Security
    + JSR 250
    Open ID
    HTTP Infrastructure Tomcat various Netty Vert.x / Netty
    Java Version 8, 11 - 15 8, (11) 8 - 14 8, 11 - 14

    View Slide

  54. This is a very very very long gag
    @hendrikEbbers @kthoms
    Comparison (3/3)
    SpringBoot MicroProfile Micronaut Quarkus
    Container Support
    Graal VM
    Image Size
    Application Layer Size
    Startup Time
    Build Time
    +
    -
    . . .
    . . .
    +
    +
    JVM:
    . . -
    GraalVM:
    + + - + +
    + -
    - + + - - - -
    +
    .
    JVM: GraalVM:
    +

    View Slide

  55. View Slide