Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Azure and Microservices

Daron Yondem
November 17, 2016

Azure and Microservices

This talk is about implementing Microservices with Service Fabric on Microsoft Azure.

Daron Yondem

November 17, 2016
Tweet

More Decks by Daron Yondem

Other Decks in Programming

Transcript

  1. View Slide

  2. View Slide

  3. View Slide

  4. View Slide

  5. View Slide

  6. View Slide

  7. View Slide

  8. • Are generally developed by a small cross-functional team

    View Slide

  9. • Are generally developed by a small cross-functional team

    View Slide

  10. • Scales by cloning the
    app on multiple
    machines
    Monolithic application Microservices application
    • Scales by deploying
    each service
    independently
    App 1 App 2
    App 1

    View Slide

  11. Application design
    Traditional application
    Application
    Component
    Library 1
    API UI
    Data Access
    Component
    Library 2
    Component
    Library 3
    • Compile-time contract validation
    • Local operations
    • Easier to reason about
    • Expensive to scale application
    • Hard to scale data access
    • Upgrades are long and costly

    View Slide

  12. Application design
    Application composed of services
    • Cheaper to scale application
    • Easier to scale data access
    • Upgrade continuously
    • Runtime contract validation
    • Network operations
    • Harder to reason about

    View Slide

  13. Thumbnail
    Service
    Thumbnail
    Service
    Photo Share
    Service
    Photo Share
    Service
    Photo Share
    Service
    Photo Share
    Service
    Thumbnail
    Service
    Photo Share Service
    Thumbnail
    SharedLib-v7
    Photo Share
    Service
    SharedLib-v1
    Photo Share
    Service
    node.js
    Thumbnail
    Service
    .NET
    Photo Share
    Service
    V1
    Thumbnail
    Service
    V1
    Thumbnail
    Service
    SharedLib-v7
    Thumbnail
    Service
    V2
    SharedLib-v1

    View Slide

  14. IntelliSense, refactoring & compile-time type-safety)

    View Slide

  15. View Slide

  16. View Slide

  17. Azure Other Clouds
    On Premise
    Data centers
    Azure Service Fabric
    Dev Box
    Service Fabric for
    Windows Server
    GA
    Service Fabric
    preview for Linux

    View Slide

  18. Azure Other Clouds
    Azure Service Fabric microservices
    Dev Box On Premise
    Data centers

    View Slide

  19. Azure Cloud Services
    (Web & Worker Roles)
    Azure Service Fabric
    (Microservices)
    • 1 service instance per VM
    • Slow deployment & upgrades
    • Slow scaling of roles up/down
    • Emulator for development
    • Many microservices per machine/VM
    • Fast deployment & upgrades
    • Fast scaling of microservices up/down
    • Single machine cluster for development
    Cloud Services vs Service Fabric

    View Slide

  20. Cloud Services Deployment
    Web Application
    Web role Web role
    Worker Application
    Worker role Worker role Worker role Worker role Worker role
    Storage queue
    Service Bus
    Azure cache
    Redis
    Azure load
    balancer
    Operational
    Insights
    Table Storage
    Azure SQL
    database
    Blob Storage

    View Slide

  21. Storage queue
    Table Storage
    Service Bus
    Azure SQL
    database
    Azure cache
    Redis
    Azure load
    balancer
    Node
    Service
    Fabric cluster
    Node
    Stateless Worker
    Service
    Node
    Node Node
    Stateless Web
    Service
    Stateless Worker
    Service
    Stateless Worker
    Service
    Stateless Worker
    Service
    Stateless Web
    Service
    Stateless Worker
    Service
    Operational
    Insights
    Blob Storage

    View Slide

  22. Node
    Node
    Node
    Node
    Node
    Node

    View Slide

  23. Datacenter (Azure, On-Premises, Amazon)
    Load
    Balancer
    PC/VM #1
    Service Fabric
    Your code, etc.
    PC/VM #2
    Service Fabric
    Your code, etc. PC/VM #3
    Service Fabric
    Your code, etc.
    PC/VM #4
    Service Fabric
    Your code, etc.
    PC/VM #5
    Service Fabric
    Your code, etc.
    Your code, etc.
    (Port: 19080)
    Web Request
    (Port: 80/443/?)
    Cluster supports 1,000s of nodes
    is self repairing, and scales-in
    and out

    View Slide

  24. Load
    Balancer
    Web Site Svc
    (1+ instances)
    Internal Svc #1
    (1+ instances)
    Internal Svc #2
    (1+ instances)
    Service Registry
    IS #1-1  http://...
    IS #1-?  http://...
    IS #2-1  http://...
    IS #2-?  http://...

    View Slide

  25. in Service Fabric
    Service Type
    - defines the service, like a class
    Named Service Instance
    - a deployment of the service type, like an object

    View Slide








  26. ServiceHost.exe






    View Slide

  27. View Slide

  28. fabric:/app
    Yo, Service Fabric, I need
    3 new Job Runner services!
    fabric:/app/job1
    fabric:/app/job2
    fabric:/app/job3
    MyApp Type 4.0.0
    Web Service Type
    1.0.0
    User Service Type
    1.5.0
    Session Service Type
    1.2.0
    Authentication Service Type
    3.1.4
    Job Runner Service Type
    1.2.0
    fabric:/app/users
    fabric:/app/sessions fabric:/app/auth
    fabric:/app/job1
    fabric:/app/job2
    fabric:/app/job3
    Service
    Fabric
    fabric:/app/web
    Registered service types Deployed named service instances

    View Slide

  29. • Guest executables and guest containers
    • Stateless Services
    • Stateful Services
    Categories of services

    View Slide

  30. Queues Storage
    Stateless Services Pattern
    Front End
    (Stateless
    Web)
    Stateless
    Middle-tier
    Compute
    Cache
    • Scale stateless services
    backed by partitioned
    storage
    • Increase reliability and
    ordering with queues
    • Reduce read latency with
    caches
    • Manage your own
    transactions for state
    consistency
    • More moving parts each
    managed differently
    Load Balancer

    View Slide

  31. Stateful
    Middle-tier
    Compute
    Stateful Services Pattern
    Simplify design, reduce latency
    Front End
    (Stateless
    Web)
    • Application state lives in
    the compute tier
    • Low Latency reads and
    writes
    • Partitions are first class at
    the service layer for scale-
    out
    • Built in transactions
    • Fewer moving parts
    • External stores for exhaust
    and offline analytics
    Load Balancer
    Cold Data Stores
    For Exhaust
    (Optional)

    View Slide

  32. • State: Single monolithic database
    • Tiers of specific technologies
    • Graph of interconnected services
    • State typically scoped to the service
    • Variety of technologies used
    stateless
    services
    stateless services with
    separate stores
    stateful
    services
    stateless
    presentation
    services
    Monolithic application Microservices application

    View Slide

  33. View Slide

  34. View Slide

  35. View Slide

  36. Node 5
    Node 4
    Node 3 Node 6
    Node 2
    Node 1
    P2
    S
    S
    S
    P4
    S
    P1
    S
    P3
    S
    S
    S
    • Services can be partitioned for scale-out.
    • You can choose your own partitioning scheme.
    • Service partitions are striped across machines in the cluster.
    • Replicas automatically scale out & in on cluster changes

    View Slide

  37. View Slide

  38. View Slide

  39. Service Fabric is a Container Orchestrator
    • Service Fabric doesn’t care what your workload is
    • Service Fabric performs the placement and failover of
    containers in the cluster
    • Service Fabric works everywhere – same primitives
    • Docker containers on Linux
    • Windows containers on Windows
    • Guest Exes and/or Service Fabric Services can exist inside
    the container
    • A container can register endpoints with Service Fabric for
    discoverability & communication

    View Slide

  40. Web gateway
    REST/Websockets
    API Management
    IoT Hub
    Event Hub
    Load
    Balancer

    View Slide

  41. Reference Solutions: IoT
    Microsoft Azure
    Admin application
    Ingestion application
    Field
    gateway
    IoT Hub
    Device 1
    Device 2
    Device x
    Service Fabric
    Customer application 1
    Customer application 2
    Customer application m
    ...
    Storage (Azure)
    Service
    admin
    Create instances
    Send device data
    Create instances
    Cold storage data
    offload
    Device
    batch data
    Device
    batch data
    Customer
    User
    https://azure.microsoft.com/en-us/documentation/samples/service-fabric-dotnet-iot/

    View Slide

  42. View Slide

  43. 1000s of VMs
    Azure Core
    Infrastructure
    Services built with Service Fabric
    Billions of
    transactions per
    week
    Azure
    Document DB
    4 trillion requests
    each week
    Azure
    Event Hubs
    1.6 million DBs
    Azure
    SQL Database
    500 million
    evals/sec
    Bing Cortana
    1.1M devices
    Microsoft Intune
    … and more
    IoT Hub
    Skype for Business
    Power BI
    CRM Dynamics

    View Slide

  44.  Service Fabric developer SDK
     http://aka.ms/ServiceFabricSDK
     Docs Learning map and overview videos
     https://azure.microsoft.com/en-us/documentation/services/service-fabric/
     Service Fabric course and lab
     https://mva.microsoft.com/en-US/training-courses/building-microservices-applications-on-azure-
    service-fabric-16747
     Learn from samples, free clusters and labs
     http://aka.ms/ServiceFabricSamples
     http://aka.ms/tryservicefabric
     Lab: http://j.mp/2fYafCG
     Questions? Comments? Issues?
     https://stackoverflow.com/questions/tagged/azure-service-fabric
     http://aka.ms/ServiceFabricForum
     https://github.com/azure/service-fabric-issues

    View Slide

  45. View Slide