Data-Driven Performance Optimization
Bartłomiej Płotka
Go#
CPU#
Data-Driven#
With technological advancements, fast markets, and higher complexity of systems, software engineers tend to skip the uncomfortable topic of software efficiency. However, tactical, observability-driven performance optimizations are vital for every product to save money and ensure business success.
With this book, any engineer can learn how to approach software efficiency effectively, professionally, and without stress. Author Bartłomiej Płotka provides the tools and knowledge required to make your systems faster and less resource-hungry. Efficient Go guides you in achieving better day-to-day efficiency using Go. In addition, most content is language-agnostic, allowing you to bring small but effective habits to your programming or product management cycles.
This book shows you how to:
Table of Contents
Chapter 1. Software Efficiency Matters
Chapter 2. Efficient Introduction to Go
Chapter 3. Conquering Efficiency
Chapter 4. How Go Uses the CPU Resource (or Two)
Chapter 5. How Go Uses Memory Resource
Chapter 6. Efficiency Observability
Chapter 7. Data-Driven Efficiency Assessment
Chapter 8. Benchmarking
Chapter 9. Data-Driven Bottleneck Analysis
Chapter 10. Optimization Examples
Chapter 11. Optimization Patterns
Who This Book Is For
Efficient Go focuses on giving the tools and knowledge necessary to answer when and how to apply efficiency optimization, depending strongly on circumstances and your organization’s goals. As a result, the primary audience for this book is software developers designing, creating, or changing programs written in Go and any other modern language. It should be a software engineer’s job to be an expert on ensuring the software they create works within both functional and efficiency requirements. Ideally, you have some basic programming skills when starting this book.
I believe this book is also useful to those who primarily operate software somebody else writes, e.g., DevOps engineers, SRE, sysadmins, and platform teams. There are many optimization design levels (as discussed in “Optimization Design Levels”). Sometimes it makes sense to invest in software optimizations, and sometimes we might need to address it on other levels! Moreover, to achieve reliable efficiency, software engineers have to benchmark and experiment a lot with production-like environments (as explained in Chapter 6), which usually means close collaboration with platform teams.
Finally, the observability practices explained in Chapter 6 are state-of-the-art tools recommended for modern platform engineering. I am a strong proponent of avoiding differentiating between application performance monitoring (APM) and observability for SRE. If you hear that differentiation, it’s mostly coming from vendors who want you to pay more or feel like they have more features. As I will explain, we can reuse the same tools, instrumentations, and signals across all software observations. Generally, we are on the same team—we want to build better products!
How This Book Is Organized
This book is organized into 11 chapters. In Chapter 1, we discuss efficiency and why it matters. Then, in Chapter 2, I briefly introduce Go with efficiency in mind. Then, in Chapter 3, we will talk about optimizations and how to think about them and approach those. Efficiency improvements can take enormous amounts of your time, but systematic approaches help you save a lot of time and effort.
In Chapters 4 and 5, I will explain all you need to know about latency, CPU, and memory resources, as well as how OS and Go abstract them.
Then we will move on to what it means to perform data-driven decisions around software efficiency. We will start with Chapter 6. Then we will discuss the reliability of experiments and complexity analysis in Chapter 7. Finally, I will explain benchmarking and profiling techniques in Chapters 8 and 9.
Last but not least, I will show you various examples of different optimization situations in Chapter 10. Finally, in Chapter 11, we will take a few learnings and summarize various efficiency patterns and tricks we see in the Go community.
Bartlomiej Plotka is a Principal Software Engineer at Red Hat with a background in SRE. Working primarily on observability topics, he helped to build many popular, reliable, performance, and efficiency-oriented distributed systems in Go. He is a core maintainer of various open-source projects including the CNCF Prometheus (https://prometheus.io/), libraries in the gRPC ecosystem, and more. In 2017 he created, together with Fabian Reinartz, a popular, open source distributed time series database. Focused on cheap and efficient metric monitoring, written in Go and called Thanos (http://thanos.io/), it went through hundreds of performance and efficiency focused improvements and researches. Developing in Go since 2014, Bartekâ??s passion was always to focus on the readability, reliability, and efficiency aspect of the language. On the way, Bartek helped to develop many tools, blog posts and even created opinionated Go code style to teach others on writing pragmatic, but efficient Go applications.