38
Architecture Styles and Hypes Michael Hilton Claire Le Goues Christopher Meiklejohn October 15, 2020 1

Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Architecture Styles and Hypes

Michael Hilton Claire Le Goues

Christopher Meiklejohn

October 15, 2020

1

Page 2: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Administrativia

• Homework 4 will be released today.

• No recitation Friday.

• Wednesday recitation – bring questions or we end early!

o Work through problems on the previous midterms – many students found

this helpful.

o Any questions on the previous midterm questions – bring them to recitation

to discuss as a class.

• Midterm on October 22nd.

2

Page 3: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Learning Goals

• Understand history of Microservices

• Reason about tradeoffs of Microservices architectures.

3

Page 4: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

MICROSERVICES

17-313 Software Engineering

4

Page 5: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

5

Page 6: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

6

Page 7: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

7

Page 8: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

8

Netflix

Page 9: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

9

(as of 2016)

Bookmarks

Recommendations

My List

Metrics

AppBoot

Page 10: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

10

(as of 2016)

Page 11: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Microservices

17-313 Software Engineering

11

Page 12: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

12

source: http://martinfowler.com/articles/microservices.html

Page 13: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

13

Uber

Page 14: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

14

(as of 2016)

Page 15: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

15

(as of 2016)

Page 16: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

16

(as of 2016)

Page 17: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

17

(as of 2016)

Page 18: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Microservices

• Building applications as suite of small and easy to replace services

o fine grained, one functionality per service

(sometimes 3-5 classes)

o composable

o easy to develop, test, and understand

o fast (re)start, fault isolation

o modelled around business domain

• Interplay of different systems and languages

• Easily deployable and replicable

• Embrace automation, embrace faults

• Highly observable

17-313 Software Engineering

18

Page 19: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Service Oriented Architectures(SOA)

• Service: self-contained functionality

• Remote invocation, language-

independent interface

• Dynamic lookup possible

• Often used to wrap

legacy systems

17-313 Software Engineering

19

Service Registry

Service Requestor

Service Providerbind

call

publishfind

Page 20: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Service Oriented Architectures(SOA) Microservice Architecture

• Service: self-contained functionality

• Language-independent interface

• Dynamic lookup

17-313 Software Engineering

20

Kubernetes

Service A(Container)

Service B(Containers)

HTTP/GRPC

Runs andAssigns IP

DNSLookup

Page 21: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Technical Considerations

• HTTP/REST/JSON/GRPC/etc. communication

• Independent development and deployment

• Self-contained services (e.g., each with own database)

o multiple instances behind load-balancer

• Streamline deployment

17-313 Software Engineering

21

Page 22: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

22

source: http://martinfowler.com/articles/microservices.html

Page 23: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

23

Hipster Shop

Page 24: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Hipster Shop User Interface

17-313 Software Engineering

24

Page 25: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Hipster Shop Bingo Game

17-313 Software Engineering

25

https://docs.google.com/presentation/d/1P7X7nFMIWAQW12kOk6pW66jtk34S_j_RnCt2c3BwMvM/edit?usp=sharing

Make a copy of the first slide for your group.

Add your Andrew IDs to the slide.

Frontend

FREE SPOT

Page 26: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Hipster Shop Microservice Architecture

17-313 Software Engineering

26

https://github.com/GoogleCloudPlatform/microservices-demo

Page 27: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Microservices overhead

17-313 Software Engineering

27

Page 28: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

28

Cinema

Page 29: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Cinema Diagram

17-313 Software Engineering

29

https://codeahoy.com/2016/07/10/writing-microservices-in-python-using-flask/

https://github.com/umermansoor/microservices/

Page 30: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

30

Cinema Code Walkthrough

Page 31: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Drawbacks

• Complexities of distributed systems

o network latency, faults, inconsistencies

o testing challenges

• Resource overhead, RPCs

• Shifting complexities to the network

• Operational complexity

• Frequently adopted by breaking down monolithic application

• HTTP/REST/JSON communication

o Schemas?

17-313 Software Engineering

31

Page 32: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Discussion of Microservices

• Are they really “new”?

• Do microservices solve problems, or push them down the line?

• What are the impacts of the added flexibility?

• Beware “cargo cult”

• “If you can’t build a well-structured monolith, what makes you think

microservices is the answer?” – Simon Brown

• Leads to more API design decisions

17-313 Software Engineering

32

Page 33: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

33

Serverless

Page 34: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

34

SERVERLESS

SERVERLESS

Page 35: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

35

SERVERLESS

Page 36: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

36

SERVERLESS

Page 37: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

Serverless (Functions-as-a-Service)

• “extreme” use of microservices

• Instead of writing minimal services, write just functions

• No state, rely completely on cloud storage or other cloud services

• Pay-per-invocation billing with elastic scalability

• Drawback: more ways things can fail, state is expensive

• Examples:

AWS lambda, CloudFlare workers, Azure Functions

• What might this be good for?

• (New in 2019/20) Stateful Functions:

Azure Durable Entities, CloudFlare Durable Objects

17-313 Software Engineering

37

Page 38: Styles and Hypes - GitHub Pages · 2020. 12. 10. · Microservices •Building applications as suite of small and easy to replace services o fine grained, one functionality per service

17-313 Software Engineering

38