@ prparekh83
SOFTWARE ENGINEER
Components of a Distributed System PRATEEK PAREKH SOFTWARE ENGINEER - - PowerPoint PPT Presentation
Components of a Distributed System PRATEEK PAREKH SOFTWARE ENGINEER @ prparekh83 t h s Building the Front-end Layer Module Overview Handling Business logic with Web Services Understanding the Data Layer Asynchronous Processing Building
@ prparekh83
SOFTWARE ENGINEER
t h s
Front end servers
Customer Load Balancer Search Servers CDN Message Queue Servers Database servers
Batch job Servers
Back end servers
Cache Servers Internet DNS
User Session
Memory Local files Resource Locks
s h s
State Management
Client Server GET /home.html Set-cookie:SID=EMPTY Response header Set-cookie:SID=abc… GET /forum.html Cookie:SID=abc… Response with HTML content
s h s
State Management
Client Server GET /home.html Set-cookie:SID=EMPTY Response header Set-cookie:SID=abc… GET /forum.html Cookie:SID=abc… Response with HTML content save session success fetch/save session success Redis
DNS - Domain Name System (eg. Route 53, easydns.com)
CDN - Content Delivery Network (eg. Akamai, Amazon CloudFront) Load Balancer (eg. Elastic Load Balancer, HAProxy, Nginx) Caching (eg. Browser, Redis/Memcached)
EC2 Front end servers cluster
Customer Elastic Load Balancer (ELB) Cloudfront CDN Public S3 buckets Route 53 DNS HTTP requests static files dynamic content distribute requests Backend servers instance 1 instance n Amazon Auto Scale Amazon CloudWatch Service Private S3 buckets
Front end servers
Customer Load Balancer Search Servers CDN Message Queue Servers Database servers
Batch job Servers
Back end servers
Cache Servers Internet DNS
Functional partition Front end servers Account Service Load balancer Catalog Service MySQL database Cassandra database Mobile client Partner Integration
HTTP GET Request: URL http://globomantics.com/order/123456
{ “OrderID”: “123456”, “Date”: “09/12/2020”, “Status”: “Delivered” }
s h s
Easy Maintenance
Zero downtime update of services Isolate Server Failures
Servers routinely ping load balancer
Load Balancers
Between clients and backend servers Stateless Servers
Scale by adding replica servers (AutoScale)
No Shared Store
Use Cache, Database and MessageQueues
Implementing an operation consisting of a set of web service calls that should either fail or pass?
Client charge ship rollback
Response HTTP PUT Request Create Order
Synchronize state between 2 servers (master and slave) Scale read throughput and provide higher availability Each server holds an identical copy of data
Master Slaves
write read sync sync client
s h s
Divide dataset into smaller chunks Each server processes only a subset of data Isolate failure of servers from each other
Server 1 Server 10
UserID 113321 Sharding Function Input
s h s
System is functional even when servers cannot communicate
Server can process requests even when
All servers see the same data
MongoDB Stores data as BSON documents Single Master-Slave configuration Server shutdown during partition
Cassandra Wide column database Masterless configuration Server remains available
Browser fetch return
load page Load Item Page blocking data unblock
Client emits events. Subscribers react independently
Register a callback to be notified when the
Caller doesn’t care if the operation completes or not
Mobile charge payment approved
Order Confirmation Email Checkout Cart Place Order Thanks for your Order callback async
s h s
<?xml version=“1.0”> <message> <invoice date=“01-15-2020” id=“321332”> <item>1234432321</item> <title>A Brief History of Nearly Everything – Bill Bryson</title> <USPrice>12.99</USPrice> . . .
Serves as the contract between Producers and Consumers
s h s
s h s
Work Queue Consumer 1 Consumer N
Batch Servers Producer 1 Producer N Backend Servers Item Listed Create Thumbnail
Front end servers
Customer Load Balancer Search Servers CDN Message Queue Servers Database servers
Batch job Servers
Back end servers
Cache Servers Internet DNS
t h s