Communications Cloud 1 Microservices in Practice From Basics
Communications Cloud 1
Microservices in Practice From Basics to Deployment Communications Cloud 2
Our Talk Today • • • What is Microservice Architecture? Monolith vs Microservices Service Discovery API Gateway Deployment Example Communications Cloud 3
Microservice Architecture Characteristics • • Independent processes Relatively small, fast, easy to understand Independently developed and deployed Organized around business capabilities Decentralized data management Polyglot programming and persistence Built and released with automated processes Benefits • • Modular structure Independent Deployment Technology Diversity Scalability Communications Cloud Drawbacks • Distribution • Operational Complexity • Memory consumption 4
Anatomy of a Microservice Aspects that define a Microservice • Isolation and Autonomy • Easier to scale, fully decoupled from one other • Developed and evolve independently • Single Responsibility • Persistence • Communication • Interaction Styles – – • Synchronous: REST, Thrift Asynchronous: AMQP or STOMP One‑to‑one: Request / (Async)Response, Notification One‑to‑many: Publish / Subscribe, Publish / Async Responses Orchestration vs Choreography • Granularity • Business function, Performance, Message size, Transactionality Communications Cloud 5
Monolith vs Microservices Monolithic systems • Tend to have strong coupling between the components • Difficult to understand, test, maintain, evolve, upgrade and operate Refactoring Strategies • “Big Bang” Rewrite • Refactor gradually Adopting Microservices • Stop adding features to the monolith • Access the monolith’s data • API, Database, Synchronization • Split the Application Layers • Extract Services • Components that are easy to extract • Components that change frequently • Resource requirements Communications Cloud 6
Service Discovery Patterns • Service Registry • Database containing the network locations of service instances • Highly available and up to date • Cluster of servers that use a replication protocol to maintain consistency • Client-Side Discovery • Intelligent, application‑specific load‑balancing • Couples the client with the service registry • Server-Side Discovery • Decouples the client from service registry • Requires setup and maintenance • Service Registration • Self‑Registration • Third‑Party Registration Communications Cloud 7
API Gateway Client Communication • Direct Client-to-Microservice • Networking limitations • Microservices might use protocols that are not web-friendly • Difficult to refactor the microservices • Using an API Gateway • Encapsulates the internal system architecture • Mainly responsible for request routing, composition, and protocol translation • Can also provide each client with a custom API • Can handle failures by returning cached or default data • There is a risk that the API Gateway becomes a development bottleneck Communications Cloud 8
Deployment • Microservices application • Consists of tens or even hundreds of microservices • Microservices are written in a variety of languages and frameworks • Microservices have specific deployment, resource, scaling, and monitoring requirements. • Deployment Strategies • Multiple Service Instances per Host – – • Service Instance per Host – – • Service instance per process Multiple service instances in the same process or process group Service Instance per Virtual Machine Service Instance per Container Serverless Deployment (FAAS – Function as a Service, AWS Lambda) – – Supports Java, Node. js, and Python services Automatically scales, no deployment, no maintenance Not intended to be used to deploy long running functions Lambda functions are stateless, requests must complete within 300 seconds Communications Cloud 9
Example Communications Cloud 10
Thank You Communications Cloud 11
- Slides: 11