Von Java EE zu Cloud Native und

Peter Doschkinow Software Architekt und Sales Consultant ORACLE Deutschland B.V. & Co. KG November 2017

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 3 Agenda • Demo App – realtime collaborative drawing : .com/doschkinow – Implemented as a classic Java EE 7 based monolitic app, deployed in Java Cloud Service – Migrating to a lightweight cloud native app – Decomposing into two microservices with different implementations – Java and Node.js • with deployment on Application Container Cloud Service – Factoring out the app state in a third microservice, using In-Memory Data-Grid • with deployment in Kubernetes Cluster • with deployment in a Swarm • Showcasing – Java Cloud Service (JCS) – Application Container Cloud Service (ACCS) – Developer Cloud Service (DevCS), Wercker Container Native Pipelines – Oracle Container Native App Platform

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Drawing Board Demo: HTML5 Java EE App

• Collaborative realtime drawing • Two-page application – CRUD for a list of drawings – Single drawing • Demonstrating – Server-side • Java EE 7: JAX-RS, WebSocket, JSON-P • Jersey specific, but standardized in Java EE 8: SSE, JSON-B – Client-side: AngularJS or JavaFX

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 5 Drawing Board Demo Thin Server Architecture

WebLogic > 12.1.3 Data Service List of drawings

HTTP/S List of drawing shapes

RS/SSE -

JSON Jersey DataProvider

SSE JAX JSON POJO Web Sockets (HashMap)

HTML5 Browser

WS Endpoint

To play now: http://tinyurl.com/javaee-db

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 6 Moving to a Cloud Native Implementation no app server, minimal footprint • Self-contained deployment artefact Grizzly

• Externalized configuration RS, RS,

HTTP/S -

SSE SSE JAX • Jersey features used JSON (Jersey) DataProvider SSE POJO – JAX-RS, SSE, JSON-B implementation JSON (Drawings – Integration with an HTTP Container: Web Sockets HashMap)

Grizzly HTML5 Browser WS

(Tyrus) Endpoint • Tyrus integration with Grizzly • Footprint only ca. 10 MB!

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 7 Splitting into Microservices deployed on ACCS with DevCS

Grizzly

DataProvider

POJO RS/SSE

- RS, SSE RS,

- (Drawings (Jersey)

JAX HashMap) Microservice HTTP/S JAX JSON sse SSE JSON Node.js Web Sockets HTML5 Browser

DataProvider To play now: POJO (Drawings

http://tinyurl.com/accs2-db Socket.IO HashMap) Microservice ws Webslocket

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 8 Splitting into Microservices deployed on ACCS with DevCS • sse microservice derived from the cloud native implementation through code deletion • ws microservice implemented using Node.js, Express and Socket.io – significant code reduction compared to the Java implementation • Drawing Board app deployed as 2 microservices on a polyglot runtime (ACCS) • DevCS enables a completely automated DevOps pipeline and indepenent microservice deployment on ACCS when source code commits are triggered • The problem: sse and ws are not stateless; how to scale their state?

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 9 Application Container Cloud Service Polyglot Lightweight AppDev Platform for the Enterprise

Application Container Cloud Built on Docker with Elasticity and Autoscaling Plug into Existing DevOps Pipelines Best Practice App Development Approach (12 Factor) Service Bindings

DevOps PaaS Connectivity PaaS Persistence

DevCS APM/Logs MsgCS API CS JCS/FMW MySQL NoSQL DBCS * CY17

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle Developer Cloud Service – What’s In It • Version Management – • Build Automation – Ant, Maven, Gradle, npm, Grunt, Bower, Gulp, Command line • Continuous Integration • Deployment automation • Issues Tracking • Code review • Agile process management Jenkins • wiki • Activity stream

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Developer Cloud Service – Architecture and Integration

Webhooks Cloud Services Code Review

On Premise Servers

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Factoring out the App State in a Cache Microservice

GrizzlyGrizzly cache DataProvider DataProvider

uses a RS/SSE uses a -

RS, SSE RS, Coherence -

RS, SSE RS, Coherence (Jersey)

- distributed

JAX Microservice (Jersey) JAX distributed

HTTP/S JAX Cache Cache JSON sse SSE JSON Node.js

Web Sockets Grizzly Microservice HTML5 Browser Coherence DataProviderDataProvider Cluster Coherence usesPOJO a

Coherence(Drawings Tyrus Socket.IO distributedHashMap) Cache

ws

Webslocket Webslocket Microservice

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 13 Factoring out the App State in a Cache Microservice using an In-Memory Data-Grid • Coherence features used – Unlimited scalability – High-availability and location independence – High performance through very efficient binary cluster protocol – JCache JSR-107 implementation enables the usage of standard API – Lightweight – enables low-footprint, self-contained cloud native microservices – Java 8 functional programming with Lambdas and Stream API accross Java VMs

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 14 Deploying on Kubernetes Cluster overlay network for K8s as containerized microservices with automated Wercker CI/CD pipeline pods forming a Coherence cluster

Worker 1 :30080 :8080 Pod sse

:30088 8888 Pod ws

Pod cache HTTP/S JSON :8080 Load Worker 2 SSE :8888 Balancer JSON :30080 :8080 Pod sse HTML5 Browser Web Sockets :30088 8888 Pod ws To play now: http://tinyurl.com/ravello-db Pod cache

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 15 Oracle Container Native Platform Announcement Wercker automated CI/CD container Pipeline, Managed HA K8s and Docker Registry

Build Push to Registry Git

Test Push

Registry

Exposed Kubernetes VCN Services AD 1 AD 2 AD 3

PV K8S Cluster

VM Node Pool

Node Pool BM http://www.wercker.com/tech-preview

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Container Native Platform Architecture CI/CD Events APIs Streams Container Development API Registry Engineering and Ops SRE Workbench

Service/Fn Protocol Client Logging Tracing Debugging Activation Support Libraries

Open Service Broker Unified Serverless and Service Engine … fn fn Cloud 3rd Party Function Java Event Cloud Autoscale State Services Services Engine SDK Mgmt Threads

Container Registry Managed Kubernetes

Cluster Management Docker Support K8S Dashboard

Infrastructure

17 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. overlay network for Swarm Deploying on a Docker Swarm services forming a Coherence cluster as containerized microservices Swarm Node m1

Container :8080 :8080 sse :8888

Swarm Node w2 HTTP/S :8080 JSON Load Swarm built-in :8080 Container SSE :8888 Balancer routing mesh cache JSON :8888 HTML5 Browser Web Sockets Swarm Node w1

Container :8888 :8888 ws To play now: :8080 http://tinyurl.com/m1-db-swarm

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 18 Docker Swarm Docker native container orchestration in a cluster (since Docker 1.12) • Cluster management integrated with Docker Engine – CLI extended • Declarative service model – app defined as services • Scaling of services • Desired state reconciliation • Multi-host networking – overlay network for services – but the lack of support for multicasting can be a problem for some clustering solutions • Service discovery – embedded DNS server • Load balancing – expose service ports to external load balancer

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Workshops auf der DOAG Konferenz 2017 Im Foyer Shanghai-Seoul – Einstieg in die jeweilige Session jederzeit möglich! • Dienstag 21.11.2017 – 10.00 – 13.00 Uhr – Oracle Datenbank und GoldenGate in der Oracle Cloud – 13.00 – 16.00 Uhr – IT Systems Management mit der Oracle Management Cloud • Mittwoch 22.11.2017 – 10.00 – 13.00 Uhr – Agile Entwicklung von Microservices in der Oracle Cloud – 13.00 – 16.00 Uhr – Oracle Datenbank und GoldenGate in der Oracle Cloud • Donnerstag 23.11.2017 – 10.00 – 13.00 Uhr – IT Systems Management mit der Oracle Management Cloud – 13.00 – 16.00 Uhr – Agile Entwicklung von Microservices in der Oracle Cloud

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 20 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 21