Introduc)on	
  to	
  	
  
WSO2	
  	
  
Microservices	
  Server	
  
A5ham	
  Azeez	
  
Director,	
  Architecture	
  
WSO2	
  Inc.	
  
Microservices	
  Architecture	
  
A	
  method	
  of	
  developing	
  soAware	
  applica)ons	
  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.	
  
 	
  Microservices	
  
Source:	
  hEp://mar)nfowler.com/ar)cles/microservices.html	
  
The	
  Scale	
  Cube	
  
Source:	
  hEp://microservices.io/ar)cles/scalecube.html	
  
Inner	
  &	
  Outer	
  Architecture	
  
hEp://blogs.gartner.com/gary-­‐olliffe/2015/01/30/microservices-­‐guts-­‐on-­‐the-­‐outside/	
  
 	
  Polyglot	
  Persistence	
  
Source:	
  hEp://mar)nfowler.com/ar)cles/microservices.html	
  
 	
  Vision	
  for	
  Microservices	
  Server	
  (MSS)	
  	
  
•  Lightweight	
  &	
  fast	
  run)me	
  
•  Use	
  Java	
  annota)ons	
  as	
  a	
  way	
  of	
  defining	
  microservices	
  APIs	
  as	
  well	
  as	
  
metrics	
  
•  Support	
  well	
  known	
  &	
  widely	
  used	
  methods	
  such	
  as	
  JAXRS	
  annota)ons	
  
•  Provide	
  simple	
  ways	
  to	
  develop	
  &	
  deploy	
  microservices	
  
•  Built-­‐in	
  Metrics	
  &	
  Analy)cs	
  APIs	
  with	
  out	
  of	
  the	
  box	
  integra)on	
  with	
  WSO2	
  
Data	
  Analy)cs	
  Server	
  (DAS)	
  
•  To	
  be	
  used	
  in	
  the	
  WSO2	
  pla]orm	
  as	
  a	
  way	
  of	
  replacing	
  all	
  admin	
  services	
  as	
  
well	
  as	
  defining	
  other	
  microservices	
  for	
  inter-­‐component	
  interac)ons	
  
 Microservices	
  Server	
  ImplementaGon	
  
•  Based	
  on	
  the	
  new	
  Carbon	
  5.0	
  kernel	
  
•  Transport	
  is	
  based	
  on	
  NeEy	
  4.0	
  
•  Supports	
  streaming	
  
•  Close	
  to	
  10x	
  faster	
  than	
  CXF	
  based	
  JAXRS	
  implementa)on	
  used	
  in	
  
WSO2	
  AppServer	
  
•  5MB	
  pack	
  size	
  
•  Starts	
  within	
  300ms	
  
•  ~25MB	
  memory	
  consump)on	
  for	
  the	
  MSS	
  framework	
  
Download	
  
•  MSS	
  1.0.0-­‐alpha	
  release	
  is	
  available	
  at	
  
hEps://github.com/wso2/product-­‐mss/releases	
  
•  Refer	
  to	
  the	
  gecng	
  started	
  guide	
  in	
  GitHub	
  
•  A	
  good	
  place	
  to	
  start	
  is	
  the	
  samples	
  
–  hEps://github.com/wso2/product-­‐mss/tree/v1.0.0-­‐alpha/samples	
  
Core	
  Features	
  in	
  MSS	
  
•  Quick	
  &	
  simple	
  development	
  model	
  using	
  simple	
  annota)ons	
  
•  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	
  genera)ng	
  microservices	
  projects	
  
star)ng	
  from	
  a	
  Swagger	
  API	
  defini)on	
  
•  Comprehensive	
  samples	
  demonstra)ng	
  how	
  to	
  develop	
  microservices	
  
applica)on	
  
 MSS	
  –	
  Flow	
  &	
  Thread	
  Model	
  
 MSS	
  -­‐	
  Performance	
  Comparison	
  
Throughput	
  
 MSS	
  -­‐	
  Memory	
  ConsumpGon	
  Comparison	
  
Memory	
  Consump1on	
  (MB)	
  
Developer	
  Experience	
  &	
  	
  
Programming	
  Model	
  
Maven	
  pom.xml	
  
StockQuote	
  Microservice	
  
Main	
  Class	
  
Build	
  it!	
  
mvn	
  clean	
  install	
  
Run	
  it!	
  
java	
  –jar	
  stockquote-­‐*.jar	
  
Tooling	
  (Swagger	
  -­‐>	
  Code)	
  
Swagger	
  API	
  
Defini)on	
  
MSS	
  Code	
  
1
2
3
Request	
  Streaming	
  
AnalyGcs	
  &	
  Monitoring	
  
•  Supports	
  annota)ons	
  
– Timed	
  –	
  measures	
  execu)on	
  )me	
  
– Metered	
  –	
  measures	
  rate	
  of	
  events	
  
– Counted	
  –	
  Counts	
  the	
  total	
  invoca)ons	
  
– HTTPMonitoring	
  –	
  monitors	
  HTTP	
  requests	
  
AnalyGcs	
  &	
  Monitoring	
  
AnalyGcs	
  &	
  Monitoring	
  
Metrics	
  Output	
  to	
  Console	
  
JMX	
  Metrics	
  
AnalyGcs	
  &	
  Monitoring	
  
Security	
  
•  Security	
  is	
  done	
  via	
  a	
  central	
  server	
  issuing	
  JWT	
  
tokens	
  	
  
•  The	
  JWTSecurityInterceptor	
  verifies	
  	
  the	
  
signature,	
  expiry	
  &	
  claims	
  in	
  the	
  tokens	
  
Security	
  
•  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	
  RunGme	
  
Deployment	
  Op)ons	
  
*	
  
Docker	
  Filesystem	
  
StockQuote	
  Service	
  -­‐	
  Dockefile	
  
Kubernetes	
  –	
  ReplicaGon	
  Controller	
  
Kubernetes	
  -­‐	
  Service	
  
Kubernetes	
  UI	
  
Pet	
  Store	
  Sample	
  -­‐	
  admin	
  
Pet	
  Store	
  Sample	
  -­‐	
  store	
  
Pet	
  Store	
  Sample	
  
Pet	
  
Transac)on	
  
Redis	
  
Security	
  
File	
  
server	
  
Admin	
  FE	
  
Store	
  FE	
   DAS	
  
Service	
  calls	
  
Data	
  Publishing	
  
Pet	
  Store	
  Sample	
  –	
  deployment	
  view	
  
Store	
  
FE	
  Store	
  
FE	
  
Store	
  
FE	
  
Admin	
  
FE	
  
Kubernetes	
  Node	
  1	
   Kubernetes	
  Node	
  2	
  
Security	
   Security	
  
File	
  server	
   File	
  server	
  
Redis	
  
Sen)nel	
  
Redis	
  
Sen)nel	
  
Redis	
  
Master	
  
Redis	
  
Slave	
  
Pet	
  
Pet	
  
Transac)on	
  
Transac)on	
  
Transac)on	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
  
pods	
   pods	
  
pods	
  
pods	
  
pods	
  
S A S T R P F
Kubernetes	
  Services	
  
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)	
  
Code	
  
• NeEy	
  based	
  transport	
  
hEps://github.com/wso2/carbon-­‐transports	
  
• MSS	
  hEps://github.com/wso2/product-­‐mss	
  
	
  
	
  	
  
	
  
	
  	
  
Recap	
  
•  A	
  brief	
  look	
  at	
  Microservices	
  Architecture	
  (MSA)	
  
•  WSO2	
  Microservices	
  Server	
  
–  Development	
  model	
  &	
  programming	
  model	
  
–  Deployment	
  model	
  
–  Tooling	
  
–  Comparison	
  with	
  other	
  frameworks	
  out	
  there	
  
Thank	
  You	
  

WSO2Con 2015 USA: Introducing Microservices Server

  • 1.
    Introduc)on  to     WSO2     Microservices  Server   A5ham  Azeez   Director,  Architecture   WSO2  Inc.  
  • 2.
    Microservices  Architecture   A  method  of  developing  soAware  applica)ons  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.  
  • 3.
       Microservices   Source:  hEp://mar)nfowler.com/ar)cles/microservices.html  
  • 4.
    The  Scale  Cube   Source:  hEp://microservices.io/ar)cles/scalecube.html  
  • 5.
    Inner  &  Outer  Architecture   hEp://blogs.gartner.com/gary-­‐olliffe/2015/01/30/microservices-­‐guts-­‐on-­‐the-­‐outside/  
  • 6.
       Polyglot  Persistence   Source:  hEp://mar)nfowler.com/ar)cles/microservices.html  
  • 7.
       Vision  for  Microservices  Server  (MSS)     •  Lightweight  &  fast  run)me   •  Use  Java  annota)ons  as  a  way  of  defining  microservices  APIs  as  well  as   metrics   •  Support  well  known  &  widely  used  methods  such  as  JAXRS  annota)ons   •  Provide  simple  ways  to  develop  &  deploy  microservices   •  Built-­‐in  Metrics  &  Analy)cs  APIs  with  out  of  the  box  integra)on  with  WSO2   Data  Analy)cs  Server  (DAS)   •  To  be  used  in  the  WSO2  pla]orm  as  a  way  of  replacing  all  admin  services  as   well  as  defining  other  microservices  for  inter-­‐component  interac)ons  
  • 8.
     Microservices  Server  ImplementaGon   •  Based  on  the  new  Carbon  5.0  kernel   •  Transport  is  based  on  NeEy  4.0   •  Supports  streaming   •  Close  to  10x  faster  than  CXF  based  JAXRS  implementa)on  used  in   WSO2  AppServer   •  5MB  pack  size   •  Starts  within  300ms   •  ~25MB  memory  consump)on  for  the  MSS  framework  
  • 9.
    Download   •  MSS  1.0.0-­‐alpha  release  is  available  at   hEps://github.com/wso2/product-­‐mss/releases   •  Refer  to  the  gecng  started  guide  in  GitHub   •  A  good  place  to  start  is  the  samples   –  hEps://github.com/wso2/product-­‐mss/tree/v1.0.0-­‐alpha/samples  
  • 10.
    Core  Features  in  MSS   •  Quick  &  simple  development  model  using  simple  annota)ons   •  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  genera)ng  microservices  projects   star)ng  from  a  Swagger  API  defini)on   •  Comprehensive  samples  demonstra)ng  how  to  develop  microservices   applica)on  
  • 11.
     MSS  –  Flow  &  Thread  Model  
  • 12.
     MSS  -­‐  Performance  Comparison   Throughput  
  • 13.
     MSS  -­‐  Memory  ConsumpGon  Comparison   Memory  Consump1on  (MB)  
  • 14.
    Developer  Experience  &     Programming  Model  
  • 15.
  • 16.
  • 17.
  • 18.
    Build  it!   mvn  clean  install  
  • 19.
    Run  it!   java  –jar  stockquote-­‐*.jar  
  • 20.
    Tooling  (Swagger  -­‐>  Code)   Swagger  API   Defini)on   MSS  Code   1 2 3
  • 21.
  • 22.
    AnalyGcs  &  Monitoring   •  Supports  annota)ons   – Timed  –  measures  execu)on  )me   – Metered  –  measures  rate  of  events   – Counted  –  Counts  the  total  invoca)ons   – HTTPMonitoring  –  monitors  HTTP  requests  
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
    Security   •  Security  is  done  via  a  central  server  issuing  JWT   tokens     •  The  JWTSecurityInterceptor  verifies    the   signature,  expiry  &  claims  in  the  tokens  
  • 29.
  • 30.
    •  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  RunGme  
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
    Pet  Store  Sample  -­‐  admin  
  • 38.
    Pet  Store  Sample  -­‐  store  
  • 39.
    Pet  Store  Sample   Pet   Transac)on   Redis   Security   File   server   Admin  FE   Store  FE   DAS   Service  calls   Data  Publishing  
  • 40.
    Pet  Store  Sample  –  deployment  view   Store   FE  Store   FE   Store   FE   Admin   FE   Kubernetes  Node  1   Kubernetes  Node  2   Security   Security   File  server   File  server   Redis   Sen)nel   Redis   Sen)nel   Redis   Master   Redis   Slave   Pet   Pet   Transac)on   Transac)on   Transac)on   pods   pods   pods   pods   pods   pods   pods   pods   pods   pods   pods   pods   pods   pods   pods   S A S T R P F Kubernetes  Services  
  • 41.
    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)  
  • 42.
    Code   • NeEy  based  transport   hEps://github.com/wso2/carbon-­‐transports   • MSS  hEps://github.com/wso2/product-­‐mss              
  • 43.
    Recap   •  A  brief  look  at  Microservices  Architecture  (MSA)   •  WSO2  Microservices  Server   –  Development  model  &  programming  model   –  Deployment  model   –  Tooling   –  Comparison  with  other  frameworks  out  there  
  • 44.