Understanding Communication Patterns in Microservices Technology
Exploring synchronous and asynchronous communication in microservices, emphasizing the client-to-service communication models, the use of HTTP verbs, and considerations for network performance and security. The content delves into the intricacies of request-response communication, remote procedure calls, and the role of open communication protocols like REST for effective microservices architecture.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Module Overview Communication Hosting Platforms Observable Microservices Performance AutomationTools
Communication Synchronous | Asynchronous
Communication: Synchronous Request response communication Clientto service Service to service Service to external Remote procedure call Sensitive to change HTTP Work across the internet 1.Makecall 2. Wait 1.Instructionreceived 2.Do somework 3.Respond Firewall friendly 3.Responsereceived REST CRUD using HTTP verbs ServiceOne ServiceTwo Natural decoupling Open communication protocol REST with HATEOS Synchronous issues Both parties have to be available Performance subject to network quality Clientsmust know location of service (host\port)
Communication: Synchronous Request response communication Clientto service Service to service Service to external Remote procedure call Sensitive to change HTTP 1. Make call 2. Wait 3. Respons e 1.Instruction received 2.Do somework 3.Respond Work across the internet RPC Firewall friendly REST CRUD using HTTP verbs ServiceOne received ServiceTwo Natural decoupling Open communication protocol REST with HATEOS Synchronous issues Both parties have to be available Performance subject to network quality Clientsmust know location of service (host\port)
Communication: Synchronous Request response communication Clientto service Service to service http://www.pluralsight.com Service to external Remote procedure call HTTP Sensitive to change HTTP WebBrowser PluralsightWebsite Work across the internet Firewall friendly REST 1.Makecall 2. Wait 1. Instruction received 2. Do somework 3.Respond CRUD using HTTP verbs HTTP Natural decoupling 3.Responsereceived Open communication protocol REST with HATEOS ServiceOne ServiceTwo Synchronous issues Both parties have to be available Performance subject to network quality Clientsmust know location of service (host\port)
Communication: Synchronous Request response communication Clientto service Service to service Service to external Remote procedure call HTTPVerbs: POST PUT GET DELETE Sensitive to change HTTP Work across the internet 1.Makecall 2. Wait http://Service/Account/23 Firewall friendly JSON/XML REST 3.Responsereceived CRUD using HTTP verbs Natural decoupling ServiceOne ServiceTwo Open communication protocol REST with HATEOS Synchronous issues Both parties have to be available Performance subject to network quality Clientsmust know location of service (host\port)
Communication: Asynchronous Event based Mitigates the need of client and service availability Accounts Service Decouples client and service Message queueing protocol Shopping website Promotions Service Message Brokers Subscriber and publisher are decoupled Microsoft message queuing (MSMQ) Orders Service RabbitMQ ATOM (HTTP to propagate events) PlaceOrder Asynchronous challenge Internal Support website Inventory Service Complicated Reliance on message broker Client Visibility of the transaction Products Service Managing the messaging queue Real world systems API Message Broker Internet Gateway Would use both synchronous and asynchronous
Hosting Platforms Virtualization | Containers | Self Hosting | Registry andDiscovery
Hosting Platforms:Virtualization A virtual machine as a host Foundation of cloud platforms Platform as a service (PAAS) Microsoft Azure Amazon web services ServiceOne Your own cloud (for example vSphere) VM VM Could be more efficient VM Takes time to setup Host Takes time to load ServiceTwo Take quite a bit of resource Unique features Take snapshot Clone instances ServiceThree Standardised and mature
Hosting Platforms:Containers Type of virtualization Isolate services from each other Single service per container Different to a virtual machine Use less resource thanVM Faster thanVM ServiceOne Quicker to create new instances Container Future of hosted apps Container Cloud platform support growing Container Mainly Linux based Host Not as established as virtual machines ServiceTwo Not standardised Limited features and tooling Infrastructure support in its infancy Complex to setup Examples Docker ServiceThree Rocker Glassware
Hosting Platforms: SelfHosting Implement your own cloud V I irtualization platform mplement containers Use of physical machines Single service on a server Multiple services on a server Challenges Long-term maintenance Need for technicians Training Need for space Scaling is not as immediate
Hosting Platforms: Registration andDiscovery Where? Host,port and version Service registry database Accounts Service Shopping website Register on startup Promotions Service Deregister service on failure Orders Service Cloud platforms make it easy Account Orders Internal Support website Local platform registration options Inventory Service Offers Basket Self registration Products Service Third-party registration Client Local platform discovery options API Internet Gateway Client-side discovery Server-side discovery
Observable Microservices Monitoring Tech | LoggingTech
Observable Microservices: MonitoringTech Centralised tools Nagios PRTG Load balancers New Relic Central Monitoring Desired features Metrics across servers Automatic or minimal configuration Client libraries to send metrics Test transactions support Alerting Network monitoring Standardise monitoring Central tool Preconfigured virtual machines or containers Real-time monitoring
Observable Microservices Monitoring Tech | LoggingTech
Observable Microservices: LoggingTech Portal for centralised logging data Elastic log Log stash Splunk Kibana Graphite Client logging libraries Serilog and many more Desired features Structured logging Logging across servers Automatic or minimal configuration Correlation\Context ID for transactions Standardise logging Central Logging Central tool Template for client library
Microservices Performance Scaling | Caching | APIGateway
Microservices Performance:Scaling How Creating multiple instances of service 1 1 11 Adding resource to existing service Automated or on-demand 4 PAAS auto scaling options 2 5 Virtualization and containers 3 Physical host servers 666 Load balancers 9 API Gateway 7 When to scale up 10 Performance issues 8 Monitoring data Capacity planning
Microservices Performance:Caching Caching to reduce Client calls to services Service calls to databases Service to service calls Accounts Service API Gateway\Proxy level Client side Service level API Gateway /Proxy Server Considerations Simple to setup and manage Data leaks
Microservices Performance Scaling | Caching | APIGateway
Microservices Performance: APIGateway Help with performance Load balancing Caching Accounts Service Help with Shopping website Creating central entry point Promotions Service Exposing services to clients One interface to many services Orders Service Account Orders Dynamic location of services Internal Support website Routing to specific instance of service Inventory Service Offers Basket Service registry database Products Service Security Client API Gateway API Internet Gateway Dedicated security service Central security vs service level
Microservices Performance: APIGateway Help with performance Load balancing Caching Security Service? Help with Shopping website Creating central entry point Promotions Service Exposing services to clients One interface to many services Orders Service Account Orders Dynamic location of services Internal Support website Inventory Service Routing to specific instance of service Offers Basket Service registry database Products Service Security Client API Gateway API Internet Gateway withSecurity? Dedicated security service Central security vs service level
AutomationTools Continuous Integration | ContinuousDeployment
Automation Tools: ContinuousIntegration Many CI tools Team Foundation Server TeamCity Many more! Desired features Cross platform X Windows builders,Java builders and others Source control integration Notifications IDE Integration (optional) Map a microservice to a CI build Code change triggers build of specific service Feedback just received on thatservice Builds and tests run quicker Separate code repository for service X End product is in one place CI builds to testdatabase changes Both microservice build and database upgrade are ready Avoid one CI build for all services
Automation Tools: ContinuousDeployment Many CD tools Aim for cross platform tools Accounts Service Desired features Server1 Central control panel GO Orders Service Simple to add deployment targets Support for scripting Continous Deployment Tool Server2 Support for build statuses Products Service Integration with CI tool Support for multiple environments Support for PAAS Server3
Module Summary Communication Synchronous Asynchronous Hosting Platforms Virtualization Containers Self Hosting Registry and Discovery Observable Microservices Monitoring Tech Logging Tech Performance Scaling Caching API Gateway AutomationTools Continuous Integration Continuous Deployment