41
Introduction to WSO2 Microservices Server Afkham Azeez Director, Architecture WSO2 Inc.

WSO2Con 2015-us-introduction-to-mss-v2

Embed Size (px)

Citation preview

Page 1: WSO2Con 2015-us-introduction-to-mss-v2

Introduction to WSO2 Microservices Server

Afkham AzeezDirector, ArchitectureWSO2 Inc.

Page 2: WSO2Con 2015-us-introduction-to-mss-v2

Microservices Architecture

A method of developing software applications as a

suite of independently deployable, small, modular

services in which each service runs a unique process

and communicates through a well-defined,

lightweight mechanism to serve a business goal.

Page 3: WSO2Con 2015-us-introduction-to-mss-v2

• a service-oriented architecture composed of loosely coupled elements that have bounded contexts

• Loosely coupled – Can update independently– No coupling at database level

• Bounded context– Can update a microservices code without understanding

internals of peers

Microservices Architecture

Page 6: WSO2Con 2015-us-introduction-to-mss-v2

Inner & Outer Architecture

Page 8: WSO2Con 2015-us-introduction-to-mss-v2

Vision for Microservices Server (MSS) • Lightweight & fast runtime

• Use Java annotations as a way of defining microservices APIs as well as

metrics

• Support well known & widely used methods such as JAXRS annotations

• Provide simple ways to develop & deploy microservices

• Built-in Metrics & Analytics APIs with out of the box integration with WSO2

Data Analytics Server (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

Page 9: WSO2Con 2015-us-introduction-to-mss-v2

Microservices Server Implementation• Based on the new Carbon 5.0 kernel

• Transport is based on Netty 4.0

• Supports streaming

• Close to 10x faster than CXF based JAXRS implementation used in

WSO2 AppServer

• 5MB pack size

• Starts within 300ms

• ~25MB memory consumption for the MSS framework

Page 10: WSO2Con 2015-us-introduction-to-mss-v2

Download

• MSS 1.0.0-alpha release is available at https://github.com/wso2/product-mss/releases

• Refer to the getting started guide in GitHub• A good place to start is the samples

– https://github.com/wso2/product-mss/tree/v1.0.0-alpha/samples

Page 11: WSO2Con 2015-us-introduction-to-mss-v2

Core Features in MSS• Quick & simple development model using simple annotations• Lightweight & high performance• Custom interceptors • JWT based security• Metrics gathering & publishing• Tracing of requests using a unique message ID• Streaming input & streaming output support• WSO2 DevStudio based tooling for generating microservices projects

starting from a Swagger API definition• Comprehensive samples demonstrating how to develop microservices

application

Page 12: WSO2Con 2015-us-introduction-to-mss-v2

MSS – Flow & Thread Model

Page 13: WSO2Con 2015-us-introduction-to-mss-v2
Page 14: WSO2Con 2015-us-introduction-to-mss-v2

Runner

Page 15: WSO2Con 2015-us-introduction-to-mss-v2

Request Streaming

Page 16: WSO2Con 2015-us-introduction-to-mss-v2

• java -jar /opt/stockquote-1.0.0.jar

• Drop microservice jar file into MSS_HOME/repository/deployment/server/mss

• Very convenient to use Docker containers managed by Kubernetes

Microservices Runtime

Page 17: WSO2Con 2015-us-introduction-to-mss-v2

Pets vs. Cattle• Traditional Approach– Treat servers like pets– Get emotionally attached to

them– Mourn their deaths

• New Approach– Treat servers like cattle– Get work done & dispose– Don’t mourn their deaths.

Buy new ones.

Page 18: WSO2Con 2015-us-introduction-to-mss-v2

*

What is Kubernetes?๏ The Greek word “kubernetes,” means “helmsman of a

ship๏ Kubernetes is a platform for hosting Docker containers

in a clustered environment with multiple Docker hosts

๏ Provides container grouping, load balancing, auto-healing, manual scaling features ...etc

๏ Project was started by Google

๏ Contributors == Google, CodeOS, Redhat, Mesosphere, Microsoft, HP, IBM, VMWare, Pivotal, SaltStack, etc

Page 19: WSO2Con 2015-us-introduction-to-mss-v2

*

Key Kubernetes Concepts

๏ Pod - A group of Containers๏ Labels - Labels for identifying pods๏ Proxy/Service - A load balancer for Pods๏ etcd - A metadata service๏ cAdvisor - Container Advisor provides resource

usage/performance statistics๏ Replication Controller - Manages replication of

pods๏ Scheduler - Schedules pods in worker nodes๏ API Server - Kubernetes API server

Page 20: WSO2Con 2015-us-introduction-to-mss-v2

Kubernetes Architecture

Page 21: WSO2Con 2015-us-introduction-to-mss-v2

Kubernetes – Replication Controller

Page 22: WSO2Con 2015-us-introduction-to-mss-v2

Kubernetes - Service

Page 23: WSO2Con 2015-us-introduction-to-mss-v2

Kubernetes UI

Page 24: WSO2Con 2015-us-introduction-to-mss-v2

Security

• Security is done via a central server issuing JWT tokens

• The JWTSecurityInterceptor verifies the signature, expiry & claims in the tokens

Page 25: WSO2Con 2015-us-introduction-to-mss-v2

Analytics & Monitoring

• Supports annotations– Timed – measures execution time

–Metered – measures rate of events

–Counted – Counts the total invocations

–HTTPMonitoring – monitors HTTP requests

Page 26: WSO2Con 2015-us-introduction-to-mss-v2

Analytics & Monitoring

Page 27: WSO2Con 2015-us-introduction-to-mss-v2

Analytics & Monitoring

Page 28: WSO2Con 2015-us-introduction-to-mss-v2

JMX Metrics

Page 29: WSO2Con 2015-us-introduction-to-mss-v2

Metrics Output to Console

Page 30: WSO2Con 2015-us-introduction-to-mss-v2

Tooling (Swagger -> Code)Swagger API Definition

MSS Code

1

2

3

Page 31: WSO2Con 2015-us-introduction-to-mss-v2

MSS - Performance ComparisonThroughput

Page 32: WSO2Con 2015-us-introduction-to-mss-v2

MSS - Memory Consumption ComparisonMemory Consumption (MB)

Page 33: WSO2Con 2015-us-introduction-to-mss-v2

Pet Store Sample

Pet

Transaction

Redis

Security

File server

Admin FE

Store FE DAS

Service calls

Data Publishing

Page 34: WSO2Con 2015-us-introduction-to-mss-v2

Pet Store Sample – deployment view

Store FEStore

FE

Store FE

Admin FE

Kubernetes Minion 1 Kubernetes Minion 2

Security Security

File server File server

Redis Sentinel

Redis Sentinel

Redis Master

Redis Slave

PetPet

TransactionTransaction

Transaction

podspods

pods

pods

pods

pods

pods

pods

pods

pods

pods pods

pods

pods

pods

S A S T R P F

Kubernetes Services

Page 35: WSO2Con 2015-us-introduction-to-mss-v2

Pet Store Sample

Page 36: WSO2Con 2015-us-introduction-to-mss-v2

Pet Store Sample

Page 37: WSO2Con 2015-us-introduction-to-mss-v2

Demo: MSS Pet store sample

Page 38: WSO2Con 2015-us-introduction-to-mss-v2

Things to Note

• Expensive remote calls (instead of in-process calls)• Coarser-grained remote APIs• Increased complexity when redistributing responsibilities

between components• Centralized governance isn’t optimal• Decentralized data management – de-normalized data• Need to design for interruptions

Page 39: WSO2Con 2015-us-introduction-to-mss-v2

Pricing

• For MSS product (full server) & MSS lite (executable jar), pricing is same as WSO2 AS based on the number of JVMs.

• For container based deployments, it will be the same as for any container based deployment of WSO2 products (to be announced)

Page 41: WSO2Con 2015-us-introduction-to-mss-v2

Thank You