Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
© 2017 IBM Corporation
EclipseCon Europe 2017
Resilient Java Microserviceswith Eclipse MicroProfile
Emily Jiang – MicroProfile Development Lead@emilyfhjiang
Kevin Sutter – MicroProfile and Java EE Architect@kwsutter
1
© 2017 IBM Corporation
MicroProfile Sessions
2
• Open Java EE and Eclipse MicroProfile – A New Java Landscape for Cloud Native Apps• (old title) MicroProfile, Java EE, and the Application Server – Oh
My!• Wednesday, Oct 25, 15:45, Burgersaal 2
• Resilient Java Microservices with Eclipse MicroProfile• (old title) Eclipse MicroProfile: What is it? Is it a Java EE
Replacement?• Wednesday, Oct 25, 16:30, Silchersaal
• MicroProfile BOF• Wednesday, Oct 25, 18:30, Seminarraum 5
• The Monitoring Aspects of Eclipse MicroProfile• Thursday, Oct 26, 11:00, Seminarraum 5
• Eclipse MicroProfile Config and OSGi Config Admin• Thursday, Oct 26, 13:00, Schubartsaal
© 2017 IBM Corporation
§ What are Microservices?– Small concise service – small piece of SOA– Easy to maintain– Easy to release– Loosely coupled a number of them to form a system
§ Microservice best practice– Configurable– Fault tolerance– Monitoring– Secure– Working well in the cloud
§ How to build it the right way?– Use Eclipse MicroProfile
3
© 2017 IBM Corporation
What is Eclipse MicroProfile?
● Eclipse MicroProfile is an open-source community specification for Cloud Native Java microservices
● A community of individuals, organizations, and vendors collaborating within an open source (Eclipse) project to bring microservices to the Enterprise Java community
4
© 2017 IBM Corporation
§ Why Eclipse MicroProfile?– Microservice portable among application servers– No vendor locking unlike Spring– Fast innovating– Frequent release cycle
6 CDI 1.2
© 2017 IBM Corporation
http://microprofile.io/MicroProfile adds new enterprise Java capabilities for microservices
Config Fault Tolerance Health Check Health Metrics JWT
externalize configuration to
improve portability
build robust behavior to cope with
unexpected failures
ensure services are running
understand the interactions between
services while running
resolve problems in complex distributed
systems
New in Eclipse MicroProfile Release 1.2: https://projects.eclipse.org/projects/technology.microprofile/releases/1.2
Robust Microservices
© 2017 IBM Corporation
Transient Failure
for (int i = 0; i < 5; i++) {try {
callServiceC();break;
} catch (IOException e) {}
}
service Cservice A
© 2017 IBM Corporation
Transient Failure
@Retry(retryOn=IOException.class,delay = 500,maxRetries=5
public void callServiceC() {// call the service
}
service Cservice A
© 2017 IBM Corporation
Dealing with slow services
service Cservice A5s SLA 5s response
@Timeout(2000)public void callServiceC() {
// call the service}
© 2017 IBM Corporation
Don’t overload serviceC
service Cservice A
@Bulkheadpublic void callServiceC() {
// call the service}
© 2017 IBM Corporation
Circuit Breaker Closed
service Cservice A
© 2017 IBM Corporation
Circuit Breaker Open
service Cservice A
© 2017 IBM Corporation
Circuit Breaker Half-Open
service Cservice A
@CircuitBreaker(failOn=IOException.class,delay = 500)
public void callServiceC() {// call the service
}
© 2017 IBM Corporation
Fallbacks
service Cservice A
@Fallback(MyFallback.class)public void callServiceC() {// call the service
}
private class MyFallbackimplements FallbackHandler {
public void handle(ExecutionContext c) {
// perform fallback action}
}
© 2017 IBM Corporation
MicroProfile Fault Tolerance with Istio
@Retry@Timeout@CircuitBreaker@Bulkhead@Fallback
RetryTimeoutCircuitBreakerBulkhead
© 2017 IBM Corporation21
MicroProfile 1.0 (Fall 2016)jaxrs-2.0cdi-1.2jsonp-1.0
MicroProfile 1.1 (August 2017)microProfile-1.0mpConfig-1.0
MicroProfile 1.2 (Sept 2017)microProfile-1.1mpConfig-1.1mpFaultTolerance-1.0mpHealth-1.0mpMetrics-1.0mpJwt-1.0
MicroProfile 1.3 (???)MicroProfile 1.2mpTracing-1.0mpOpenApi-1.0mpRestClient-1.0
MicroProfile 2.0 (???)MicroProfile 1.3jaxrs-2.1 // Java EE 8cdi-2.0 // Java EE 8jsonp-1.1 // Java EE 8jsonb-1.0 // Java EE 8
2017
2018
Aug Sept
© 2017 IBM Corporation22
§ Resources
– http://microprofile.io/
– https://openliberty.io/
– https://www.eclipse.org/community/eclipse_newsletter/2017/september/
– https://github.com/NottyCode/fault-tolerence-examples
– https://liberty-app-accelerator.wasdev.developer.ibm.com/start/
© 2017 IBM Corporation
Thank you