javantura v4 - cloud-native architectures and java - matjaž b. jurič
Upload: hujak-hrvatska-udruga-java-korisnika-croatian-java-user-association
Post on 21-Mar-2017
167 views
TRANSCRIPT
Prof. dr. Matjaž B. Jurič, UL FRI and Kumuluz Project
Cloud-native Architectures and Java
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.
Digital Business
Digitalization (digital transformation) is about delivering business innovation through software.
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.“
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.
The Challenge
How to build software
Faster
Resilient
Scalable
Engaging
Cloud Native Architecture
Cloud Native Architecture
Cloud native architecture is about how software is build,
not where it runs
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
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
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.
Microservice Frameworks for Java
SpringBoot / SpringCloud
WildFly Swarm
KumuluzEE
Dropwizard
Payara Micro
Microprofile.io
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
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
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"]
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
APIs
All data exchange between microservices must be through API layer
• No accessing datastores across microservices
Synchronous
Asynchrnous
Streaming
Event-driven
REST
Messaging
APIs
Adopt advanced REST concepts
• Versioning, Links, Paging, Querying, Filtering, Ordering, Etc
API specification
• OpenAPI / Swagger
• JSON Schema
Stateless
Api Management
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.
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
Principles Twelve-Factor Applications
Codebase, Dependencies, Config, Backing services, Build,
release, run, Processes, Port binding, Concurrency, Disposability, Dev/prod parity, Logs, Admin processes
Cultural Change From Silos to DevOps
The five stages of Cloud Native
1. DENIAL
2. ANGER
3. BARGAING
4. DEPRESSION
5. ACCEPTANCE