Jump to ratings and reviews
Rate this book

Latency

Rate this book
Practical techniques for delivering low latency software.

Slow responses can kill good software. Whether it’s recovering microseconds lost while routing messages on a server or speeding up page loads that keep users waiting, finding and fixing latency can be a frustrating part of your work as a developer. This one-of-a-kind book shows you how to spot, understand, and respond to latency wherever it appears in your applications and infrastructure.

In Latency you’ll learn:

* What latency is—and what it is not
* How to model and measure latency
* Organizing your application data for low latency
* Making your code run faster
* Hiding latency when you can’t reduce it

Put simply, latency is the delay between a cause and effect. In practice, too much latency can create problems throughout a software system, ranging from inaccurate calculations and timeouts to impatient users simply abandoning your applications. Latency issues can be challenging to avoid and troubleshoot. This book balances theory with practical implementations, turning academic research into useful techniques you can apply to your projects.

about the book

Latency shows you how to troubleshoot latency issues in existing systems, and how to create low latency systems from the ground up. You’ll discover how your code runs differently on distributed systems, databases, and operating systems, and understand the common latency-causing issues in each situation. Hands-on projects help you apply what you learn.

You’ll write a latency benchmark harness to measure and visualize latency; and use colocation, partitioning, and caching to reduce latency in a REST API. Plus, tips, tricks, and author Pekka Enberg’s personal insights on latency ensure this book will remain a handy reference long after you’ve finished reading!

350 pages, Paperback

Published March 1, 2025

6 people are currently reading
46 people want to read

About the author

Pekka Enberg

2 books2 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
10 (90%)
4 stars
1 (9%)
3 stars
0 (0%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 6 of 6 reviews
Profile Image for Christoph Kappel.
477 reviews11 followers
June 5, 2024
A new book in MEAP and the first 59 available pages were phenomenal - content and explanation wise I felt reminded of Designing Data-Intensive Applications and this is an absolute must-read for the tech-savvy folks.

The examples are in Rust, which is also one of my favorite languages and I am absolute curious of the following chapters.
1 review
November 26, 2025
The title of this new book is deceptively simple. Anyone who has spent any amount of time sitting in front of a screen has experienced latency. Latency can be summed up succinctly as the time it takes to serve a request. Another way of stating it is that latency is the time spent waiting for "something" to finish. But what is that "something" exactly? That wait might be for a keystroke to appear on screen, a web page to render or a spinning beach ball to stop when opening a file. This book will help you build an intuition and understanding of what that something actually is. Practically, the aim of this book is how to understand, measure and reason about the sources of latency in a system. The chapters are a fun dive through all the layers that underpin our modern application stacks. The book starts out with some solid comp-sci theory regarding latency and how to measure it. It then moves on to things like networking, HTTP request serving, scaling and its common replication and sharding techniques. Lasstly it drills down into more of the OS internals and bare metal layer which covers such subjects as virtual memory/paging, locking and concurrency. I found this book to be a thoughtful and methodical progression through the subject. It's unusual to see a single topic book about a very complex subject that is written in a style that reads both fresh and accessible. It manages to avoid overly lengthy and dry passages common to many text books while still delivering the same practical knowledge and takeaways. I would categorize this as something of a reference book. The subject, explanations and much of the theory contains many fundamentals about computing in general. I believe there are many who might benefit and enjoy this book, from Front-end and Full Stack Engineers as well as SREs and maybe Technical Managers.
1 review
Read
November 25, 2025
I was one of the reviewers of the MEAP. My team and I worked through the examples of all the chapters and found the explanations and the code examples very helpful. It was even more beneficial for us as we were experimenting writing high performance code with Rust, even though the principles illustrated within the book are performance and low latency best practices and not specific to Rust. Highly recommended!
Profile Image for Valerie Parham-Thompson.
3 reviews
November 28, 2025
Latency, by Pekka Enberg, fills a gap in the performance tuning space. While many authors have written about database tuning, systems tuning, or code optimization, I haven't seen any come together to cover the whole stack in such a comprehensive way, targeting both software engineers and database architects. Enberg brings a wealth of experience tuning distributed systems, formerly at ScyllaDB and now as CTO at Turso (distributed SQLite).

Having a shared vocabulary across database, software, and infrastructure teams is critical when working together to tune latency issues. I've been in many incident rooms where the only report is "the application is slow" and had to unwind a series of questions: What do you mean by slow? Where do you see this? What parts are slow? If everyone in the room had read Enberg's Latency, solving these kinds of incidents would be much faster. As one example, Enberg breaks down network latency (a small but critical part of the stack) into propagation latency, transmission latency, processing latency, and queueing latency. As another, he clarifies the differences between system service time, wait time, and response time. Each of these can point to a different problem to solve. While he provides the basic math when discussing topics like this, it's quickly followed up by a plain-English description.

Being very clear on terminology helps as well when architecting an application. Enberg digs into every bit of the stack: from physics to hardware, virtualization to the operating system, the managed runtime, and the network, application, and data storage layers. For each optimization discussed, he doesn't just provide best practices but rather shares the tradeoffs and decision points. For example, he covers replication from various angles: replication topologies (single-leader, multi-writer, leaderless), staleness vs. speed (synchronous, asynchronous), and distributed algorithms (RAFT, Paxos, Viewstamped).

Each of the concepts is illustrated with a clear example, and the chapter is capped with a use case scenario. Specific examples are given using TigerBeetle, SQLite, and ScyllaDB; while these are indeed database examples, they are presented from the point of view of a database developer, not a database operator. Developing database software requires thinking very hard about how to reduce latency, and whatever software you are writing, you will benefit from the examples. Many of these scenarios include code you can execute to, as he says, "build intuition." These are often using Rust; even though he states that Rust is not critical to low-latency applications, the case is well-made throughout that you might consider it if you have these needs.

Unique to this presentation are sections on predictive techniques (like prefetching data based on user patterns), eliminating work (the fastest way to do something is not to do it), and "hiding" latency when you can't reduce it (sometimes a batch job is just going to have to update a lot of rows). He covers specific methods in these sections that you can incorporate into your application and operational practices, although if he wrote another book with more details around these concepts, I would read it.

A book that covers so much material risks becoming page after page of bulletpointed lists. Enberg avoids this by organizing the concepts by the layers of the stack, summarizing each optimization concisely followed by 1-2 iterations of depth, providing real-world examples, and including tradeoffs to guide decisions. It will be hard to use this guide as a quick fix; you really need to sit with the whole thing end-to-end, but it is worth it. Especially if you are in an incident room with me in the future.

PS Don't skip the Appendix for further reading. Again, this isn't just a list of resources but rather puts each one in context.
1 review
November 28, 2025
As someone who teaches systems and sees how little students learn about latency in traditional CS programs, I found this book exceptionally valuable. It explains latency from first principles and shows why it matters in real-world applications. The blend of clear explanations and practical techniques makes it stand out. This is the kind of book I wish every software engineer—and every university course—would include.
11 reviews
November 25, 2025
The book does a good job of explaining real latency issues and goes beyond the basic concepts.
Displaying 1 - 6 of 6 reviews

Can't find what you're looking for?

Get help and learn more about the design.