Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorEvan Anderson

Explore the theory and practice of designing and writing serverless applications using examples from the Knative project. With this practical guide, mid-level to senior application developers and team managers will learn when and why to target serverless platforms when developing microservices or applications. Along the way, you’ll also discover warning signs that suggest cases when serverless might cause you more trouble than joy. Drawing on author Evan Anderson’s 15 years of experience developing and maintaining applications in the cloud, and more than 6 years of experience with serverless platforms at scale, this book acts as your guide into the high-velocity world of serverless application development. You’ll come to appreciate why Knative is the most widely adopted open source serverless platform available. With this book, you will: • Learn what serverless is, how it works, and why teams are adopting it • Understand the benefits of Knative for cloud native development teams • Learn how to build a serverless application on Knative • Explore the challenges serverless introduces for debugging and the tools that can help improve it • Learn why event-driven architecture and serverless compute are complementary but distinct • Understand when a serverless approach might not be the right system design

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# Building Serverless Applications on Knative ## 【One-Line Pitch】 A practical, theory-grounded guide for mid-level to senior developers and team leads who want to understand when and why to adopt serverless computing, and how to build real applications on Knative—the most widely adopted open source serverless platform. ## 【Book Arc】 - **Opening (~0%–9%)**: Defines what serverless actually means, tracing its evolution from mainframes through distributed computing and microservices, and explains the economics of cloud providers that make serverless viable. - **Early (~9%–25%)**: Introduces the core concept of "units of work" and how serverless platforms automate the "undifferentiated heavy lifting" of distributed computing—failover, replication, request routing, and even observability. - **Early (~25%–34%)**: Walks through the full lifecycle of a serverless instance—placement, initialization, code fetching, network configuration, and security isolation—then transitions into hands-on setup with Knative Serving on a local Kubernetes cluster. - **Middle (~34%–44%)**: Builds a real application step by step: creating a basic web UI with React and Material UI, packaging it as a container, and deploying to Knative. Includes a detailed look at how Knative handles HTTP requests through its load balancer, activator, and autoscaler components. - **Middle (~44%–47%)**: Addresses API design challenges—specifically why aggregating multiple data sources into a single endpoint creates reliability and performance problems, and how decomposing APIs into separate endpoints enables better scaling and failure management. ## 【Key Takeaways】 - **Serverless means thinking in application-level units, not servers** (Early): The goal is to let developers scale in terms that make sense for their application rather than managing virtual machines or processes. This shifts focus from infrastructure to business logic. - **Cloud provider economics drive serverless adoption** (Opening): Providers multiplex physical hardware across many customers, making it cheap to rent computing power on demand. This creates attractive economics for businesses with variable or unpredictable demand. - **Serverless automates "undifferentiated heavy lifting"** (Early): Platforms handle failover, replication, request routing, and even basic observability automatically—measuring request latency and throughput without requiring application instrumentation. - **Instance initialization involves many hidden steps** (Early): Before your code runs, the platform must fetch artifacts and configuration, mount filesystems, configure networking, set up resource isolation, and enforce security policies—all of which affect cold start latency. - **Knative's request flow is a three-stage pipeline** (Middle): Requests pass through a load balancer (which routes by hostname), then an activator (which checks for available pods and triggers autoscaling), and finally to the pod itself—which has no awareness of the routing lifecycle. - **Aggregating APIs creates reliability and performance bottlenecks** (Middle): Bundling multiple backend calls into one endpoint means any single failure breaks the whole response, and all data is limited by the slowest backend. Decomposing into separate endpoints enables independent scaling and failure management. - **Key-value stores complement serverless scaling** (Middle): Distributed storage systems designed for horizontal scaling (Redis, Cassandra, MongoDB) work better with serverless than traditional databases with fixed connection limits, which can become bottlenecks when many instances spin up. ## 【Reading Tips】 - **Skim the cloud provider economics section** (Opening): The math is straightforward and mainly sets context—you can move quickly to the more substantive serverless definitions. - **Deep-read the "Life of a Request" section** (Middle): Understanding the load balancer → activator → autoscaler → pod flow is essential for debugging performance issues and configuring Knative behavior. - **Pay close attention to the instance initialization checklist** (Early): This explains why cold starts happen and what factors contribute to latency—critical knowledge for designing responsive serverless applications. - **Work through the hands-on example** (Early–Middle): The book builds a real application incrementally; following along with the code will cement the concepts far better than reading alone. - **Note the API decomposition discussion** (Middle): This is where the book shifts from theory to practical design guidance—the dashboard example illustrates common pitfalls in a relatable way. ## 【Coverage Limits】 The excerpts cover the book's theoretical foundations, hands-on Knative setup, request handling internals, and API design principles. They do not cover the later chapters on event-driven architecture, debugging serverless applications, business value analysis, or when to avoid serverless—though the table of contents indicates these topics are addressed later in the book. ##
Page 5
. . . . . . . . . . . . . . 3 Why Is It Called Serverless? 5 A Bit of Terminology 6 What’s a “Unit of Work”? 7 Connections 8 Requests 9 Events 10 It’s Not (J...
View in text
Excerpt 2
e twelve-factor application model, which spells out several 2 “Server units” could either represent virtual/physical machines or server processes running on...
View in text
Excerpt 3
g the APIs that your apps will call. Setup for This Chapter All the files and directions for this chapter can be found on GitHub. Each section cor‐ responds...
View in text
Excerpt 4
/news/<source> News feed /ai-art/<prompt> AI-generated art API Gateways and Composing an App | 39 open multiple connections from a single instance. While the...
View in text
Excerpt 5
ane as components that need to directly handle each request. In this section, we’ll give a tour of the Knative Serving data plane, tracing the different comp...
View in text
Excerpt 6
o longer a concern if library X for language A implements a different set of message-processing features than library Y for language B. For exam‐ ple, the Ka...
View in text
Excerpt 7
andle 10 Lists, and allocate 10 CPUs to handle 10 Predicts. You’ll never have both happening at once, but you need to plan for the worst case of each. If you...
View in text
Excerpt 8
hesizes the easily divided parts into a more coherent whole. Physical simulations, stream processing, and neural network training are all examples where some...
View in text
Tags
AI categories
Cloud NativeBackendTechnology
ISBN: 1098142071
Publisher: O'Reilly Media
Publish Year: 2023
Language: English
Pages: 252
File Format: PDF
File Size: 5.3 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…