Software Architecture Patterns for Serverless Systems - John Gilbert - E-Book

Software Architecture Patterns for Serverless Systems E-Book

John Gilbert

0,0
44,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

As businesses are undergoing a digital transformation to keep up with competition, it is now more important than ever for IT professionals to design systems to keep up with the rate of change while maintaining stability.

This book takes you through the architectural patterns that power enterprise-grade software systems and the key architectural elements that enable change (such as events, autonomous services, and micro frontends), along with showing you how to implement and operate anti-fragile systems.

First, you’ll divide up a system and define boundaries so that your teams can work autonomously and accelerate innovation. You’ll cover low-level event and data patterns that support the entire architecture, while getting up and running with the different autonomous service design patterns.

Next, the book will focus on best practices for security, reliability, testability, observability, and performance. You’ll combine all that you've learned and build upon that foundation, exploring the methodologies of continuous experimentation, deployment, and delivery before delving into some final thoughts on how to start making progress.

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.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 669

Veröffentlichungsjahr: 2021

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



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: 2260821

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

Foreword

I personally believe there are two ways to learn in life. You can learn from your own mistakes, or you can learn from someone else's mistakes. Since I prefer the latter, please humor me, as we travel back in time. In 1914, Henry Ford popularized the expanding concept of an assembly line, by applying it to the most impossible application anyone of that time would consider tackling—assembling a car. To build his own assembly line masterpiece, Henry Ford followed these three principles (taken from his autobiography, My Life and Work, page 80, written in 1922). I changed a few words of Henry Ford's for clarity and emphasis:

Place the tools and the workers in the sequence of the operation so that each component part shall travel the least possible distance while in the process of finishing.Use work slides or some other form of carrier so that when a worker completes an operation, you drop the part always in the same place—which must always be the most convenient place for your hand—and if possible, have gravity carry the part to the next worker.Use sliding assembling lines by which the parts to be assembled are delivered at convenient distances.

Henry Ford was not the first to think of assembly lines, nor was he the last. The first attempts are thought to have been in the early 1800s at the Portsmouth Block Mills in England, creating rigging blocks for the Royal Navy. Ransom Olds (of Oldsmobile fame) attempted to patent his assembly line concept in 1901. Ford's inspiration came from visits to the Swift & Company slaughterhouse in Chicago, as well as the Sears mail-order handling facility in 1906. Moving forward through time, the Toyota Production System began in 1930 and led to the company's dominance many decades later. John Krafcik then dubbed this process the Lean methodology, in 1988.

We saw this manufacturing process further migrate into software development, with a 1986 paper (by Takeuchi and Nonaka) in the Harvard Business Review, which coined the term scrum (taken from rugby). In 1995, Ken Schwaber helped formalize the Scrum process for software development. In 2001, 17 software developers (including Ken) met in Utah to combine many methods from the 90s and formalized them as Agile development (they had a manifesto and everything). And that's enough history.

So, you were probably wondering (way back in my first sentence) what any of this has to do with serverless computing (or even the idea of Functions as a Service (FaaS)). I think that's it. I think we focus on the process of assembling a product so much, that we miss the obvious application (of assembly lines) in our very methodologies in authoring software. In our current time and industry, our tools are not wrenches and switches. Instead, our tools are keyboard keys, mouse buttons, and a bunch of text and numbers, which we dutifully type out on lines. Just like companies were on the precipice of creating a more efficient way of assembling their products, we stand staring down, at the cliff's edge of automating our software development and simply building applications in a far more efficient manner. And that brings us to Mr. Gates.

"The first rule of any technology used in a business is that automation applied to an efficient operation will magnify the efficiency."

– Bill Gates

Before we blame the Bill for stating the obvious, let's consider how little we automate in our software development. How often do we repeat code? Just like unnecessary work was done to move large components in Ford's factory (as well as their use of inefficient assembly techniques), we also find ourselves struggling to build things that have already been built. Ford was literally (as we are figuratively) reinventing the wheel.

In Software Architecture Patterns for Serverless Systems, author John Gilbert goes right for the heart of providing innovative patterns that provide automated and efficient operations. John masterfully applies his experience of being a CTO, his 30 years of software architecture, and his experience as an established author. On top of that, the serverless expertise and diversity of the reviewers of this masterpiece (Ganesan, Leonardo, Rawat, and Ambat) is absolutely humbling (for me to even mention these stalwarts). Thus, it's all here… everything I would have hoped for. This book takes you on a whirlwind tour of innovative architecture, teamwork, lead time, true automation, SOLID principles, events, subsystems, governance, microservices, frontends, event hubs, event streams, throughput, CQRS, lean data, idempotence, and well, I should really stop. You'll see.

The bottom line is that John Gilbert is helping us get to the next chapter in the story that started back in the Portsmouth Block Mills, then taken to an international level with Henry Ford's assembly line, and finally, moved forward by Toyota and the Lean, Scrum, and Agile methodologies. Now we see it truly applied to software architecture and development. Let's join John on this journey to see Mr. Gate's vision implemented. Let's exponentially magnify our architecture's efficiency.

Ed Price

Senior Program Manager of Architectural Publishing

Microsoft, Azure Architecture Center (http://aka.ms/Architecture)

Co-author of five books, including The Azure Cloud Native Architecture Mapbook and ASP.NET Core 5 for Beginners (both from Packt)

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

Chapter 1: Architecting for Innovation

Continuously delivering business value

By the skin of our teeth

Through high-velocity teamwork

Taking control of lead time

Risk mitigation

Decision making

Software Development Life Cycle methodology

Hardware provisioning

Software deployment

Software structure

Testing and confidence

Dependencies and inter-team communication

Dissecting integration styles

Batch integration

Spaghetti integration

Real-time integration

Enterprise application integration

Shared database

Service-oriented architecture

Microservices

Enabling autonomous teams with autonomous services

Autonomous services – creating bulkheads

Event-first – valuing facts

Serverless-first – creating knowledge

Data life cycle – fighting data gravity

Micro frontends – equalizing tiers

Observability – optimizing everything

Organic evolution – embracing change

Summary

Chapter 2: Defining Boundaries and Letting Go

Building on SOLID principles

Single Responsibility Principle

Open-Closed Principle

Liskov Substitution Principle

Interface Segregation Principle

Dependency Inversion Principle

Thinking about events first

Event storming

Verbs versus nouns

Facts versus ephemeral messages

Contracts versus notifications

React and evolve

Powered by an event hub

Dividing a system into autonomous subsystems

By actor

By business unit

By business capability

By data life cycle

By legacy system

Creating subsystem bulkheads

Decomposing a subsystem into autonomous services

Context diagram

Micro frontend

Event hub

Autonomous service patterns

Dissecting an autonomous service

Repository

CI/CD pipeline and GitOps

Tests

Stack

Persistence

Trilateral API

Functions

Micro-app

Shared libraries

Governing without impeding

Leveraging observability

Facilitating a culture of robustness

Audit continuously

Securing the perimeter

Elevating TestOps

Automating account creation

Summary

Section 2: Dissecting the Software Architecture Patterns

Chapter 3: Taming the Presentation Tier

Zigzagging through time

Client-side versus server-side rendering

Build-time versus runtime rendering

Web versus mobile

Breaking up the frontend monolith

By subsystem

By user activity

By device type

By version

Dissecting micro frontends

The main app

Micro-app

Micro-app activation

Mount points

Manifest deployer

Inter-application communication

Designing for offline-first

Transparency

Local cache

Live updates

Regional failover

Securing the user experience

OpenID Connect

Conditional rendering

Protected routes

Passing the JWT to BFF services

Observing real user activity

RUM

Synthetics

Summary

Chapter 4: Trusting Facts and Eventual Consistency

Living in an eventually consistent world

Staging

Consistency

Concurrency and partitions

Order tolerance and idempotence

Parallelism

Publishing to an event hub

Event bus

Domain events

Routing and channel topology

Dissecting the Event Sourcing pattern

Systemwide event sourcing

Event lake

Event streams

Micro event stores

Processing event streams

Batch size

Functional reactive programming

Unit of work

Filtering and multiplexing

Mapping

Connectors

Designing for failure

Backpressure and rate limiting

Poison events

Fault events

Resubmission

Optimizing throughput

Batch size

Asynchronous non-blocking I/O

Pipelines and multiplexing

Sharding

Batching and grouping

Observing throughput

Work metrics

Iterator age

Fault events

Accounting for regional failover

Protracted eventual consistency

Regional messaging channels

Summary

Chapter 5: Turning the Cloud into the Database

Escaping data's gravity

Competing demands

Insufficient capacity

Intractable volumes

Embracing data life cycle

Create phase

Use phase

Analyze phase

Archive phase

Turning the database inside out

The transaction log

Derived data

Dissecting the CQRS pattern

Systemwide CQRS

Materialized views

Inbound bulkheads

Live cache

Capacity per reader, per query

Keeping data lean

Projections

Time to live

Implementing idempotence and order tolerance

Deterministic identifiers

Inverse optimistic locking

Immutable event triggers

Modeling data for operational performance

Nodes, edges, and aggregates

Sharding and partition keys

Single table design examples

Leveraging change data capture

Database-first event sourcing

Soft deletes

Latching

Replicating across regions

Multi-master replication

Round-robin replication

Regional failover, protracted eventual consistency, and order tolerance

Observing resource metrics

Capacity

Throttling and errors

Performance

Redacting sensitive data

Envelope encryption

General Data Protection Regulation (GDPR)

Summary

Chapter 6: A Best Friend for the Frontend

Focusing on user activities

A BFF service is responsible for a single user activity

A BFF service is owned by the frontend team

Decoupled, autonomous, and resilient

Dissecting the Backend for Frontend (BFF) pattern

Datastore

API Gateway

Query and command functions

Listener function

Trigger function

Models and connectors

Choosing between GraphQL and REST

REST

GraphQL

Implementing different kinds of BFF services

Task BFF services

Search BFF services

Action BFF services

Dashboard BFF services

Reporting BFF services

Archive BFF services

Securing a BFF in depth

The perimeter

Federated identity

In transit

JWT authorizer

JWT assertion

JWT filter

Last modified by

Least privilege

At rest

Leveraging multiple regions

Latency-based routing

Regional health checks

Regional failover

Observing BFF metrics

Work metrics

Throttling and concurrency limits

Optimizing BFF performance

Function memory allocation

Cold starts

Timeouts and retries

cache-control

Summary

Chapter 7: Bridging Intersystem Gaps

Creating an anti-corruption layer

Dissecting the External Service Gateway pattern

Connectivity

Semantic transformation

Action versus reaction

Egress

Ingress

Packaging

Separate cloud accounts

Integrating with third-party systems

Egress – API call

Ingress – webhook

Asynchronous request response

Integrating with other subsystems

Egress – upstream subsystem

Ingress – downstream subsystem

Integrating across cloud providers

Integrating with legacy systems

Ingress – Change Data Capture

Egress – Direct SQL

Egress – circuit breaker

Ingress – relay

Egress – relay

Providing an external API and SPI

Ingress – event

Ingress – command

Egress – webhook

Egress – query

Tackling common data challenges

Idempotence

Enriching data

Latching and cross-referencing

Slow data resync

Managing shared secrets

Securing secrets

Using API keys

Addressing multi-regional differences

Egress routing and failover

Ingress routing and failover

Summary

Chapter 8: Reacting to Events with More Events

Promoting inter-service collaboration

Dissecting the Control Service pattern

collect

correlate

collate

evaluate

emit

expire

Orchestrating business processes

Entry and exit events

Parallel execution

Employing the Saga pattern

Compensating transactions

Abort events

Calculating event-sourcing snapshots

What is ACID 2.0?

Snapshot events

Implementing CEP logic

Decision tables

Missing events

Leveraging ML for control flow

Models

Predictions

Implementing multi-regional cron jobs

Job records and events

Replication and idempotence

Summary

Section 3: Putting Everything in Motion

Chapter 9: Choreographing Deployment and Delivery

Optimizing testing for continuous deployment

Continuous discovery

Continuous testing

Focusing on risk mitigation

Small batch size

Decoupling deployment from release

Feature flags

Fail forward fast

Achieving zero-downtime deployments

The Robustness principle

Between the frontend and its backend

Between producers and consumers

Between the backend and its data store

Planning at multiple levels

Experiments

Story backlog

Task roadmaps

Turning the crank

Task branch workflow

Continuous integration pipeline

Continuous deployment pipeline

Feature flipping

Summary

Chapter 10: Don't Delay, Start Experimenting

Gaining trust and changing culture

Establishing a vision

Building momentum

Constructing an architectural runway

Seed and split

Funding products, not projects

Architecture-driven

Team capacity-driven

Dissecting the Strangler pattern

Event-first migration

Micro frontend – headless mode

Retirement

Addressing event-first concerns

System of record versus source of truth

Duplicate data is good

Avoid false reuse

Poly everything

Polyglot programming

Polyglot persistence

Polycloud

Summary

Other Books You May Enjoy

Section 1: Establishing an Architectural Vision

In this section, we establish a vision for software architecture. Software architecture must enable change. We delve into the forces driving modern software architecture and enumerate the core concepts in this book. Then we get down to business and explain how architects can facilitate change by dividing up a system and defining boundaries so that teams can continuously deliver business value. Then we highlight how architects need to get out of the way and rely on the automation, observability, and governance safety nets they have put in place.

This section contains the following chapters:

Chapter 1, Architecting for InnovationChapter 2, Defining Boundaries and Letting Go