Table Of ContentSoftware Architecture Patterns for
JoSS
heo
n
Serverless Systems Grvft
ilbew
era
r
tlr Software Architecture
ee
s
As businesses are undergoing a digital transformation to keep up with competition, it is now more sA
r
important than ever for IT professionals to design systems to keep up with the rate of change while Sc
yh Patterns for
maintaining stability. si
tte
e
This book takes you through the architectural patterns that power enterprise-grade software systems c
m
t
and the key architectural elements that enable change such as events, autonomous services, and u Serverless Systems
sr
micro frontends, along with demonstrating how to implement and operate anti-fragile systems. You'll e
divide up a system and defi ne boundaries so that teams can work autonomously and accelerate the P
a
pace of innovation. The book also covers low-level event and data patterns that support the entire
t
architecture, while getting you up and running with the diff erent autonomous service design patterns. te
As you progress, you'll focus on best practices for security, reliability, testability, observability, and r
n
performance. Finally, the book combines all that you've learned, explaining the methodologies of s Architecting for innovation with events, autonomous
f
continuous experimentation, deployment, and delivery before providing you with some fi nal thoughts o
services, and micro frontends
on how to start making progress. r
By the end of this book, you'll be able to architect your own event-driven, serverless systems that are
ready to adapt and change so that you can deliver value at the pace needed by your business.
Things you will learn:
• Explore architectural patterns to create • Create event stream processors that power
anti-fragile systems that thrive with change the Event Sourcing and CQRS patterns
• Focus on DevOps practices that empower • Deploy a multi-regional system, including
self-suffi cient, full-stack teams regional health checks, latency-based
• Build enterprise-scale serverless systems routing, and replication
• Apply microservices principles to • Explore the Strangler pattern for migrating
the frontend legacy systems
• Discover how SOLID principles apply to
software and database architecture
John Gilbert
Software Architecture
Patterns for
Serverless Systems
Architecting for innovation with events, autonomous
services, and micro frontends
John Gilbert
BIRMINGHAM—MUMBAI
Software Architecture Patterns for
Serverless Systems
Copyright © 2021 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted
in any form or by any means, without the prior written permission of the publisher, except in the case
of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express or
implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for
any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.
Group Product Manager: Aaron Lazar
Publishing Product Manager: Richa Tripathi
Senior Editor: Nitee Shetty
Content Development Editor: Tiksha Lad
Technical Editor: Gaurav Gala
Copy Editor: Safis Editing
Project Coordinator: Deeksha Thakkar
Proofreader: Safis Editing
Indexer: Pratik Shirodkar
Production Designer: Aparna Bhagat
First published: June 2021
Production reference: 1290621
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-80020-703-5
www.packt.com
To my wife, Sarah, and our children, for their endless love
and support on this journey.
–John Gilbert
Contributors
About the author
John Gilbert is a CTO with over 30 years of experience in architecting and delivering
software systems across many industries. His cloud journey has spanned all the levels of
cloud maturity, from lift and shift and software-defined infrastructure to microservices
and continuous deployment. He was an early serverless adopter and put his first serverless
workloads into production just months after AWS Lambda's introduction. He has also
authored Cloud Native Development Patterns and Best Practices and JavaScript Cloud
Native Development Cookbook. He finds delivering serverless solutions to be, by far, the
most fun and satisfying, as they force us to rewire how we reason about systems and
enable us to accomplish far more with much less effort and risk.
About the reviewers
Kamesh Ganesan is a cloud evangelist, seasoned technology professional, author, speaker,
and coach with over 24 years of IT experience in all major cloud technologies, including
AWS, Azure, GCP, Oracle, and Alibaba Cloud. He has over 50 IT certifications, including
5 AWS certifications, 3 Azure certifications, 3 GCP certifications, 6 OCI certifications,
and an Alibaba Cloud certification. He has played many roles, including certified multi-
cloud architect, cloud security architect, cloud-native application architect, lead database
administrator, programmer analyst, and developer. He has architected, built, automated,
and delivered high-quality, mission-critical, and innovative technology solutions that have
helped his enterprise, commercial, and government clients to be very successful and have
significantly improved their business value using multi-cloud strategies.
Greg Leonardo is currently a cloud architect helping organizations with cloud adoption
and innovation. He has worked in the IT industry since his time in the military. He is a
veteran, father, architect, teacher, speaker, and early adopter. Currently, he is a Certified
Azure Solution Architect Expert, Microsoft Certified Trainer (MCT), and Microsoft
Azure MVP, and he has worked in many facets of IT throughout his career. Additionally,
he is president of TampaDev, a community meetup that runs #TampaCC, Azure User
Group, Azure Medics, and various technology events throughout Tampa.
He has also authored Hands-On Cloud Solutions with Azure and the previous two editions
of Azure Strategy and Implementation Guide for Microsoft by Packt Publishing.
Lalit Rawat is an Azure MVP and MCT and is currently working as a solution architect.
He is the author of AZ-104 Azure Administrator and Azure Interview Q & A. He likes
to share his knowledge through his blog and manage and share his technical skills in
AzureTalk Community, BITPro, and Azure User Meetup groups. He has written a number
of articles on Microsoft Azure. He is a speaker and has delivered sessions at the MS
Global bootcamp and other events. He has delivered more than 500 training sessions to
professionals worldwide in Microsoft Azure and other technologies, including SCOM and
Windows Server. In addition, he provides instructor-led online training and hands-on
workshops. His technical prowess and ability to explore new frontiers of technology and
impart them to his aspiring team members are his trademark.
Sivaraj Ambat is a cloud expert and software professional specializing in application
development for the web, desktop, mobile apps, chatbots, and AI-based applications. He
has over 25 years of industry experience in diverse roles and companies, ranging from
instrumentation and industrial robotics to embedded systems and software application
development. He is a recipient of the US-based Training Magazine's 2016 Top 20
Emerging Training Leaders Award and has also been a winner at many hackathons
and quiz competitions. He currently works at Tech Mahindra, Bangalore, as a principal
consultant and senior fellow. He can be reached at @sivarajTweets on Twitter.
Table of Contents
Preface
Section 1: Establishing an Architectural
Vision
1
Architecting for Innovation
Continuously delivering business value 4
By the skin of our teeth 4
Through high-velocity teamwork 4
Taking control of lead time 5
Risk mitigation 6
Decision making 6
Software Development Life Cycle methodology 7
Hardware provisioning 8
Software deployment 8
Software structure 9
Testing and confidence 10
Dependencies and inter-team communication 10
Dissecting integration styles 11
Batch integration 11
Spaghetti integration 12
Real-time integration 13
Enterprise application integration 13
Shared database 14
Service-oriented architecture 15
Microservices 15
viii Table of Contents
Enabling autonomous teams with autonomous services 16
Autonomous services – creating bulkheads 17
Event-first – valuing facts 20
Serverless-first – creating knowledge 22
Data life cycle – fighting data gravity 23
Micro frontends – equalizing tiers 25
Observability – optimizing everything 25
Organic evolution – embracing change 26
Summary 27
2
Defining Boundaries and Letting Go
Building on SOLID principles 30
Single Responsibility Principle 31
Open-Closed Principle 32
Liskov Substitution Principle 32
Interface Segregation Principle 33
Dependency Inversion Principle 34
Thinking about events first 35
Event storming 36
Verbs versus nouns 37
Facts versus ephemeral messages 37
Contracts versus notifications 38
React and evolve 39
Powered by an event hub 40
Dividing a system into autonomous subsystems 41
By actor 41
By business unit 42
By business capability 43
By data life cycle 43
By legacy system 44
Creating subsystem bulkheads 45
Decomposing a subsystem into autonomous services 47
Context diagram 47
Micro frontend 49
Table of Contents ix
Event hub 49
Autonomous service patterns 50
Dissecting an autonomous service 52
Repository 52
CI/CD pipeline and GitOps 53
Tests 53
Stack 54
Persistence 55
Trilateral API 55
Functions 56
Micro-app 56
Shared libraries 57
Governing without impeding 57
Leveraging observability 57
Facilitating a culture of robustness 61
Audit continuously 62
Securing the perimeter 64
Elevating TestOps 65
Automating account creation 66
Summary 68
Section 2: Dissecting the Software
Architecture Patterns
3
Taming the Presentation Tier
Zigzagging through time 72
Client-side versus server-side rendering 72
Build-time versus runtime rendering 73
Web versus mobile 74
Breaking up the frontend monolith 75
By subsystem 75
By user activity 76
By device type 76
By version 77