Microservice
architectures and
serverless computing
Santeri Paavolainen
7.1.2020
Today’s agenda
- Personal introductions
- Course overview and expectations
- Microservice architectures
- Some course details and practical matters
- Assignment for next lecture
Microservice architectures and serverless computing
5.1.2020
2
Introductions
Photo by Eric Kilby (CC BY-SA)
Course super-condensed overview
- Covers microservice architectures and serverless computing
- These are (1) distributed (2) heterogenous (3) software (4) systems
- Lectures January 7th to March 31st (except February 18th)
- Grading based on class activity, off-class exercises, personal
microservice project and exam
Microservice architectures and serverless computing
5.1.2020
5
Expectations
Groups
Discuss (10 minutes)
Summarize on post-it-notes and present
What is a software
architecture?
System Relations between services
architecture Platforms and frameworks
Service State management
Client-server vs. peers
architecture Layered architecture patterns
Application / OO modelling
component MVC vs dataflow vs …
architecture
Implementation C++ vs. Python
Quicksort vs. mergesort
architecture
Lock-free vs. mutual exclusion
”Architecture” ambiguous
- Not consistent!!! Important:
- DBMS — service or
application? - Different architectural
- Depends on viewpoint!!! abstraction levels
- CPUs are internally systems— - This course operates only
how does chip engineer see it? on system and service
- Library is what to application architectures
developer? Application is - Relatively high level!
what to service architect?
Microservice architectures and serverless computing
5.1.2020
10
If learning programming
makes you a software
engineer …
… then learning about
software architectures makes
you a software architect?
Which one is the best?
In software systems
there is no simple
“best” answer—
everything is
IN A round robin DNS ELB API GW contextual:
Static
LB LB LB create new instances, SPA
update DNS records
Monitoring
Monitoring
FE
container
FE
container
FE
container CPU load-
Function
1
Function
2
Function
3
- Time
- Resources
FE FE FE FE FE based auto
scaling group
- Requirements
read read RDS Aurora
write auto scaling AWS Lambda
read replica (serverless)
Aurora Read Read DynamoDB
group
Read Read Read master replica replica
Master Slave
replica replica replica
Architects must be
able to
- Justify and
A B C provide rationale
- Think in what-if
scenarios
Microservice architectures and serverless computing
5.1.2020
12
What does a software architect do?
- In a larger company
- Draw detailed diagrams ß Communication
- Talk to lots of stakeholders ß Communication
- Attend lots of meetings ß Communication
- Talk to engineers and architects ß Communication
- Draw lots of stuff on whiteboard ß Communication
- In a start-up
- Less talking and less meetings ß Communicate with
- Less people to catch your mistakes actual customers
Microservice architectures and serverless computing
5.1.2020
13
Communication
“Architect”
Service
boundaries
Interaction
Teams SLAs
Discovery
Organizational Architecture
System Configuration
Microservices
architecture
Interfaces
History
Evolution Messaging
Service
architecture
Trends in Workflow
computing and Logging
Operations Implementation Batch
software
engineering Data streaming
Monitoring
Scaling
Tracing Deployment Recovery and Sidecars etc.
Failures
methods resiliency
Load balancing
Deployment
Serverless
Protocols Sharding
Network
Runtime Service brokers
Containers
Orchestration
What is a
microservice?
Some computing
history …
Trends in computing
Genesis Custom built Product Commodity
Sources:Joi Ito (SAGE, CC BY 2.0), Arnold Reinhold (IBM Microservice architectures and serverless computing
1401, CC BY-SA 3.0), Ben Franske (IBM S/360, CC BY 2.5), 5.1.2020
Veradrive (IBM PC/XT, CC BY 4.0), Senado Feredal
17
(Smartphone, CC BY 2.0), Google (Google data center)
Trends in computing
Plugboards Terminals Remoting
Machine
language Compilers Timesharing Internet
Web
OO Cloud
Punch cards
Networking SDN
Assemblers
Client-server
Then Now
Microservice architectures and serverless computing
5.1.2020
18
Nvidia Titan RTX
16 TFlop/s
Raspberry Pi
28 GFlop/s
Cray 1
160 MFlop/s
Source: top500.org
Microservice architectures and serverless computing
5.1.2020
19
Scarcity Abundance
Few users World
population
Little data Big data
Then Now
Microservice architectures and serverless computing
5.1.2020
20
Then Now
Source: pngimg.com (CC BY-NC 4.0)
Microservice architectures and serverless computing
5.1.2020
21
What is a
microservice?
[…] microservice
architectural style: building
applications as suites of
services. [Which are]
independently deployable
and scalable, [with a] firm
module boundary, even
allowing for [using] different
programming languages.
They can also be managed
by different teams.
Adrian Cockroft: Microservices the Good the Bad and the Ugly (2015)
Martin Fowler:
Microservices (2014)
Microservice architectures and serverless computing
5.1.2020
23
Source: YouTube / AWS
Architectural
Operational
Organizational
Microservice architectures and serverless computing
5.1.2020
25
Microservices as an architectural
design model
- Loosely coupled architectures
- Parameterized configuration and service discovery
- Independent component lifecycles
- Fine grained component separation
- Identifying domains of logical responsibilities
- Identifying and managing state
- Preference to purely stateless or purely stateful components
- This is a high-level technology design viewpoint
Microservice architectures and serverless computing
5.1.2020
26
Microservices as implementation
patterns
- “Architecture astronauts” often overlook practical but important
concerns
- Logging, tracing and monitoring
- Edge cases such as cold restarts, bad nodes
- Deployments and resource scaling
- Operational and implementation patterns
- Logging sidecars, external services, distributed tracing
- Blue/green deployments, gradual rollouts
- Testing live systems
- This is a practical / operational viewpoint
Microservice architectures and serverless computing
5.1.2020
27
Microservices as organizational
structure
- Conway’s law
- "organizations which design systems ... are constrained to produce
designs which are copies of the communication structures of these
organizations.”
- Define system by organization, or organize by system design
- Two-pizza rule for team size (Bezos)
- Minimize friction on internal communication
- Formalize external interfaces
- Service contracts, SLAs à DevOps
- This is a management viewpoint
Microservice architectures and serverless computing
5.1.2020
28
Just a word on DevOps
- DevOps is the practice of integrating operational
responsibility to development team
- ”You code it, you deploy it, you get the alarm call at night”
- DevOps does not imply microservices nor vice versa
- OTOH, on a practical level, gaining maximum benefit from
microservices (arch + ops + org) implies DevOps
- Further elaboration as GitOps and infrastructure-as-code
- Repository-driven deployment model
- Code as source of ground truth on infrastructure
Microservice architectures and serverless computing
5.1.2020
31
Architectural
Operational
Organizational
Microservice architectures and serverless computing
5.1.2020
32
Serverless
- Serverless defined as a “Function-as-a-Service”
- Service that runs functions when a request or event occurs
- Not bound to any particular server or hardware, autoscaled
- Serverless more during later lectures
- Most of architectural and operational aspects of
microservices apply to serverless as well
- Serverless as even more fine-grained evolution
Microservice architectures and serverless computing
5.1.2020
33
Why
microservices?
Helps managing large Increases “Product” viewpoint
development development velocity (vs. “project”)
organizations
Clearer responsibilities, divisions of Independent decisions
in teams, Easier to focus on customer needs
labor formal dependencies than managing schedules
Easier to scale at team and
Intra-team communications more
individual level focused
Microservice architectures and serverless computing
5.1.2020
35
Increases development Changes in usage Reduced reliability
and testing overhead patterns
Repetition of code, Distributed services put more Dependencies between
configuration etc. load on the network (vs. local services
Requires investment in testing IPC) Additional work in
automation (CI/CD) Authority on infrastructure configuration and change
Debugging distributed systems open to misuse and accidents management
notoriously difficult Security harder to monitor and
enforce
Microservice architectures and serverless computing
5.1.2020
36
More pros and cons from Martin Fowler
Source Martin Fowler
Microservice architectures and serverless computing
5.1.2020
39
Photo by Sebastian Pichler on Unsplash
Course
Specifications
Communications > Attendance
> Contact sessions > Project
Contacts and communications
- Teacher: Santeri - Official communications to
Paavolainen students via MyCourses and
- santeri.paavolainen@aalto.fi email
- OIH B252, please schedule
separately if you want to meet - Course slack
- Group and 1-1 discussions
- Not mandatory, all “official”
information will come via
MyC & email
Microservice architectures and serverless computing
5.1.2020
42
Attending and passing the course
- Contact sessions (lectures) Final grading based on:
- Tuesdays 9:15 to 12:00, OIH
Seminar Hall - Class activity
- From 7.1. to 31.3., except 18.2. - Off-class exercises
- Personal course project
- Supporting hands-on
- Exam
sessions
- Scheduled separately,
Theoretically you can pass the course with
attendance not required just class+exercises+exam or
exam+project, but that’d be grade 1.
Microservice architectures and serverless computing
5.1.2020
43
S
Contact sessions
C
- This course is also in Separation of core vs. supporting
development! concepts
- Increasing participatory
activities during contact Be loud if you have difficulties with
sessions core concepts!
- Questions are always welcome!
Supporting concepts provide
- Flipped classroom method in context, information further
elaborating core concepts
use—often need to prepare
for the next session!
Watch out for
I’ll try provide some
summary slides in other indicators
material
Microservice architectures and serverless computing
5.1.2020
44
Personal course project
- You will need to design and - “Business” functionality is
implement secondary
- Microservice system - Most “business” features can
- 3+ separate services be mocked (faked)
- Both stateful and stateless - However, must be able to be
services used to grade, e.g. some real
stuff is necessary
- Need to include certain
architectural aspects
- Detailed description during
3rd session (January 21st)
Microservice architectures and serverless computing
5.1.2020
45
Examples of projects last year
- Image location information - Item rental platform
service
- Fisher’s catch recording
- API GW, image storage, image
processor, geolocation service
- Carsharing - Home automation
- API GW, carsharing - Host scanner
management, geolocation,
identity provider - Subscription aggregator
- IoT camera image classification - Dentist appointment
- API GW, storage, classifier, management
authentication - Eating recommendations
Microservice architectures and serverless computing
5.1.2020
46
Programming Network programming REST APIs AWS/Azure/GCP (cloud)
Docker Kubernetes Databases Parallel programming
Asynchronous Single page applications Python / JavaScript / Java More-than-one-node
programming / Scala systems
Summary
- Microservices may be used on software design,
organizational or operational level
- Design abstractions depend on architectural level
- ”Micro” does not refer to size of a service (>400
node services can be microservices) but its design
philosophy
Assignment for next week
- Watch the two videos:
- https://www.youtube.com/watch?v=pwpxq9-uw_0 (until Q&A at
about 50 minutes)
- https://www.youtube.com/watch?v=NnFeIt-uaEc
- These relate to today’s and next week’s topics
- We’ll discuss these next week, it might be useful to write
down your thoughts down
Microservice architectures and serverless computing
5.1.2020
49