How to develop your first
cloud-native Applications
with Java—
Niklas Heidloff
Developer Advocate, IBM
@nheidloff
Harald Uebele
Developer Advocate, IBM
@Harald_U
Continues delivery
→ DevOps
Polyglot microservices
→ Interactions via APIs
Elasticity
→ App stays responsive
Horizontal scalability
→ Distributed systems
What are cloud-native Applications?
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
“Microservices are a software
development technique [...]
that structures an application
as a collection of loosely
coupled services.”
Wikipedia
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
Run anywhere
→ Kubernetes
Empowered teams
→ Ownership
Fast response times
→ No cold start
Full control
→ Canary rollouts
When to use Microservices?
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
New Options → New Challenges
Cloud-native applications
provide new capabilities,
which challenge
developers
–  New tasks
–  Old tasks in new
context
Service discovery and
traffic management
Distributed monitoring,
logging and tracing
Authentication and
authorization between
services
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
“Kubernetes (K8s) is an open-
source system for automating
deployment, scaling, and
management of containerized
applications.”
kubernetes.io
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
“Istio is an open platform for
providing a uniform way to
integrate microservices,
manage traffic flow across
microservices, enforce
policies and aggregate
telemetry data.”
github.com/istio/istio
@nheidloff @Harald_U
“Optimizing Enterprise Java
for a Microservices
Architecture.
[...] by innovating [...] with a
goal of standardization.”
microprofile.io
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
How to use all Pieces together?
Kubernetes
Java Enterprise Edition
Istio
Eclipse MicroProfile
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
Leverage platforms as
much as possible.
@nheidloff @Harald_U
Use frameworks for app
specific logic.
#IBMDeveloper github.com/nheidloff/cloud-native-starter
Design principles for the
end-to-end example
‘cloud-native-starter’
Use only open-source
components for the core
services of the application
Make the first time
experience as simple as
possible
Be able to run the
application in different
environments
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
Architecture: End-to-End Example ‘cloud-native-starter’
Web-App
NoSQL / Cloudant
Web-API v1 Articles
Web-API v2 Authors
Web-App
SQL / Db2
OpenID / App ID
LogDNASysdig
Authentication
@nheidloff @Harald_U
Browser Kubernetes with Istio Optional Cloud Services
Ingress
Web Experience in ‘cloud-native-starter’
Java Image
@nheidloff @Harald_U
Open source stack
OpenJ9 0.12.1
OpenJDK 8u202-b08 from AdoptOpenJDK
Open Liberty 18.0.0.4
MicroProfile 2.1
Dockerfile
#IBMDeveloper github.com/nheidloff/cloud-native-starter
Exposing REST APIs
@nheidloff @Harald_U
JAX-RS
Java API for RESTful Web Services
GetArticles.java
Exposing REST APIs
@nheidloff @Harald_U
Open API (formerly Swagger)
API description format for REST APIs
Consuming REST APIs
@nheidloff @Harald_U
MicroProfile Rest Client
Type-safe approach to invoke RESTful services
AuthorsService.java
AuthorsServiceDataAccess.java
Resiliency
@nheidloff @Harald_U
Timeouts and retries
Circuit breaking
Fallback
Fault injection
Service.java
Resiliency
Traffic Management
@nheidloff @Harald_U
Blue-green deployments
Canary rollouts
A/B testing
ingress.yaml
Traffic Management
Authentication and
Authorization
@nheidloff @Harald_U
OpenID Connect
Identity layer on top of the OAuth 2.0 protocol
IBM App ID
IBM service to authenticate users and protect APIs
policy.yaml
.env of authentication service
Authorization
Authorization
Authentication
Configuration
@nheidloff @Harald_U
MicroProfile Configuration
External configuration of microservices
Service.yaml
CoreService.java
Chained invocations Kubernetes
→ 1 service = N pods
Microservices vs monolith
→ Higher complexity
→ Ephemeral
Tracing
Logging
Monitoring
Metrics
Healthchecks
Observability
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
Tracing
@nheidloff @Harald_U
OpenTracing
Vendor-neutral APIs and instrumentation for
distributed tracing
Jaeger and Zipkin
Open source distributed tracing systems
server.xml
#IBMDeveloper github.com/nheidloff/cloud-native-starter
Distributed Tracing
Metrics
@nheidloff @Harald_U
Prometheus
Monitoring system and time series database
GetArticles.java
#IBMDeveloper github.com/nheidloff/cloud-native-starter
Metrics
LogDNA
Sysdig
Healthchecks
@nheidloff @Harald_U
MicroProfile Health
Liveness probes and readiness probes
HealthEndpoint.java
Service.yaml
Try out the end-to-end
microservices example
cloud-native-starter!
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
Deploying Sample Services
@nheidloff @Harald_U
As easy as ’cf push’
scripts
ibm-scripts
iks-scripts
sh scripts/deploy-authors-nodejs.sh
Running the Example App
@nheidloff @Harald_U
Script displays all relevant URLs
sh scripts/show-urls.sh
IBM Cloud Kubernetes Service including Istio and Knative
IBM Developer
developer.ibm.com
IBM Cloud Lite account
ibm.biz/nheidloff
IBM loves open source
Kubernetes and Istio
OpenJ9 & AdoptOpenJDK
MicroProfile
Open Liberty
Leverage platforms as
much as possible
Use frameworks for app
specific logic
Summary
github.com/nheidloff/cloud-native-starter
@nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
How to develop your first cloud-native Applications with Java

How to develop your first cloud-native Applications with Java

  • 1.
    How to developyour first cloud-native Applications with Java— Niklas Heidloff Developer Advocate, IBM @nheidloff Harald Uebele Developer Advocate, IBM @Harald_U
  • 2.
    Continues delivery → DevOps Polyglotmicroservices → Interactions via APIs Elasticity → App stays responsive Horizontal scalability → Distributed systems What are cloud-native Applications? @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 3.
    “Microservices are asoftware development technique [...] that structures an application as a collection of loosely coupled services.” Wikipedia @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 4.
    Run anywhere → Kubernetes Empoweredteams → Ownership Fast response times → No cold start Full control → Canary rollouts When to use Microservices? @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 5.
    New Options →New Challenges
  • 6.
    Cloud-native applications provide newcapabilities, which challenge developers –  New tasks –  Old tasks in new context Service discovery and traffic management Distributed monitoring, logging and tracing Authentication and authorization between services @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 7.
    “Kubernetes (K8s) isan open- source system for automating deployment, scaling, and management of containerized applications.” kubernetes.io @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 8.
    “Istio is anopen platform for providing a uniform way to integrate microservices, manage traffic flow across microservices, enforce policies and aggregate telemetry data.” github.com/istio/istio @nheidloff @Harald_U
  • 9.
    “Optimizing Enterprise Java fora Microservices Architecture. [...] by innovating [...] with a goal of standardization.” microprofile.io @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 10.
    How to useall Pieces together? Kubernetes Java Enterprise Edition Istio Eclipse MicroProfile @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 11.
    Leverage platforms as muchas possible. @nheidloff @Harald_U Use frameworks for app specific logic. #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 12.
    Design principles forthe end-to-end example ‘cloud-native-starter’ Use only open-source components for the core services of the application Make the first time experience as simple as possible Be able to run the application in different environments @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 13.
    Architecture: End-to-End Example‘cloud-native-starter’ Web-App NoSQL / Cloudant Web-API v1 Articles Web-API v2 Authors Web-App SQL / Db2 OpenID / App ID LogDNASysdig Authentication @nheidloff @Harald_U Browser Kubernetes with Istio Optional Cloud Services Ingress
  • 14.
    Web Experience in‘cloud-native-starter’
  • 15.
    Java Image @nheidloff @Harald_U Opensource stack OpenJ9 0.12.1 OpenJDK 8u202-b08 from AdoptOpenJDK Open Liberty 18.0.0.4 MicroProfile 2.1 Dockerfile #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 16.
    Exposing REST APIs @nheidloff@Harald_U JAX-RS Java API for RESTful Web Services GetArticles.java
  • 17.
    Exposing REST APIs @nheidloff@Harald_U Open API (formerly Swagger) API description format for REST APIs
  • 18.
    Consuming REST APIs @nheidloff@Harald_U MicroProfile Rest Client Type-safe approach to invoke RESTful services AuthorsService.java AuthorsServiceDataAccess.java
  • 19.
    Resiliency @nheidloff @Harald_U Timeouts andretries Circuit breaking Fallback Fault injection Service.java
  • 20.
  • 21.
    Traffic Management @nheidloff @Harald_U Blue-greendeployments Canary rollouts A/B testing ingress.yaml
  • 22.
  • 23.
    Authentication and Authorization @nheidloff @Harald_U OpenIDConnect Identity layer on top of the OAuth 2.0 protocol IBM App ID IBM service to authenticate users and protect APIs policy.yaml .env of authentication service
  • 24.
  • 25.
  • 26.
  • 27.
    Configuration @nheidloff @Harald_U MicroProfile Configuration Externalconfiguration of microservices Service.yaml CoreService.java
  • 28.
    Chained invocations Kubernetes →1 service = N pods Microservices vs monolith → Higher complexity → Ephemeral Tracing Logging Monitoring Metrics Healthchecks Observability @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 29.
    Tracing @nheidloff @Harald_U OpenTracing Vendor-neutral APIsand instrumentation for distributed tracing Jaeger and Zipkin Open source distributed tracing systems server.xml #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 30.
  • 31.
    Metrics @nheidloff @Harald_U Prometheus Monitoring systemand time series database GetArticles.java #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 32.
  • 33.
  • 34.
  • 35.
    Healthchecks @nheidloff @Harald_U MicroProfile Health Livenessprobes and readiness probes HealthEndpoint.java Service.yaml
  • 36.
    Try out theend-to-end microservices example cloud-native-starter! @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter
  • 37.
    Deploying Sample Services @nheidloff@Harald_U As easy as ’cf push’ scripts ibm-scripts iks-scripts sh scripts/deploy-authors-nodejs.sh
  • 38.
    Running the ExampleApp @nheidloff @Harald_U Script displays all relevant URLs sh scripts/show-urls.sh
  • 39.
    IBM Cloud KubernetesService including Istio and Knative
  • 40.
    IBM Developer developer.ibm.com IBM CloudLite account ibm.biz/nheidloff IBM loves open source Kubernetes and Istio OpenJ9 & AdoptOpenJDK MicroProfile Open Liberty Leverage platforms as much as possible Use frameworks for app specific logic Summary github.com/nheidloff/cloud-native-starter @nheidloff @Harald_U #IBMDeveloper github.com/nheidloff/cloud-native-starter