-
1.
Microprofile.io
Cloud Native mit Java EE
Michael Hofmann, CTO, ARS
-
2.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
3
Business Need
“One of the things we've learned is that if you can't get it
to market more quickly, there is no doubt that the
market will have changed and no matter how well you've
engineered it or built it or deployed it or trained your folks,
it's not going to be quite right because it's just a little too
late.“
James McGlennon, ExecutiveVP and CIO, Liberty Mutual Insurance Group
(US Fortune 500: Platz 75, Umsatz 38,3 Mrd. USD)
-
3.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
4
Cloud Computing
Cloud Computing Benefits (lt. IBM):
Flexibility
Skalierbare Rechenleistung bei Bedarf,
Weltweiter Internetzugriff möglich
Efficiency
Geringe Infrastruktur-Kosten
Keine Infrastruktur-Wartung
Strategic Value
Cloud Services bieten innovativste Technologien für Betrieb und Entwicklung
Schnellere und kostengünstigere Bereitstellung neuer Anwendungen mit
Cloud Computing
-
4.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
5
Cloud Native Computing Foundation (CNCF)
Vereinigung mit folgender Mission:
"create and drive the adoption of a new computing paradigm that is
optimized for modern distributed systems environments capable of scaling
to tens of thousands of self healing multi-tenant nodes."
-
5.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
6
CNCF Landscape
-
6.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
7
Cloud Native
Cloud native Systeme haben folgende Eigenschaften
Container packaged
Dynamically managed
Microservices oriented
Cloud native beschreibt
wie die Anwendungen erstellt werden sollen
wie sie deployed werden
-
7.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
8
ARS Golden 4 (+1)
Zusammenspiel von
Microservices
Agile
DevOps
API
Erweitert
DevOps
Automation
Operational Integration in Cloud Laufzeitumgebung
Testing
Canary Releasing, Blue/Green Deployment, A/B Testing
-
8.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
9
Cloud Native Applikationen mit „The 12 Factors“
“A methodology for building software-as-
a-service applications“
12 Faktoren, unabhängig von
Programmiersprache
Sog. Backing Services
Cloud Provider
-
9.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
10
Microprofile.io: cloud native mit Java EE
„Optimizing Enterprise Java for a microservices architecture“
Vereinigung führender Java EE Applikations-Server und andere
Existiert seit 2016
Mittlerweile als Projekt bei der Eclipse Foundation
-
10.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
11
Microprofile Releases
Microprofile 1.2 (30.09.2017)
Microprofile 1.1
Config 1.1
Fault Tolerance 1.0
JWT Propagation 1.0
Health Check 1.0
Health Metrics 1.0
Microprofile 1.3 (15.12.2017)
Microprofile 1.2
Type Safe Rest Client 1.0
Microprofile 2.0 (31.03.2018)
Microprofile 1.3
Anpassungen an Java EE 8 (?)
Microprofile 1.0 (17.09.2016)
JAX-RS 2.0
CDI 1.2
JSON-P 1.0
Microprofile 1.1 (21.07.2017)
Microprofile 1.0
Config 1.0
-
11.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
12
Microprofile Config
Anwendungskonfiguration
Mit Ordinal
Überschreibung
Default Quellen (erweiterbar ConfigSource):
Property-File (100)
System Environment (300)
Java System Property (400)
Per CDI in die Anwendung injiziert
Angabe von Default-Werten
Optionale Werte
Automatischer Reload von Werten bei Änderungen
Typisierung mit Converter
-
12.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
13
Microprofile Fault Tolerance
Notwendig: Resilienz (verteilter Anwendungs-Architektur)
Umsetzung mit Fault Tolerance Design-Patterns
Timeout
TimeoutException nach abgelaufener Zeit
Bei Asynchronous: Thread.interrupt() zur Thread-Freigabe
Retry
maxRetries
delay
maxDuration
jitter
retryOn
abortOn
-
13.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
14
Microprofile Fault Tolerance
Fallback
Alternativer Aufruf im Fehlerfall
CircuitBreaker
Zustände: closed, open und half-open
Verschonung des fehlerhaften Service mit Aufrufen (Erholung)
Vermeidung fehlerhafter Aufrufe, wenn Fehler bekannt
Config-Angabe ,wann CircuitBreaker die Zustände wechselt
Bulkhead
Synchron: Semaphor
Asynchron: eigener ThreadPool mit Warteschlange
Alle Design-Patterns sind kombinierbar
Untereinander
Mit MP Config
-
14.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
15
Microprofile Health Check
REST-Endpoint /health
Abfrage des Gesundheitszustandes
Keine Historie
Maschine-zu-Maschine Kommunikation
Abgefragt von Laufzeitumgebung (Kubernetes, CloudFoundry)
Kranke Services
werden eliminiert
Evtl. durch neue Prozessinstanzen ersetzt (Policy)
HealthCheck CDI Beans
Eigene Entwicklung
Aggregation aller Bean-Ergebnisse
-
15.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
16
Microprofile Health Metrics
REST-Endpoint /metrics
Mit Unterteilung
Base (/metrics/base)
Vendor (/metrics/vendor)
Application (/metrics/application)
Langlaufende Messdaten des Services
-
16.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
17
Microprofile JWT Propagation
OpenId Connect mit JSON Web Token (JWT)
JWT mit JSON Web Signatur (JWS) signiert
neue Claims im JWT:
upn (unique prinicpal name): User Principal
groups: Gruppenzugehörigkeiten des Subject
Inbound-Propagation:
HTTP Header: Authorization: Bearer <JWT-Token>
Integration in Java EE Security Context, damit role based access control
angewandt werden kann
Aktivierung in REST Application
@LoginConfig(authMethod = "MP-JWT", realmName = "MyRealm1")
@ApplicationPath("/api")
public class MyRESTApplication extends javax.ws.rs.core.Application {...}
-
17.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
18
Microprofile JWT Propagation
eyJ0eXAiOiJKV1QiLCJraWQiOiJteW9sf
sfddfsdfUlMyNTYifQ.eyJqdGkiOiJ4eXo
tMTIzNDUiLCJzdWIiOiJ1c2VyMSIsImd
yb3VwcyI6WyJhZG1pbiIsIm5vcm1hbC1
1c2VyIl0sImlzcyI6Imh0dHBzOi8vc2Vyd
mVyLm15Y29tcGFueS5kZSIsImV4cCI6
MTUwNzEwMzI0OCwiaWF0IjoxNTA3
MTAzMDQ4LCJ1cG4iOiJ1c2VyMUBte
WNvbXBhbnkuZGUifQ.rTM_NemKw5f
pXnuh_q6pwF0GaoRzqgozUsCdIKdcpF
EsWs_Ro_aQ6YfYMy178JYyLtUylTWrS
us67nS820YzWHjSYmNReKxhBAzWw
48c0a1A8tAMJ594aVnSyVs2_kG09nvK
yf5f5JPvpbJyIULOZIDYC2zDx3paKJsJ
{
"typ": "JWT",
"kid": "myKey1",
"alg": "RS256"
}
{
"jti": "id-abc-123",
"sub": "user17",
"groups": ["administrator", "sachbearbeiter"],
"iss": "https://server1.mycompany.de",
"exp": 1507103300,
"iat": 1507103360,
"upn": "user17@mycompany.de"
}
-
18.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
19
Microprofile Zukunft…
Type Safe REST Client (Microprofile 1.3)
Distributed Tracing (basierend auf OpenTracing)
Open-API
JCache
ISTIO (IBM, Google, Lyft)
„An open platform to connect, manage, and secure microservices“
Service Registry und Discovery, intelligentes Routing und Loadbalancer
Resilienz und Security
Telemetrie und Reporting
A/B Testing, Canary Releasing, Blue-Green-Deployment
Sidecar-Prinzip, d.h. ohne Einfluss auf Service-Code (sprachneutral)
-
19.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
20
Microprofile Zukunft…
Microprofile 2.0: Anpassung der Microprofile Spec an Java EE 8
Übergang Java EE zu OpenSource EE4J
EE4J: „Eclipse MicroProfile is such a project that EE4J will review as a source of
innovations for incorporation into EE4J. “
Java EE 9: „Enterprise for the Cloud “
Microprofile 2.0 ist dann schon Cloud-Ready
Abstand zu Mitbewerber Spring Boot/Spring Cloud
NOCH vorhanden, aber nicht mehr sehr groß (Hystrix Dashboard für Resilience)
-
20.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
21
Kontaktinformationen
Für Fragen und weitere Informationen stehe ich Ihnen gerne
zur Verfügung:
Michael Hofmann
michael.hofmann@ars.de
+49 89 32468-2075
ARS Computer und Consulting GmbH
Ridlerstraße 37
80339 München
www.ars.de
-
21.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
22
ARS Computer und Consulting GmbH
ARS Computer und Consulting GmbH ist eines der führenden Unternehmen im Bereich Software
Engineering
Unsere Mission: hochwertige Beratung und erfolgreiche Projekte zur Entwicklung qualitativ
exzellenter Software: The Art of Software Engineering
Seit über 20 Jahren hat unser Team die Kreativität, das Wissen, die Übung und Intuition, die unsere
Kunden für ihre erfolgreichen Softwareprojekte benötigen. Wir entwickeln nicht nur individuelle
Software, sondern unterstützen unsere Kunden bei Ihren Entwicklungsprojekten ganzheitlich. Vom
Design über Architekturberatung, Entwicklung, Qualitätssicherung, Betriebskonzepte mit DevOps
bis hin zur Einführung eines Application Lifecycle Managements.
Im Fokus dabei: die „ARS Golden 4“. Microservices-Architekturen, umgesetzt mit agilen
Entwicklungsmethoden, unterstützt durch DevOps-Tools und -Prozesse, mit einer klaren
Ausrichtung auf APIs – nach innen und nach außen.
Unsere Vision: Kognitive Lösungen sind für uns die Zukunft, deshalb arbeiten wir schon jetzt mit
Machine Learning von der Apple Smartwatch bis zum IBM Mainframe:
Software Engineering for a Cognitive World
Lassen Sie uns gemeinsam Neues schaffen, das begeistert.
-
22.
© ARS Computer und Consulting GmbH 2017
Microprofile.io
23
Disclaimer
◼The facts, developments, judgements and predictions made in this presentation are
statements by ARS Computer und Consulting GmbH and are not validated or endorsed
or by IBM.
◼The information presented is available from public sources.
◼Information from IBM events shown here is subject of IBM legal disclaimers explicitly
stating
▪ Information regarding potential future products is intended to outline our general
product direction and it should not be relied on in making a purchasing decision
▪ The information mentioned regarding potential future products is not a
commitment, promise, or legal obligation to deliver any material, code or
functionality. Information about potential future products may not be incorporated
into any contract.
▪ The development, release, and timing of any future features or functionality
described for our products remains at our sole discretion.
Cloud Computing Benefits (https://www.ibm.com/cloud-computing/learn-more/benefits-of-cloud-computing/
https://www.cncf.io/
z.B. Kubernetes, Docker, Opentracing
The CNCF Cloud Native Landscape Project:
a map through the previously uncharted terrain of cloud native technologies
This attempts to categorize many of the most popular projects and product offerings in the cloud native space.
There are many routes to deploying a cloud native application, with CNCF Projects representing a particularly well-traveled path.
https://raw.githubusercontent.com/cncf/landscape/master/landscape/CloudNativeLandscape_latest.jpg
Anwendungen müssen Cloud-Native sein
d.h. sie nutzen die Vorteile der Cloud (egal ob Public oder Private Cloud)
müssen aber auch die Voraussetzungen dazu erfüllen:
- schmaler Fussabdruck (da Bezahlung nach CPU oder Memory)
- kurze Startzeiten (für hohe Skalierbarkeit)
- kleine Services wg. schnellerem Deployment und Anpassbarkeit
https://12factor.net/
Wenn Config-Wert fehlt: Anwendung startet nicht (Liberty)
Timeout: TimeoutException nach Ablauf der Zeit
Timeout bei Asynchronous: mit Thread.interrupt() Thread wieder freigeben
Retry:
maximale Anzahl an Wiederholungen (maxRetries)
Verzögerung zwischen den Aufrufen (delay)
maximale Dauer der Aufrufversuche (maxDuration)
Zufallsvariation der Verzögerung der Aufrufe (jitter)
Angabe des Fehlers bei dem erneut versucht (retryOn)
Angabe des Fehlers bei dem abgebrochen wird (abortOn)
Fallback:
Auf Methoden oder Klassenebene möglich
CircuitBreaker:
Stromsicherung
Mehr als JSR 77 „J2EE Management“ von 2002: einheitliche Schnittstelle mit genormten Daten (JSON, Prometheus)
Base: für alle AppServer indentisch
Vendor: AppServer spezifisch
Application: eigene Anwendungs-Messwerte
2 Punkte im JWT
Base64 URL Encoded
Header Payload Signatur
JSON: Header und Payload
OpenTracing: Mitglied der CNCF
Einheitliche API für Trace-Ausgaben
Implementierung der API enthält den Code für Zugriff auf Trace-Server (z.B. Zipkin (http://zipkin.io)
http://istio.io
Vgl. Hibernate und JPA