wso2 microservices framework for java - product overview
TRANSCRIPT
WSO2 Microservices Framework for Java 2.0.0
Overview
Agenda
• Introduction
• Core Features
• Performance
• Deployment
2
Introduction
3
Microservices
• Small independent processes achieving small tasks, which work together to ultimately compose a complex application
4
Ref: http://martinfowler.com/articles/microservices/images/sketch.png
Microservices Architecture
• Modular and composable
• Easy to maintain - Components can be easily replaced and bugs in one component can be fixed without affecting others
• Highly scalable
• Easy deployment
5
WSO2 Microservices Framework for Java
• A lightweight, high performance framework for building microservices in Java
• Simple Java based programming model with JAX-RS and Swagger based annotations
• Fast boot up - microservices can be booted in a few milliseconds in a Docker container and can be easily added to a Docker image
• Secures microservices leveraging JWT, BasicAuth and OAuth2 and has the capability to integrate with third-party authentication servers
• Monitors microservices service behavior with analytics dashboards
6
Vision of WSO2 MSF4J
• Lightweight and fast runtime
• Use Java annotations as a way of defining microservices APIs as well as met
• Provide simple ways to develop and deploy microservices
• Built-in metrics and analytics APIs with OOB integration with WSO2 Data Analytics Server (WSO2 DAS)
• To be used in the WSO2 platform as a way of replacing all admin services as well as defining other microservices for inter-component interactions
7
Implementation of WSO2 MSF4J
• Based on the new WSO2 Carbon 5.0 Kernel
• Transport is based on Netty 4.0
• Supports streaming
• High performance
• 9MB pack size
• Starts within 300 ms
• Less than 25 MB memory consumption for the framework
8
Core Features
9
Annotation-based Programming Model
• Supports JAX-RS based annotations • Class-level annotations
• Method-level annotations
• Parameter-level annotations
• Lifecycle callback method annotations
• Supports Swagger based annotations • Enables generating Swagger API definition from a single API call
• Humans and computers can discover and understand the capabilities of each service
10
Spring-based Microservices
• WSO2 MSF4J Supports a Spring-native development model with • Dependency Injection (DI)
• Standard configuration annotations (e.g. @Configuration, @Component, @AutoWired)
• Makes it easy to bring in other 3rd party libraries & wire them in at runtime
• For example those who are familiar with Spring-JPA can use the Spring-JPA library to integrate the Hibernate ORM framework with an WSO2 MSF4J service
11
Server-less Execution
• Supports server-less execution with fat JAR
• Fat JAR is a JAR file with all dependencies in one fat (uber) JAR
• Creating a fat JAR and running it in a Java process is referred to as server-less execution
• Server-less execution does not involve unzipping a file and helps to start an app without a shell script
• Supports service lifecycle methods
• Easy to run within a container-friendly model
12
Streaming
• WSO2 MSF4J adopts an efficient model to handle Streaming Input (request messages) and Streaming Output (response messages)
• Streaming Input - HTTP chunked requests can be handled in two ways:
• Zero-copy method – Each chunk of a request is treated separately • chunk() method is called when requests arrive • finished () method is called after the last chunk arrives • error () method called if an error occurs while processing the request
• Chunk aggregation – Aggregates all chunks of the request and presents it as a full http request to the resource method
• Streaming Output – Useful when handling large data volumes – no need to load into memory
13
Custom Interceptors
• Custom interceptors can be used to perform certain actions before or after a request arrives to resource methods
• Custom interceptors should implement theorg.wso2.msf4j.Interceptor interface
14
File Handling
• Serve files from the resource methods by returning either of the following • java.io.File • java.io.InputStream • javax.ws.rs.core.Response object with a java.io.File • java.io.InputStream entity
• Streaming is supported by default for java.io.File and java.io.InputStream entities
• javax.ws.rs.core.StreamingOutput is also supported by WSO2 MSF4J - provides the service author more control over the chunk size
15
Templates
• Enables dynamic Web pages to be easily developed as microservices
• Any data model can be easily rendered with a template and exposed as a REST service using this concept
16
Exception Mapper
• Supports JAXRS ExceptionMapper, which allows the creation of custom responses when exceptions are thrown from MSF4J services
• The following code segment shows how ExceptionMappers are registered with the WSO2 MSF4J runtime:
17
Circuit Breaker
• Nygard's circuit breaker pattern is supported in
WSO2 MSF4J using the Netflix Hystrix library
18
Thread Model
19
Security
• Security is done via a central server issuing JWT tokens
• The JWTSecurityInterceptor verifies the signature, expiry and claims in the token
20
Analytics and Monitoring
• Supports annotations • Timed – measures execution time • Metered – measures rate of events • Counted – counts the total number of invocations • HTTPMonitored – monitors HTTP requests
21
Metrics Output to Console
22
JMX Metrics
23
Dashboards
24
Performance
25
26
27
28
29
30
31
Deployment
32
33
WSO2 Platform Deployment Options
o Stand-‐alone servers o Private clouds:
e.g. Stratos, Kubernetes o Public Clouds:
e.g. AWS o Hybrid deployments
o Dedicated hosKng of any WSO2-‐based soluKons
o WSO2 operaKons team is managing the deployment and keeps it running
o 99.99% upKme SLA o Any AWS region of choice o Can be VPNed to local network o Includes monitoring, backups,
patching, updates
o Shared public cloud, o Currently available for applicaKon and
API hosKng (hosted API Manager and App Factory),
o Preset mulKtenant deployment in AWS US East run by WSO2,
o Month-‐to-‐month credit card payment
CONTACT US !