![Page 1: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/1.jpg)
Distributed Architectures & Microservices
CS 475, Spring 2018Concurrent & Distributed Systems
![Page 2: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/2.jpg)
GFS Architecture
![Page 3: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/3.jpg)
J. Bell GMU CS 475 Spring 2018
GFS Summary• Limitations:
• Master is a huge bottleneck • Recovery of master is slow
• Lots of success at Google • Performance isn't great for all apps • Consistency needs to be managed by apps • Replaced in 2010 by Google's Colossus system -
eliminates master
!3
![Page 4: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/4.jpg)
J. Bell GMU CS 475 Spring 2018
MapReduce: Divide & Conquer
!4
Combine
Result
r1 r2 r3 r4 r5
worker worker worker worker worker
w1 w2 w3 w4 w5
Partition
Big Data (lots of work)
![Page 5: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/5.jpg)
J. Bell GMU CS 475 Spring 2018
Hadoop + ZooKeeper
!5
DataNode DataNodeDataNode DataNode DataNodeDataNode
DataNode DataNodeDataNode DataNode DataNodeDataNode
DataNode DataNodeDataNode DataNode DataNodeDataNode
DataNode DataNodeDataNode DataNode DataNodeDataNode
NameNode
ZKClient
ZK Server ZK ServerZK Server
Primary Secondary
timeoutNotification that leader is
gone, secondary becomes primary
disconnected
Primary
NameNode
ZKClient
Secondary
![Page 6: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/6.jpg)
J. Bell GMU CS 475 Spring 2018
Hadoop + ZooKeeper
!6
DataNode DataNodeDataNode DataNode DataNodeDataNode
DataNode DataNodeDataNode DataNode DataNodeDataNode
DataNode DataNodeDataNode DataNode DataNodeDataNode
DataNode DataNodeDataNode DataNode DataNodeDataNode
NameNode
ZKClient
NameNode
ZKClient
Primary Secondary
ZK Server ZK ServerZK Server
Note - this is why ZK is helpful here: we can have the ZK servers partitioned *too* and still
tolerate it the same way
![Page 7: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/7.jpg)
J. Bell GMU CS 475 Spring 2018
Announcements• Form a team and get started on the project!
• http://jonbell.net/gmu-cs-475-spring-2018/final-project/
• AutoLab available soon • Today:
• Distributed system architectures
!7
![Page 8: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/8.jpg)
J. Bell GMU CS 475 Spring 2018
Distributed Systems Abstractions• Goal: find some way of making our distributed
system look like a single system • Never achievable in practice • BUT if we can come up with some model of how
the world might behave, we can come up with some generic solutions that work pretty well • And hopefully we can understand how they can
go wrong
!8
![Page 9: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/9.jpg)
J. Bell GMU CS 475 Spring 2018
Abstractions & Architectures• We can design architectures that embody some systems
model, providing some framework code to make it easier to get some task done
• Case study example: web architectures • Assumptions:
• “one” server, many clients • Synchronous communication • Client is unlikely to be partitioned from a subset of
servers; likely some subset of servers are partitioned from other servers
• Client is mostly stateless
!9
![Page 10: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/10.jpg)
J. Bell GMU CS 475 Spring 2018
The good old days of web apps
!10
HTTP RequestGET /myApplicationEndpoint HTTP/1.1 Host: cs.gmu.edu Accept: text/html
web server
HTTP ResponseHTTP/1.1 200 OKContent-Type: text/html; charset=UTF-8
<html><head>...
Runs a program
Web Server Application
My Application Backend
Give me /myApplicationEndpoint
Here’s some text to send back
Does whatever it wants
![Page 11: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/11.jpg)
J. Bell GMU CS 475 Spring 2018
Brief history of Backend Development
• In the beginning, you wrote whatever you wanted using whatever language you wanted and whatever framework you wanted
• Then… PHP and ASP • Languages “designed” for writing backends • Encouraged spaghetti code • A lot of the web was built on this
• A whole lot of other languages were also springing up in the 90’s… • Ruby, Python, JSP
!11
![Page 12: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/12.jpg)
J. Bell GMU CS 475 Spring 2018
Backend Frameworks
!12
Our own backend
Connection to FrontendWeb “Front End”
WAN
Logic
Persistent Data
LAN
LAN
• Then: frameworks• SailsJS, Ruby on Rails, PHP Symfony,
Python Django, ASP.NET, EJB… • MVC - separate presentation, logic and
persistence
![Page 13: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/13.jpg)
J. Bell GMU CS 475 Spring 2018
Scaling web architectures up• What happens when we have to use this approach
to run, say… Facebook? • Tons of dynamic content that needs to be updated,
petabytes of static content (like pictures), users physically located all over, lots of stuff to keep track of, where do we start?
!13
![Page 14: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/14.jpg)
Real Architectures
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
N-Tier Web Architectures
![Page 15: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/15.jpg)
J. Bell GMU CS 475 Spring 2018
Real Architectures• For each layer…
• What is it?• Why?
!15
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
![Page 16: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/16.jpg)
J. Bell GMU CS 475 Spring 2018
External cache
!16
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• What is it? • A proxy (e.g. squid,
apache mod_proxy)
• A content delivery network (CDN) e.g. Akamai, CloudFlare
![Page 17: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/17.jpg)
J. Bell GMU CS 475 Spring 2018
External cache
!17
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• What is it for? • Caches outbound data
• Images, CSS, XML, HTML, pictures, videos, anything static (some stuff dynamic maybe)
• DoS defense • Decrease latency -
might be close to the user
![Page 18: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/18.jpg)
J. Bell GMU CS 475 Spring 2018
External cache
!18
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• What is it made of? • Tons of RAM, fast
network, physically located all over
• No need for much CPU
![Page 19: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/19.jpg)
J. Bell GMU CS 475 Spring 2018
Front-end Tier
!19
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• Serves static content from disk, generates dynamic content by dispatching requests to app tier
• Speaks HTTP, HTTPS
![Page 20: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/20.jpg)
J. Bell GMU CS 475 Spring 2018
Application Server Tier
!20
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• Serves dynamic pages • Provides internal
services • E.g. search, shopping
cart, account management
• Talks to web tier over.. • RPC, REST, CORBA,
RMI, SOAP, XMLRPC… whatever
• More CPU-bound than any other tier
![Page 21: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/21.jpg)
J. Bell GMU CS 475 Spring 2018
Database Tier
!21
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• Relational or non-relational DB • PostgreSQL,
MySQL, Mongo, Cassandra, etc
• Most storage
![Page 22: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/22.jpg)
J. Bell GMU CS 475 Spring 2018
Internal Caching Tier
!22
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• Has tons of memory, right near the app servers to cache application-level (dynamic) objects
![Page 23: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/23.jpg)
J. Bell GMU CS 475 Spring 2018
Internal Services Tier
!23
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
• Coordination services • E.g. time keeping
• Monitoring & maintenance services
![Page 24: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/24.jpg)
Real Architectures
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
N-Tier Web Architectures
Separate out responsibilities with abstractions: each tier cares about a different aspect of getting the client
their response
![Page 25: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/25.jpg)
J. Bell GMU CS 475 Spring 2018
How do we build big apps?
!25
Our Cool App
Frontend
Backend Server
Database
What happens when we want to add more functionality to our backend?
Basic todo app
![Page 26: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/26.jpg)
J. Bell GMU CS 475 Spring 2018
How do we build big apps?
!26
Our Cool App
Frontend
Backend Server
Database
What happens when we add more functionality?
Basic todo app with new feature to email todo
reminders
![Page 27: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/27.jpg)
J. Bell GMU CS 475 Spring 2018
How do we build big apps?
!27
Our Cool App
Frontend
Backend Server
Database
But we’re smart, and learned about modules, so our backend isn’t total spaghetti but rather…
Basic todo app with new feature to email todo
reminders PLUS something to find events on Facebook and create Todos for them
![Page 28: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/28.jpg)
J. Bell GMU CS 475 Spring 2018
How do we build big apps?
!28
Our Cool App
Frontend
Backend Server
Database
Mod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
Sweet: Our backend is not an unorganized mess, but instead just modules. Now how do we scale it? Run
multiple backends?
![Page 29: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/29.jpg)
J. Bell GMU CS 475 Spring 2018
Now how do we scale it?
!29
Our Cool App
Backend Server
Database
Backend Server Backend Server
Mod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
Mod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
Mod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
We run multiple copies of the backend, each with each of the modules
Frontend
![Page 30: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/30.jpg)
J. Bell GMU CS 475 Spring 2018
What's wrong with this picture?• This is called the “monolithic”
app • If we need 100 servers… • Each server will have to run
EACH module • What if we need more of
some modules than others? • How do we update individual
modules? • Do all modules need to use
the same DB and language, runtime etc?
!30
Our Cool App
Backend Server
Database
Backend Server Backend ServerMod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
Mod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
Mod 1 Mod 2
Mod 3 Mod 4
Mod 5 Mod 6
Frontend
![Page 31: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/31.jpg)
J. Bell GMU CS 475 Spring 2018
Microservices
!31
Our Cool App
Frontend
“Dumb” Backend
Mod 1
REST service
Database
Mod 2
REST service
Database
Mod 3
REST service
Database
Mod 4
REST service
Database
Mod 5
REST service
Database
Mod 6
REST service
Database
AJAX
TodosNodeJS, Firebase
MailerJava, MySQL
AccountsGoogle Service
Search Engine
Java, Neo4J
Analytics
C#, SQLServer
Facebook Crawler
Python, Firebase
![Page 32: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/32.jpg)
J. Bell GMU CS 475 Spring 2018
What’s good about this picture?• Spaghetti is contained • Components can be developed totally
independently • Different languages, runtimes, OS, hardware, DB
• Components can be replaced easily • Could even change technology entirely (or use
legacy service) • Can scale individual components at different rates
• Components may require different levels of resources
!32
Our Cool App
Frontend
“Dumb” Backend
Mod 1
REST service
Database
Mod 2
REST service
Database
Mod 3
REST service
Database
Mod 4
REST service
Database
Mod 5
REST service
Database
Mod 6
REST service
Database
AJAX
Todos
NodeJS, Firebase
Mailer
Java, MySQL
Accounts
Google Service
Search Engine
Java, Neo4J
Analytics
C#, SQLServer
Facebook Crawler
Python, Firebase
Mod 4
REST service
Database
Search Engine
Java, Neo4J
Mod 4
REST service
Database
Search Engine
Java, Neo4J
Mod 4
REST service
Database
Search Engine
Java, Neo4J
![Page 33: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/33.jpg)
J. Bell GMU CS 475 Spring 2018
Requirements for successful microservices
• 1 component = 1 service • 1 business use case = 1 component • Smart endpoints, dumb pipes • Decentralized governance • Decentralized data management • Infrastructure automation • Design for failure • Evolutionary design
!33
![Page 34: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/34.jpg)
J. Bell GMU CS 475 Spring 2018
How big is a component?• Metaphor: Building a stereo system • Components are independently replaceable • Components are independently updatable • This means that they can be also independently
developed, tested, etc • Components can be built as:
• Library (e.g. module) • Service (e.g. web service)
!34
![Page 35: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/35.jpg)
J. Bell GMU CS 475 Spring 2018
Components as Libraries or Services?
• Microservices says 1 service per component • This means that we can:
• Develop them independently • Upgrade the independently • Have ZERO coupling between components,
aside from their shared interface
!35
![Page 36: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/36.jpg)
J. Bell GMU CS 475 Spring 2018
Organization around business capabilities
!36
Frontend
Backend
Database
Classic teams:1 team per “tier”Orders, shipping, catalog
Orders, shipping, catalog
Orders, shipping, catalog
![Page 37: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/37.jpg)
J. Bell GMU CS 475 Spring 2018
Organization around business capabilities
!37
Orders
Shipping
Catalog
Example: Amazon
Teams can focus on one business task
And be responsible directly to users
“Full Stack”
“2 pizza teams”
![Page 38: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/38.jpg)
Real Architectures
External Cache
Web Servers
App Servers
Database servers
Internet
Internal Cache
Misc Services
Clients
N-Tier Web Architectures
Separate out responsibilities with abstractions: each tier cares about a different aspect of getting the client
their response
![Page 39: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/39.jpg)
J. Bell GMU CS 475 Spring 2018
Abstracting the tiers• Take, for instance, this internal cache • Can we build one really good internal cache, and
use it for all of our problems? • What is a reasonable model for the cache?
• Partition: yes (get more RAM to use from other servers)
• Replicate: NO (don’t care about crash-failures) • Consistency: Problem shouldn’t arise (aside from
figuring out keys)
!39
![Page 40: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/40.jpg)
J. Bell GMU CS 475 Spring 2018
How much more can we abstract our system?
• At its most basic… what does a program in a distributed system look like? • It runs concurrently on multiple nodes • Those nodes are connected by some network (which
surely isn’t perfectly reliable) • There is no shared memory or clock
• So… • Knowledge can be localized to a node • Nodes can fail/recover independently • Messages can be delayed or lost • Clocks are not necessarily synchronized -> hard to identify
global order
!40
![Page 41: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/41.jpg)
J. Bell GMU CS 475 Spring 2018
Back to reality• That’s a little TOO abstract - given that system, how
can we define a good way to build one? • In practice, we need to make assumptions about:
• Node capabilities, and how they fail • Communication links, and how they fail • Properties of the overall system (e.g.
assumptions about time and order)
!41
![Page 42: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/42.jpg)
J. Bell GMU CS 475 Spring 2018
Designing and Building Distributed Systems
To help design our algorithms and systems, we tend to leverage abstractions and models to make assumptions
!42
Stre
ngth
System model
Synchronous
Asynchronous
Failure Model
Crash-fail
Partitions
Byzantine
Consistency ModelEventual
Sequential
Generally: Stronger assumptions -> worse performance Weaker assumptions -> more complicated
![Page 43: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/43.jpg)
J. Bell GMU CS 475 Spring 2018
Byzantine Failures
!43
A B A B
Set A=5
6 7 765
“OK”! Read A “6”!
Set A=5
“OK!”
The robot devil will return in lecture 23
![Page 44: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/44.jpg)
J. Bell GMU CS 475 Spring 2018
Timing & Ordering Assumptions• No matter what, there will be some latency between
nodes processing the same thing • What model do we assume though? • Synchronous
• Processes execute in lock-step • We (the designers) have a known upper bound on
message transmission delay • Each process (somehow) maintains an accurate clock
• Asynchronous • Opposite - processes can run out of order, network
arbitrarily delayed
!44
![Page 45: Distributed Architectures & Microservices€¢ Replaced in 2010 by Google's Colossus system - eliminates master!3 J. Bell GMU CS 475 Spring 2018 MapReduce: Divide & Conquer!4 Combine](https://reader034.vdocuments.us/reader034/viewer/2022051803/5b0422c57f8b9a89208d2ad6/html5/thumbnails/45.jpg)
J. Bell GMU CS 475 Spring 2018
Modeling network transmissions• Assuming how long it can take a message to be
delivered helps us figure out what a failure is • Assume (for instance), messages are always
delivered (and never lost) within 1 sec of being sent
• Now, if no response received after 2 sec, we know remote host failed
• Typically NOT reasonable assumptions
!45