Serverless设计原则有效架构选择实践
如果无法正常显示,请先停止浏览器的去广告插件。
1. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Serverless Design Principles
a guide to effective architectural choices
Luca Mezzalira
Principal Serverless Specialist Solutions Architect
亚马逊云科技
© yyyy, Amazon Web
© yyyy,
Services,
Amazon
Inc. or
Web
its Services,
affiliates. Inc.
All or
rights
its affiliates.
reserved. All rights reserved.
2. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Luca Mezzalira
Principal Serverless Specialist at AWS
International Speaker
Author
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
2
3. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Distributed Systems
are LIVING systems
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
3
4. Distributed systems goals
Organization
scalability
Reduce external
dependencies
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Faster
feedback loop
Business
Agility
Reduce
blast radius
5. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
How does serverless fit
in distributed systems?
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
5
6. Serverless is a STRATEGY
n
i
t i
f f
i
i f t i
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
6
7. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Serverless Portfolio*
APPLICATION PRIMITIVES – COMPUTE AND DATASTORES
AWS
Lambda
Amazon
S3
Amazon
DynamoDB
AWS
Fargate
Amazon Aurora
Serverless
Amazon
Kinesis
APPLICATION INTEGRATION
Amazon
SNS
Amazon
API Gateway
AWS
Step Functions
W S
p p Sy n
Amazon
SQS
Amazon
EventBridge
Developer Tools
AWS
Cloud9
AWS
CloudFormation
AWS
CodePipeline
AWS
Config
AWS
CloudTrail
Amazon
CloudWatch
AWS
X-Ray
AWS Serverless
Application
Repository
SECURITY AND ADMINISTRATION
AWS
IAM
AWS
SSO
Amazon
GuardDuty
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
Amazon
Inspector
Amazon
VPC
AWS
WAF
AWS
Shield
Amazon
Cognito
n o t e x h a u s tiv
7
8. Where can serverless help?
Focus on business
value Automatic scaling Security and isolation
by design
Managed
infrastructure Lower Total
Cost of Ownership (TCO) Business agility
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
9. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
How to design
Serverless applications
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
9
10. CONNECTED DIMENSIONS in distributed systems
Organization
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Culture
System
Architecture
11. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Organization
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
11
12. Any organization that designs a system will
produce a design whose structure
is a copy of the organization's
communication structure.
Melvin E. Conway
1967
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
13. Centralized mindset
Engineering Teams
Team A
Team B
Team C
Tech Leadership
Platform Team
Security Team
Architecture Team
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
13
14. Decentralize mindset
Key:
On-boarding Team
)(
Platform-as-a-Service
Platform Team
Inner Platform (AWS)
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Data
Science
Team
][
Personalization Team
Stream-aligned team – A team with
a business-aligned objective
Enabling Team - An Enabling
team helps a stream-aligned
team to overcome obstacles.
)(
Catalog Team
Complicated Subsystem Team – A
team with specialist skills that
facilitate acute functionality
)(
][
Facilitating
Federated Service (i.e. X-as-a-Service)
14
15. Serverless is an extension
of your enablement teams
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
16. E
E
1 fo r th e v a lu e s tr e a m te a m
Enablement teams
focus with Serverless
2 u s in g a u to m a tio n a n d s h ift le ft m in d s e
3 a c r o s s a d is tr ib u te d s y s te
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
17. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Culture
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
17
18. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Decentralize
& Empower
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
18
19. Developing a culture of serverless-first
Form CCOE Quick Wins Leadership Support
Form Cloud
Center of
Excellence. Deliver strategic
“light house”
modernized
workloads Establish clear
vision and
support from
leadership
1 2 3
Best Practices Evangelize Reorganize
Build reusable
patterns, reference
architecture, and
shared services Community
Building and
Enablement 4 5
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Decentralize
CCOE function
and federate
across the
organization
6
19
20. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
System Architecture
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
20
21. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Evolutionary
Architecture
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
21
22. G
1 to e x p r e s s in y o u r s y s te
Architecture begins with
2 to id e n tify th e r ig h t p a tte r n s to a p p l
W
x
3
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
23. A spectrum of compute for different needs
m a z o n EC
W
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
x
F
W
x
n
W
x
24. Selecting services that fit your strategy
1
Step One
Start with the highest
abstraction
2
Step Two
Move to a lower
abstraction when needed
3
Step Three
Iterate and evolve
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
25. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Design Principles
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
25
26. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
Modularity
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
26
27. Modularity: the quality of consisting
of separate parts that, when combined,
form a complete whole.
Cambridge Dictionary
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
28. A system lacks modularity when
a tweak to one of its components
affects the functioning of others.
Cambridge Dictionary
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
29. Modularity using code
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• Strong encapsulation
• Large usage of design patterns
• Decouple business logic from
environment
• Developers discipline
30. Modularity using infrastructure
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• More options to express your
intents
• Configuration over code
• Many common built-in behaviors
• More control on what to develop
31. Architecture and patterns enabled by Serverless
Microservices
Event-Driven
Architectures
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Data
Architectures
Integration
Patterns
31
32. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
How to design a workload
using Serverless
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.
32
33. Business requirements
• Gift code service for an e-commerce
• Gift codes can be generated by the system or 3 rd party companies
• For every gift code consumption we need to
Notify the customer support team
Update the user’s account history
If the gift code was issued by 3 rd party company notify them
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
33
34. Workload Characteristics
• 99.99% availability on critical path
• 99.9% availability on the rest of the system
• Events to communicate across bounded context
• Under 1 second response time for the user facing APIs
• Scale to up 3000 TPS with 50% headroom
…
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
34
35. High-level architecture
3 rd Party
Gift Code
Systems
Gift
Code
Service
User
Account
CRM
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
35
36. Architectural characteristics
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
36
37. Team topology
Platform Team
Security Team
Architecture Team
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
37
38. Serverless implementation
• Synchronous API
• Quick acknowledgment for
the users
• Only part that needs to scale
based on users traffic
• DynamoDB Streams
becomes the glue with the
asynchronous part of the
system
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
38
39. Serverless implementation
• Synchronous API
• Step Functions orchestrates
different services to generate
or update gift codes
• API Gateway helps to mitigate
eventual traffic spikes from
3 rd party services
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
39
40. Serverless implementation
• Events allow the decoupling
of producers and consumers
• DynamoDB Streams notifies
every change in the
DynamoDB table
• EventBridge Pipes enrich the
information received for
downstream services
• EventBridge is the message
broker
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
40
41. Serverless implementation
• Some 3 rd party systems
accepts an API calls in the
format defined by your
system
• Some others require to
translate from JSON to XML
or any other format
• More architectural patterns
are also applicable
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
41
42. Serverless implementation
• CRM has API limits so a queue
helps us to ease the traffic
• User account uses a Lambda
function to manipulate the
event and then integrate
inside their bounded context
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
42
43. Ready for the future…
New partners
Data Lake
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
43
44. Express your architecture characteristics
and business requirements into
infrastructure focusing on
YOUR BUSINESS goals
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
45. G n
not build
W
SOFTWARE
Frederick Brooks (Computer Architect)
© yyyy, Amazon Web Services, Inc. or its affiliates. All rights reserved.
46. UPDATE THIS PRESENTATION HEADER IN SLIDE MASTER
谢谢
Luca Mezzalira
lmezza@amazon.com
© yyyy, Amazon
Web
Services,
Inc.
or its affiliates.
rights reserved.
© yyyy,
Amazon
Web
Services,
Inc. or its All
affiliates.
All rights reserved.