Building Real World Node.JS Microservices on Azure

来自微软的工程师介绍基于微软云计算平台Azure,来构建Node.js应用微服务最佳实践。先介绍了什么是微服务,然后介绍了Azure的Container Service和Service Fabric。

1.Building Real World Node.JS Microservices on Azure James Truitt Microsoft Software Engineer https:// /in/ jamesptruitt @ auburnjames

2.Agenda Principles of Microservices Azure Container Service Azure Service Fabric Demo



5.Definition A microservices architecture consists of a collection of small, autonomous services. Each service is self-contained and should implement a single business capability.

6.Definition A microservices architecture consists of a collection of small, autonomous services. Each service is self-contained and should implement a single business capability.

7.Microservices Overview

8.Other Components in a Typical Microservices Architecture Management Service Discovery API Gateway

9.Microservices Management Options in Azure Azure Container Service (AKS)   Service Fabric

10.Azure Container Service Orchestration & Microservices

11.Provisioning of DC/OS, Docker, and Kubernetes Standard Docker tooling and API support Linux and Windows Server containers Billed for the compute resource used   Swarm DC/OS Kubernetes Azure Container Service Linux: GA Windows: Preview

12.Azure Container Service Containers Windows Server Linux Orchestrator (Docker Swarm, DC/OS, Kubernetes ) Container Tooling e.g. Docker CLI Azure Stack Azure VMs and VM Scale Sets Service Tooling e.g. ARM Template

13.AKS: Managed Kubernetes Azure-hosted control plane No master nodes to manage or pay for Automated upgrades and patching Easily upgrade control plane and worker nodes to new versions of Kubernetes Scale agent pool to increase or decrease capacity Linux: Preview Windows: Not yet

14.Service Fabric Orchestration, microservices, programming models

15.Cosmos DB Billions transactions/day Services Powered by Service Fabric SQL Database 2.1 million DBs Cortana Power BI Event Hubs 60 bn events/day IoT Hub M illions of messages Skype Intune Dynamics Windows: GA Linux: Preview

16.Azure Other Clouds On Premise Lifecycle Management Orchestration Auto scaling Always On Availability Dev & Ops Tooling Programming Models Azure Service Fabric Any OS, Any Cloud Dev Box Health & Monitoring

17.Service Fabric Programming Models & CI/CD Other Clouds Lifecycle Management Auto scaling Visual Studio & VSTS Jenkins & Eclipse Diagnostics & Monitoring AppInsights OMS ELK Azure Always On Availability Dev & Ops Tooling Programming Models Health & Monitoring Dev Box Orchestration On Premise Guest Executables Reliable Services Reliable Actors .NET Core/Full .NET/Java Containers Lifecycle Management Auto scaling

18.Advantages of Using an API gateway It decouples clients from services. Services can be versioned or refactored without needing to update all of the clients. Services can use messaging protocols that are not web friendly, such as AMQP. The API Gateway can perform other cross-cutting functions such as authentication, logging, SSL termination, and load balancing.

19.When to use this architecture Large applications that require a high release velocity. Complex applications that need to be highly scalable. Applications with rich domains or many subdomains. An organization that consists of small development teams.

20.Benefits Independent deployments Independent development Small, focused teams Fault isolation Mixed technology stacks Granular scaling

21.Challenges Complexity Development and test Lack of governance Network congestion and latency Data integrity Management Versioning Skillset

22.Best Practices Model services around the business domain. Decentralize everything Data storage should be private to the service that owns the data Services communicate through well-designed APIs Avoid coupling between services Offload cross-cutting concerns, such as authentication and SSL termination, to the gateway. Keep domain knowledge out of the gateway Services should have loose coupling and high functional cohesion Isolate failures


24.Additional resources: service overviews Microsoft Docs - Documentation for container related services MSDN Channel 9 – Videos covering Azure and Containers Microsoft Virtual academy – online training courses