wso2con eu 2016: understanding microservice architecture

Download WSO2Con EU 2016: Understanding Microservice Architecture

Post on 08-Jan-2017

216 views

Category:

Technology

1 download

Embed Size (px)

TRANSCRIPT

  • UnderstandingMicroserviceArchitecture

    KasunIndrasiriDirector,Integra.onTechnologiesWSO2

  • Microservices?

    *

  • MonolithicArchitecture

  • MonolithicArchitecture

    Allfunc.onali.esareimplemented/deployedintoasinglesoBwareapplica.on.

    EnterprisesoBwareapplica.ons-ERPs,CRMsetc. SOA/webservices:'coarse-grained'services,broadscope,

    mammothserviceswithseveraldozensofopera.onsandcomplexmessageformats

  • MonolithicArchitecture

    Usecase:OnlineRetailsoBwareapplica.onwhichcomprisesofmul.plebusinessfunc.onali.es.

    JVM

  • MonolithicArchitecture

    Developedanddeployedasasingleunit. Overwhelminglycomplex;whichleadstonightmaresin

    maintaining,upgradingandaddingnewfeatures. Redeploytheen>reapplica>on,inordertoupdateapartofit. Scaling:scaledasasingleapplica>onanddifficulttoscalewith

    conflic>ngresourcerequirementswholeapplica>ondown Reliability-Oneunstableservicecanbringthe. Hardtoinnovate,prac>ceagiledevelopmentanddelivery

    methodologies

  • MicroservicesArchitecture

  • MicroservicesArchitecture

    Thefounda.onofmicroservicesarchitecture(MSA)isaboutdevelopingasingleapplica.onasasuiteoffine-grainedandindependentservicesthatarerunninginitsownprocess,developedanddeployedindependently.

    Itismorethanjustsegrega.ngtheservicesinamonolith

  • MicroservicesArchitecture

    Usecase:Onlineretailapplica.oncanbeimplementedwithasuiteofmicroservices

    JVM

    JVM

    JVM

    JVM

  • DesigningMicroservices:Size,scopeandcapabili.es

    CommonMisconcep.ons LinesofCode Teamsize 'Micro'isabitmisleadingterm Usewebservicesandrebrandingthemasmicroservices

  • DesigningMicroservices:Size,scopeandcapabili.es

    CommonMisconcep.ons LinesofCode Teamsize 'Micro'isabitmisleadingterm Usewebservicesandrebrandingthemasmicroservices

  • DesigningMicroservices:Size,scopeandcapabili.es

    SingleResponsibilityPrinciple(SRP):Havingalimitedandafocusedbusinessscope.

    Scope Findtheserviceboundariesandalignthemwiththebusiness

    capabili.es(akaDDD) Focusonscopeofthemicroservice. Itsnotaboutmakingservicessmall

    Agileandindependentdevelopmentanddeploymentoftheservice. Microserviceshouldhaveaveryfewopera.ons/func.onali.esand

    simplemessageformat.

  • MessaginginMicroservices

    InMonolithicarchitecture: Func.oncallsorlanguage-levelmethodcalls SOA/webservices:SOAPandWS*withHTTP,JMSetc. Webserviceswithseveraldozensofopera.onsandcomplex

    messageschemas InMicroservicesarchitecture:

    Simpleandlightweightmessagingmechanism.

  • MessaginginMicroservices

    SynchronousMessaging Clientexpectsa.melyresponsefromtheserviceandwaits.llitgetit. REST,ThriB

  • MessaginginMicroservices

    AsynchronousMessaging Clientdoesn'texpectsaresponseimmediately,ornotacceptsaresponseatall AMQP,STOMP,MQTT

    MessageFormats JSON,XML,ThriB,ProtoBuf,Avro

    ServiceContracts Definingtheserviceinterfaces-Swagger,RAML,ThriBIDL

  • DataManagement

    Monolithicapplica.onsuseacentralizeddatabase

  • DataManagement

    Monolithicapplica.onsuseacentralizeddatabase

  • DataManagement

    DecentralizedDatamanagementwithMicroservices Eachmicroservicecanhaveaprivatedatabasetopersistthedatathat

    requirestoimplementthebusinessfunc.onalityofferedfromit. Canonlyaccessthededicatedprivatedatabasebutnotthedatabases

    ofothermicroservices. Youmighthavetoupdateseveraldatabaseforasingletransac.on.In

    suchscenarios,thedatabasesofothermicroservicesshouldbeupdatedthroughitsserviceAPIonly.

  • DecentralizedGovernance

    Governanceestablishingandenforcinghowpeopleandsolu.onsworktogethertoachieveorganiza.onalobjec.ves,run.me/design.me.

    InMSA: Nocentralizeddesign-.megovernance. Maketheirowndecisionsaboutitsdesignandimplementa.on. Fosterthesharingofcommon/reusableservices. Run-.megovernanceaspectssuchasSLAs,throgling,monitoring,

    commonsecurityrequirementsandservicediscoverymaybeimplementedatAPI-GWlevel.

  • ServiceRegistryandServiceDiscovery

    ServiceRegistry Holdsthemicroservicesinstancesandtheirloca.ons

    ServiceDiscovery findtheavailablemicroservicesandtheirloca.on

  • ServiceDiscovery

    Client-sideDiscovery

  • ServiceDiscovery

    Server-sideDiscovery

  • MicroservicesDeployment

    Abilitytodeploy/un-deployindependentlyofothermicroservices. Mustbeabletoscaleateachmicroserviceslevel. Buildinganddeployingmicroservicesquickly. Failureinonemicroservicemustnotaffectanyoftheother

    services.

  • MicroservicesDeployment

    Docker Dockerisbecominganextremelypopularwayofpackagingand

    deployingservices. Packagethemicroserviceasa(Docker)containerimage. Deployeachserviceinstanceasacontainer. Scalingisdonebasedonchangingthenumberofcontainerinstances. Building,deployingandstar.ngmicroserviceswillbemuchfasteras

    weareusingDockercontainers

  • MicroservicesDeployment

    Kubernetes ExtendingDockercapabili.esbyallowingtomanageaclusterofLinux

    containersasasinglesystem,managingandrunningDockercontainersacrossmul.plehosts,offeringco-loca.onofcontainers,servicediscoveryandreplica.oncontrol.

  • MicroservicesDeployment

    Usecase:ThemicroservicesofOnlineRetailsoBwareapplica.onwithcanbedeployedandscaledwithDockerandKubernetes.

  • Security

    SecurityinMonolithicapplica.ons 'whoisthecaller','whatcanthecallerdo'and'howdowepropagate

    thatinforma>on Implementedatacommonsecuritycomponentwhichisatthe

    beginningoftherequesthandlingchainandthatcomponentpopulatestherequiredinforma.onwiththeuseofanunderlyinguserrepository

  • Security

    SecurityinMicroservices Asecuritycomponenthastobeimplementedateachmicroservices

    levelthatusesacentraluserrepository/store.Notscalable! LeveragethewidelyusedAPI-SecuritystandardssuchasOAuth2and

    OpenIDConnect(OIDC)

    OAuth2.0AccessToken:ByReference OIDCJWT:ByValue

  • Security

    MicroservicesecuritywithOAuth2andOpenIDConnect

  • Orchestra.ngMicroservices

    NoESBinMSA.Thenhow?

  • Orchestra.ngMicroservices

    Point-to-pointstyle-Invokingservicesdirectly Spaghejintegra.onan.-pagern?

  • Orchestra.ngMicroservices

    Orchestra.onattheGatewayLayer

  • Orchestra.ngMicroservices

    Orchestra.onatMicroservicesLayer

  • MicroservicesinModernEnterprises InnerandOuterArchitecture

    InnerArchitecture:Thepuremicroservicescomponentswhichislesscomplexarecategorizedunder'InnerArchitecture'

    OuterArchitecture:Thisdeliverstheplakormcapabili.esthatarerequiredtobuildasolu.onaroundthemicroservicesthatwebuild.

  • MicroservicesinModernEnterprises

    MicroIntegra.ons

  • WSO2MSF4J Alightweight,highperformanceframeworkforbuilding

    microservicesinJava. AgendSameerastalkonApp-Devtrack.

  • Conclusion

    Microservicesisnotapanacea:Itwon'tsolveallyourenterpriseITneeds.

    SOAdoneright! Mostenterprisewon'tbeabletoconverttheiren.reenterpriseIT

    systemstomicroservices. EnterpriseIntegra.onnevergoesaway. MicroservicesareexposedasAPIs. Interac.onbetweenmicroservicesshouldbesupportviaa

    lightweightorchestra.onengineorinsideanothermicroservice.

  • Reference

    hgp://kasunpanorama.blogspot.co.uk/2015/11/microservices-in-prac.ce.html

    hgp://microservices.io/pagerns/microservices.html

  • ThankYou!

    #WSO2ConEU

    Shareyourfeedbackforthissessionwso2con.com/app