Systems Performance
Enterprise and the Cloud
Second Edition
Brendan Gregg
Boston Columbus New York San Francisco Amsterdam Cape Town
Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City
So Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at or (800) 382-3419.
For government sales inquiries, please contact .
For questions about sales outside the U.S., please contact .
Visit us on the Web: informit.com/aw
Library of Congress Control Number: 2020944455
Copyright 2021 Pearson Education, Inc.
All rights reserved. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit www.pearson.com/permissions.
Cover images by Brendan Gregg
Page : Screenshot of System metrics GUI (Grafana) 2020 Grafana Labs
Page : Screenshot of Firefox timeline chart Netflix
Page : Screenshot of sar(1) sadf(1) SVG output 2010 W3C
Page : Screenshot of Wireshark screenshot Wireshark
Page : Screenshot of KernelShark KernelShark
ISBN-13: 978-0-13-682015-4
ISBN-10: 0-13-682015-8
ScoutAutomatedPrintCode
Publisher
Mark L. Taub
Executive Editor
Greg Doench
Managing Producer
Sandra Schroeder
Sr. Content Producer
Julie B. Nahil
Project Manager
Rachel Paul
Copy Editor
Kim Wimpsett
Indexer
Ted Laux
Proofreader
Rachel Paul
Compositor
The CIP Group
For Deirdr Straughan,
an amazing person in technology,
and an amazing personwe did it.
Preface
There are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknownsthere are things we do not know we dont know.
U.S. Secretary of Defense Donald Rumsfeld, February 12, 2002
While the previous statement was met with chuckles from those attending the press briefing, it summarizes an important principle that is as relevant in complex technical systems as it is in geopolitics: performance issues can originate from anywhere, including areas of the system that you know nothing about and you are therefore not checking (the unknown unknowns). This book may reveal many of these areas, while providing methodologies and tools for their analysis.
About This Edition
I wrote the first edition eight years ago and designed it to have a long shelf life. Chapters are structured to first cover durable skills (models, architecture, and methodologies) and then faster-changing skills (tools and tuning) as example implementations. While the example tools and tuning will go out of date, the durable skills show you how to stay updated.
There has been a large addition to Linux in the past eight years: Extended BPF, a kernel technology that powers a new generation of performance analysis tools, which is used by companies including Netflix and Facebook. I have included a BPF chapter and BPF tools in this new edition, and I have also published a deeper reference on the topic . The Linux perf and Ftrace tools have also seen many developments, and I have added separate chapters for them as well. The Linux kernel has gained many performance features and technologies, also covered. The hypervisors that drive cloud computing virtual machines, and container technologies, have also changed considerably; that content has been updated.
The first edition covered both Linux and Solaris equally. Solaris market share has shrunk considerably in the meantime , so the Solaris content has been largely removed from this edition, making room for more Linux content to be included. However, your understanding of an operating system or kernel can be enhanced by considering an alternative, for perspective. For that reason, some mentions of Solaris and other operating systems are included in this edition.
For the past six years I have been a senior performance engineer at Netflix, applying the field of systems performance to the Netflix microservices environment. Ive worked on the performance of hypervisors, containers, runtimes, kernels, databases, and applications. Ive developed new methodologies and tools as needed, and worked with experts in cloud performance and Linux kernel engineering. These experiences have contributed to improving this edition.
About This Book
Welcome to Systems Performance: Enterprise and the Cloud, 2nd Edition! This book is about the performance of operating systems and of applications from the operating system context, and it is written for both enterprise server and cloud computing environments. Much of the material in this book can also aid your analysis of client devices and desktop operating systems. My aim is to help you get the most out of your systems, whatever they are.