javantura v4 - cloud-native architectures and java - matjaž b. jurič

24
Prof. dr. Matjaž B. Jurič, UL FRI and Kumuluz Project Cloud-native Architectures and Java

Category:

Technology


0 download

TRANSCRIPT

Page 1: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Prof. dr. Matjaž B. Jurič, UL FRI and Kumuluz Project

Cloud-native Architectures and Java

Page 2: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Software is How Companies Differentiate Themselves

More and more major businesses and industries are being run on software and delivered as online services.

Many of the winners are Silicon Valley-style entrepreneurial technology companies that are invading and overturning established industry structures.

Page 3: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Digital Business

Digitalization (digital transformation) is about delivering business innovation through software.

Page 4: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Software is becoming the KEY differentiator

„In the past 90% of the car value was in hardware. We expect 50% of value will be in hardware and the other 50% in software.“

Page 5: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Gartner Forecast

75% By 2020, 75 percent of application purchases supporting digital business will be build, not buy.

Forecast Analysis: Enterprise Application Software, Worldwide, 2Q15 Update.

Page 6: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

The Challenge

How to build software

Faster

Resilient

Scalable

Engaging

Page 7: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Cloud Native Architecture

Page 8: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Cloud Native Architecture

Cloud native architecture is about how software is build,

not where it runs

Page 9: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Microservices

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 10: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Microservice Principles

Single Responsibility

• Do one thing (but do it well).

Explicitly published interfaces

Integrated in a loosely-coupled way

• Synchronous or asynchronous?

• Circuit-breakers

Designed for failure

• Fault tolerance is a requirement, not a feature

Page 11: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Deployment, Execution, Versioning, Scaling

Each microservice is deployed separately

Each microservice executes in its own process / virtual machine / container

Each microservice can have multiple versions deployed

• All versions executing side-by-side.

Microservices are scaled horizontally and independently.

Page 12: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Microservice Frameworks for Java

SpringBoot / SpringCloud

WildFly Swarm

KumuluzEE

Dropwizard

Payara Micro

Microprofile.io

Page 13: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Containers

Helpful to microservices

• But not a requirement

Containers are lightweight

• Just like microservices themselves

Higher density

Easy to start/stop

Portability

Run ONE instance per container

Expose ONE port per container

Isn’t a Container Just Like a VM Image? NO

Hardware

Operating System

Container 1

App

Container 2

App

Containers

Page 14: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Artifacts Are Now Immutable Containers

Not EARs, WARs – Containers!

No more installing a JVM, app server, deploying the artifacts to them

Build the container once, deploy it anywhere. Can include complex environment variables, scripts, etc.

Containers should be free of state and configuration

Containers should not assume they are able to write to a persistent local file system

Page 15: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Declaratively Build Containers Using Dockerfiles

FROM centos:centos6

# Enable Extra Packages for Enterprise Linux (EPEL) for CentOS

RUN yum install -y epel-release

# Install Node.js and npm

RUN yum install -y nodejs npm

# Install app dependencies

COPY package.json /src/package.json

RUN cd /src; npm install

# Bundle app source

COPY . /src

EXPOSE 8080

CMD ["node", "/src/index.js"]

Page 16: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Building Blocks

Service Discovery

Microservice

Microservice

Microservice

Microservice

Microservice

Client

Client

Client

Client

Queue AMQP

Microservice

Microservice

Microservice

API Gateway

API Gateway

Configuration Server

Identity and Access

Management

Logging

Page 17: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

APIs

All data exchange between microservices must be through API layer

• No accessing datastores across microservices

Synchronous

Asynchrnous

Streaming

Event-driven

REST

Messaging

Page 18: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

APIs

Adopt advanced REST concepts

• Versioning, Links, Paging, Querying, Filtering, Ordering, Etc

API specification

• OpenAPI / Swagger

• JSON Schema

Stateless

Api Management

Page 19: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

API Gateway

Builds a JSON response for each type of client – web, mobile, etc.

Asynchronously calls each of the N microservices required to build a response

Handles security and hides back-end

Load balances

Meters APIs

• Rate-limiting

Logs centrally

Etc.

Page 20: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Circuit-Breakers

Circuit breakers prevent cascading failures

• Prevent remote calls when a dependency is determined to be unhealthy

Cascading failures happen when request-handling threads are waiting on a response from a remote system

Rule #1 of microservices – avoid coupling!

Hystrix

@EnableCircuitBreaker Microservice Microservice

Page 21: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Principles Twelve-Factor Applications

Codebase, Dependencies, Config, Backing services, Build,

release, run, Processes, Port binding, Concurrency, Disposability, Dev/prod parity, Logs, Admin processes

Page 22: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

Cultural Change From Silos to DevOps

Page 23: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

The five stages of Cloud Native

1. DENIAL

2. ANGER

3. BARGAING

4. DEPRESSION

5. ACCEPTANCE

Page 24: Javantura v4 - Cloud-native Architectures and Java - Matjaž B. Jurič

e-naslov: http://www.cloud.si

e-naslov: http://www.kumuluz.com

e-pošta: [email protected]

HVALA!