java ee, microservices, apis and migration to the...

31
Java EE, Microservices, APIs and Migration to the Cloud Prof. dr. Matjaž B. Jurič Java Champion, IBM Champion, Oracle ACE Director

Upload: others

Post on 20-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Java EE, Microservices, APIs and Migration to the Cloud Prof. dr. Matjaž B. Jurič Java Champion, IBM Champion, Oracle ACE Director

Page 2: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

2

Microservices

Page 3: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

3

Microservice Architecture

An architectural approach, that emphasizes the

decomposition of applications into single-purpose,

loosely coupled services managed by cross-functional

teams, for delivering and maintaining complex software

systems with the velocity and quality required by today’s

digital business

Page 4: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Traditional multi-tier architecture

Web front-end (such as HTML5/JS/AngularJS or React)

Product Catalog Shopping Cart

Purchase Payment

Delivery

DBMS

Page 5: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

5

Traditional Java multi-tier architecture

Java EE applications packaged as WAR/EAR

Deployed on the application server

Monolithic approach

Problems:

Scaling

Updates require redeployment

To upgrade Java SE/EE or app server to a newer version requires

that all applications on the app server are upgraded at once.

Page 6: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Microservice Approach

Web front-end (such as HTML5/JS/AngularJS or React)

Product Catalog Shopping Cart

Purchase Payment

Delivery

DBMS

Page 7: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

7

Advantages

Flexible architecture, easier development

Enables and fosters service reuse

Reuse of services, not source-code

Each microservice can be developed independently

Independent life-cycle

Easier upgrades

Only specific microservice needs to be upgraded, not the whole

application

Easier upgrades on new technologies/versions

More efficient scaling

Page 8: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

8

Microservice Principles

Single Responsibility

Do one thing (but do it well).

Explicitly published interfaces

Integrated in a loosely-coupled way

Synchronous or asynchronous?

Circuit-breaker

Designed for failure

Fault tolerance is a requirement, not a feature

Page 9: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

9

Deployment, Execution, Versioning, Scaling

Each microservices is deployed separately

Each microservices executes in its own process / virtual

machine / container

Each microservices can have multiple versions deployed

All versions executing side-by-side.

Microservices are scaled horizontally and independently.

Page 10: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Microservices

Applications Modularity (development-time)

Service orientation Microservices

Page 11: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

11

Disadvantages

Deployment becomes more complex

Many „small“ microservices, dependencies, etc.

Automation is mandatory

DevOps – Continuous Integration, Continuous Deployment,

Automated Testing

Testing, logging, monitoring require new tools with support

for microservices

In Java EE – problem of fat application server

Page 12: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

12

Java EE Approach to Microservices

Serverless Java EE

Package and deploy Java EE application into „fat“ JARs

Execute them on Java SE runtime

No need for Java EE application server

KumuluzEE

Microservice framework for Java EE standard API-s

Spring Boot

Microservice framework for Spring

Page 13: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

13

Java EE Approach to Microservices

„Slim“ app server

App server is reduced to those technologies that your microservice

uses

WildFly Swarm

Payara Micro

Page 14: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

14

Microprofile.io

MicroProfile is a baseline platform definition that optimizes

Enterprise Java for a microservices architecture

It delivers application portability across multiple

MicroProfile runtimes

The initially planned baseline is JAX-RS + CDI + JSON-P

Page 15: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

KumuluzEE- https://ee.kumuluz.com/

Page 16: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

16

KumuluzEE (open source)

Produces standalone microservices following the Twelve-

Factor principles

Microservices packaged as self-contained JARs

JAR includes the run-time for selected technologies

No application server required

Very efficient in terms of size and startup/shutdown time

Small footprint JARs

Ideal for Docker containers and other PaaS environments

Run-time can be freely selected

Servlet – Jetty, Tomcat, Grizzly, Undertow, etc.

Page 17: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

17

DEMO

Page 18: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

18

Where to deploy microservices

All microservices in a single VM (virtual machine)?

Each microservice in its own VM?

Each microservice on several VMs?

Use Docker containers instead of traditional VMs

Page 19: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

19

Traditional VMs vs Docker

Traditional VMs Docker Containers

Page 20: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

20

Comparison

Traditional

VM Docker Δ

Start-up 50 s 100 ms 500x

Shut-down 5 s 50 ms 100x

Page 21: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

21

Docker and the Cloud

Docker containers are supported by the majority of Cloud

providers

Public and private clouds

Docker also supported on Windows Server 2016

Use Docker containers with container orchestration tools

Kubernetes

Docker Swarm, Mesos, etc.

Page 22: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

22

Bottom-line

Microservices +

+ Docker containers =

= Perfect Fit

Page 23: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

23

API

Application Programming Interfaces

Page 24: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Web front-end (such as HTML5/JS/AngularJS or React)

Product Catalog Shopping Cart

Purchase Payment

Delivery

DBMS

API API

API API

API

Page 25: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Web front-end (such as HTML5/JS/AngularJS or React)

API Gateway API Management Service/API Discovery

Product Catalog Shopping Cart

Purchase Payment

Delivery

API API

API API

API

Page 26: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

26

APIs

Page 27: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

27

Bottom-line

Microservices +

+ Docker containers +

APIs

= Architecture for the Cloud

Page 28: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that
Page 29: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

29

Useful resources

KumuluzEE - http://ee.kumuluz.com/

Java Magazine - http://www.javamagazine.mozaicreader.com/JanFeb2016#&pageSet=

80&page=0&contentItem=0

Microprofile.io - http://microprofile.io/

E-mail: [email protected]

Page 31: Java EE, Microservices, APIs and Migration to the Cloud2016.changecon.com/wp-content/uploads/2016/10/Matjaz_B_Juric.pdf · 3 Microservice Architecture An architectural approach, that

Thank you!