Leanpub Header

Skip to main content

Topics

Software Performance

From latency, throughput and measurement to processors, runtimes, Linux, databases, load testing and model serving, software performance as told through the free samples of Leanpub books.

Created from the free samples of 10 Leanpub books and the descriptions and tables of contents of 5 more, with every source cited.

Software performance is the study of how quickly and how cheaply a program does its work, and performance engineering is the practice of measuring that behaviour, finding what limits it and changing the software or its environment on the evidence. One book defines the practice as understanding what the hardware does, measuring how the software interacts with it, and then making deliberate changes that improve the interaction.[3] Another puts the same point as a property of whole systems: performance emerges from hardware, operating system and workload together, and no single setting makes a system fast.[2]

The subject became every programmer's concern when processors stopped getting faster on their own. For decades each new generation of hardware absorbed the inefficiencies of the software written for it; since the middle of the 2000s the speed of a single core has grown slowly, and the extra transistors have gone into more cores, larger caches and specialised units.[3] Software that is to run faster now has to be written to suit the machine, and the bill for software that does not is paid in servers, in energy and in the patience of users.[4]

This article covers what performance means and how it is measured, the method the books share, the processor and memory underneath, language runtimes, the operating system, databases, performance testing, the serving of language models, and systems built for the lowest latency. Its sources are the free samples of ten Leanpub books and the descriptions and tables of contents of five more, all published in 2026. Most of the samples hold a book's introduction and first chapter, so the article is strongest on principles and method and cites the later, more detailed chapters only by what the contents say of them.

Where to start

The general reader has one obvious first book. Software Performance Engineering in 2026 (2026) goes through the whole stack a layer at a time, from processor and memory through runtimes, operating systems, storage, databases and networks to distributed systems, and is written for experienced engineers who want to know why an optimisation works.[1] A reader who wants the hardware first can take CPU Performance Engineering (2026), which assumes programming ability and some acquaintance with systems, and builds the rest from the ground up.[3]

After that the choice follows the reader's platform. Linux Performance Engineering & Server Benchmarking (2026) is for administrators and reliability engineers running production Linux.[2] High-Performance .NET: From JIT to Hardware (2026) assumes C# and general .NET development, and Next Generation Python (2026) assumes production experience with Python and a grasp of threads and locks.[4][5] Mastering SQL Performance Optimization (2026) can be read in order by a newcomer to query tuning or used as a reference by someone with experience.[6]

Testers have two starting points. Performance and Chaos Engineering: Breaking Things on Purpose (2026) is for quality engineers moving beyond functional testing, and AI Performance Engineering (2026) is a load tester's account of the fundamentals and of automating the repetitive parts of the work.[9][8] Engineers who run language models in production have vLLM and the Engineering of Fast LLM Inference (2026), which is advanced and specific to serving on graphics processors.[7]

What performance means

The books begin by taking the word apart, because people who ask for something to be made faster often mean different things. Latency is the time one operation takes. Throughput is the number of operations completed in a unit of time. Efficiency is the resource consumed for a given amount of work, whether processor time, memory, bandwidth or energy. Scalability is how well a system keeps its behaviour as load grows.[1] The four are related and can pull against each other: a cache lowers latency and uses memory, and batching raises throughput while adding delay to each operation in the batch.[1] Which matters most depends on the system. A trading system counts microseconds, a service that aggregates logs cares about volume, and an application on a battery cares about work done per unit of energy.[1]

Latency is a distribution and not a single number. Most operations may finish in a few milliseconds while a few take a hundred times as long, and in production the slowest one in a hundred or one in a thousand often matters more than the average, because it decides the experience of the unluckiest users and the reliability of the systems that depend on the answer.[2] A dashboard that shows a healthy average can hide a system that is unusable in its tail.[2][3]

The Linux book adds a distinction that is often missed, between utilisation and saturation. Utilisation is the share of time a resource is busy; saturation is demand exceeding supply, which shows as queues and waiting. A processor at thirty per cent utilisation can be saturated if many short tasks are competing for it, and a storage device at ninety per cent of its capacity can be serving requests quickly until a small rise in load lengthens the queue and latency climbs steeply.[2] The book's opening case is a slow service on which every familiar metric looks normal, and its argument is that the familiar metrics are not always the ones that matter.[2]

Measure first

Every book in the pool teaches the same order of work: measure, form a hypothesis, change one thing, and measure again. The layered guide opens with a payment service whose response time rose over several months from 45 to 180 milliseconds. Its team added servers and then database connections, and neither helped for long. The cause was a library update that made a serialisation routine allocate memory on every call, which under load produced pauses for garbage collection that spread through the services around it.[1] The book draws three lessons: symptoms are seldom causes, problems compound across layers, and a well-meant fix made without measurement can make matters worse.[1]

The same book sets the work out as a continuous cycle with six stages. Requirements state what good performance is in numbers that can be checked. A baseline records how the system behaves now. Profiling shows where time and resources actually go, on the ground that intuition about bottlenecks is unreliable. Optimisation changes what the profile identified. Validation repeats the baseline measurement, several times to allow for noise, and checks that nothing else got worse. Monitoring in production catches the regressions that come later.[1] The .NET book has its own version in seven steps, and describes the alternative as memorising tricks and applying micro-optimisations at random.[4]

The Linux book lists the mistakes that careful engineers still make: optimising the wrong metric, trusting a benchmark that does not resemble the production workload, treating one measurement as evidence, taking correlation for cause, changing too many settings, assuming that what worked on one machine will work on another, and copying a setting without understanding what it does.[2] It warns in particular against old tuning guides. Current kernels are well tuned by default, and a system with every parameter from a ten-year-old article applied may run worse than one left alone.[2] The processor book makes critical reading part of the skill, and gives a late chapter to checking a public reading list on its subject against primary sources.[3]

The machine underneath

A programmer pictures a program as statements executed in order. A modern processor guesses which way each branch will go and runs ahead before it knows, executes instructions out of order with dozens in flight at once, and keeps recently used data in small, fast caches that have to be kept consistent across cores.[3] Code that looks simple can run far slower than it need because it works against this machinery, and code that looks elaborate can be faster because it works with it.[3]

The cost that dominates is memory. On the figures one book gives, reading a register takes about one processor cycle, the first level of cache about four, the second ten to fifteen and the third thirty to fifty, while a read from main memory can take a hundred nanoseconds or more.[1] Two algorithms of the same theoretical complexity can therefore differ tenfold in practice. A pass through a contiguous array keeps its data in cache, and following pointers scattered across the heap stalls again and again while memory is fetched.[1] A wrong guess at a branch costs fifteen to twenty cycles of discarded work, so predictable control flow in the busiest code matters as well.[1] The same book uses this reasoning to test folklore: advice such as never using exceptions was sound for the implementations of its day, and a reader who knows the mechanism can judge whether it still holds.[1]

CPU Performance Engineering develops these subjects in order: the processor core, then the memory system, where it says most real problems lie, then parallelism, including vector instructions and threads, and then tools and method. Its measurements rest on the Linux perf tool, hardware performance counters, flame graphs and small benchmarks.[3] Vector instructions, which apply one operation to several values at once, have a book to themselves in Vectorized C++. By its description it starts from data layout, covers the x86 and ARM instruction sets and the choice of code path at run time, and insists on inspecting the generated instructions and measuring before a speed-up is claimed.[13] It has no sample.

Runtimes and languages

Between the source code and the processor sits a runtime, and two of the books follow one from top to bottom.

.NET

High-Performance .NET: From JIT to Hardware traces a C# program through each stage: compilation to an intermediate language, loading by the runtime, translation to machine code by the just-in-time compiler, memory management by the garbage collector, scheduling by the operating system and execution on the processor. Each layer can add overhead and each can be tuned.[4] Its argument is that most developers stop thinking at the level of the language. They know that objects live on the heap, and do not know why allocating a small object millions of times can become a serious problem.[4]

Its worked example is a service that parses requests with a general-purpose library and allocates about fifteen kilobytes of short-lived objects for each. At five hundred requests a second the garbage collector keeps up and every dashboard looks healthy. At three thousand, some objects survive long enough to be promoted to the oldest generation, whose collections take 50 to 100 milliseconds and hold up every request while they run. Adding memory postpones the pauses and does not remove them.[4] The book describes the pattern as hidden costs that compound, from allocation to collection to latency to queueing and then to timeouts.[4] It is built on .NET 8 and C# 12.[4]

EF Core Performance Cookbook works one layer up, on the data-access library most .NET services use. It is a short book of recipes, each a problem, its diagnosis, a fix and a comparison before and after, covering queries issued once per row, projections, change tracking, indexes and bulk operations.[12] It has no sample, and its description says it was written with the assistance of AI under its author's direction.

Python

Next Generation Python separates four kinds of slowness that share one reputation. Some code is slow because its algorithm is poor, which is true in any language. Some is slow because of the object model: an integer is a structure on the heap with a reference count and a type, and a list is an array of pointers to such structures. Some is slow because the standard implementation interprets bytecode one instruction at a time. And some is slow because a global lock in the interpreter has allowed only one thread at a time to execute Python code, so that threads on a sixteen-core machine used one core for work bound by the processor.[5] Each kind has its own remedy, and telling them apart comes first.[5]

The book is organised around three changes. A build of the interpreter without the global lock arrived with Python 3.13 and is officially supported from 3.14, so that threads can run Python code in parallel. Rust has become a common language for extension modules, with a binding library and build tool that several widely used packages already depend on. And the interpreter itself has become faster through adaptive specialisation, beside the older routes of array libraries, compilers and alternative implementations.[5] Its stated position is that the aim is measured decisions and that it will not tell the reader to rewrite everything in Rust.[5]

The operating system

Linux Performance Engineering & Server Benchmarking treats the kernel as the place where an application's demands meet the hardware. Its examples show why a setting cannot be judged apart from the workload. Changing the scheduler for disk requests may help one pattern of access and hurt another. Turning off transparent huge pages may remove latency spikes or may slow a memory-hungry program. Larger network buffers may raise throughput on one link and add delay on a congested one.[2] Its working rule is to model the system, predict the effect of a change, measure the outcome and repeat, with a way to undo any change made in production.[2]

The book explains each subsystem's mechanism before it offers tuning advice, then covers tracing and profiling tools, the design of benchmarks, production tuning and case studies.[2] On instruments, it holds that the metrics collected in normal operation should be enough to diagnose most problems without installing anything during an incident, and that tracing built on eBPF now gives a view into the kernel at low cost, beside older tools that remain useful for a quick look and for comparison over time.[2]

Databases

A slow query is the commonest performance complaint in business software, and Mastering SQL Performance Optimization rests on the premise that tuning one is a matter of knowing how a database works inside, not of memorised tricks.[6] It follows a statement from text to result and treats every technique as a way of changing a decision made somewhere along that path. Its chapters go from execution plans and indexes through joins, aggregation and sorting to schema design, isolation and locking, memory and input and output, where no rewriting of a query can help.[6] It compares five database systems and recommends PostgreSQL as the one to learn on, for the detail of the plans it prints.[6]

The book is careful about its own numbers. Its timings come from tests on its sample database and are offered as illustrations, on the ground that the reader's hardware, data volume and version will differ; what carries over is the size of the difference between two approaches and the technique that produced it.[6] The advice that follows is the advice of every other book here: measure on one's own data, since a change that helps one query can hurt another.[6]

Performance testing

Performance testing asks whether a system will hold up under the load it is going to meet, before it meets it. AI Performance Engineering calls it risk mitigation and names four things a team must get right whatever its tools: a clear objective, sound planning, proper execution and analysis.[8] An objective is a risk that can be stated in a sentence. A spike test, a soak test and a capacity test answer different questions, and the author describes a team that spent three weeks on a well-built test and could not say what response time would have counted as a pass.[8]

Planning covers the load profile, the environment and the data. The same author recounts a retail system tested with a steady two hundred users for half an hour and declared ready; on its first day twelve hundred arrived in ninety seconds, the pool of database connections filled, requests queued and the site began returning errors.[8] An environment with half of production's servers and a quarter of its data is, in his words, a different system, and a search that is quick against a thousand records may take seconds against ten million.[8] The rest of the book describes software agents he built to take over the repetitive parts of scripting and checking, with a comparison of the time taken by hand and with them.[8]

Performance and Chaos Engineering: Breaking Things on Purpose places such tests in a delivery pipeline as a series of stages: checks at build time, page-speed audits and latency budgets for each interface on every change, a full load test before release, chaos experiments afterwards and continuous validation in production. Each catches a different class of fault.[9] It teaches load testing with k6 and Locust and chaos engineering, the deliberate injection of faults to see whether a system recovers, with LitmusChaos, and it pairs reliability with speed: a slow payment service ties up connections in the service that calls it, and the failure passes along the chain until the whole application stops responding.[9]

Serving language models

The newest workload in the pool is inference, the running of a trained language model to answer requests. vLLM and the Engineering of Fast LLM Inference explains why it is hard to do quickly. A request has two phases of opposite character. Prefill processes the whole prompt in parallel and is limited by computation. Decode produces one token at a time, and each step has to read a cache of earlier results that grows as the answer does, so it is limited by memory.[7] A server tuned for one phase starves the other. Two measures describe what a user feels: the time to the first token, set mostly by prefill, and the interval between tokens, set by decode.[7]

The book uses the open-source engine vLLM as its case study and follows one request through it. A scheduler decides which requests join the next pass within a budget of tokens, giving priority to those already generating; the cache is handed out in small fixed blocks from a free pool, much as an operating system pages memory; and the model runs on the graphics processor.[7] If any stage lags, the processor idles or requests wait, which is why the book treats serving as a problem of memory, scheduling and parallelism together.[7]

Two books without samples carry the subject further. Rethinking Performance Engineering for Agentic AI argues that methods built for requests that each do about the same work fail for software agents, which decide while running how many calls to a model and to tools a request needs; it proposes latency budgets with planned degradation, limits on an agent's autonomy and a budget of tokens for each trace.[11] Chaos Engineering for AI Infrastructure applies fault injection to model infrastructure, where a failure may be an answer that has become worse while latency and error rates stay normal.[15]

The lowest latencies

Electronic trading is the field where a microsecond is worth money, and three books by one author address it. The sample of Bare-Metal FPGA Acceleration for C++ Trading Systems accounts for where the time goes in a C++ system that has already been tuned. A market-data message takes one to three microseconds to travel from the network card into the program even when the kernel's network stack is bypassed, and ten to thirty when it is not. Parsing takes a few hundred nanoseconds, updating the order book and deciding takes a few hundred more, and the reply pays the first cost again, for three to seven microseconds from end to end.[10] Most of that lies below anything a profiler shows as a function, in interrupts, copies and the boundary between the program and the wire, and an interruption of a pinned thread that happens once in several hundred milliseconds will dominate the tail of the distribution however fast the median is.[10]

The book's answer is to move the reading of market data and a bounded part of the decision into programmable hardware, and to record after each chapter what moved and how much time it saved against the software baseline.[10] Its companion, Ultra-Low-Latency C++ Trading Systems, concerns what happens when a matching engine, a risk check, a data feed and a hardware gateway that each pass their own tests are joined into one system, and treats a shared latency budget and explicit contracts at each boundary as the work.[14] It is cited from its description.

Questions about Software Performance

Which book on software performance should I start with?

Software Performance Engineering in 2026 (2026) covers the whole stack a layer at a time for experienced engineers.[1] A reader who wants the hardware first can begin with CPU Performance Engineering (2026), and one who runs production servers with Linux Performance Engineering & Server Benchmarking (2026).[3][2]

What is the difference between latency and throughput?

Latency is the time one operation takes, and throughput is the number of operations completed in a unit of time.[1] They can pull against each other: batching raises throughput and adds delay to each operation in the batch.[1]

Why does tail latency matter more than the average?

Latency is a distribution, and the slowest one request in a hundred or a thousand decides the experience of the unluckiest users and the reliability of the systems that depend on the answer.[2] A healthy average can hide a system that is unusable in its tail.[2]

Why should I profile before optimising?

Intuition about where a program spends its time is unreliable, and a profile shows where time and resources actually go.[1] In one book's opening case a team added servers and database connections to a slowing service whose real fault was a library allocating memory on every call.[1]

Why is Python slow?

One book separates four causes: poor algorithms, the overhead of Python's objects, the interpretation of bytecode, and a global lock that has allowed only one thread at a time to run Python code.[5] Each has a different remedy, and a build of the interpreter without the lock is officially supported from Python 3.14.[5]

What is the difference between a load test and a spike test?

Each kind of test answers a different question about risk, so the objective has to be stated before the test is built.[8] One author describes a system that passed a steady test at two hundred users and failed on its first day when twelve hundred arrived in ninety seconds, which a spike test with realistic arrivals would have shown.[8]

Sources

Every source is a Leanpub book or course. The note after each says which part of it was read; where no sample was available, only the public description and table of contents were used.

  1. 1.
    Software Performance Engineering in 2026, Steve Publications: A Practical Guide to Building Fast, Scalable Systems from Hardware to Distributed Architecture Free sample: the introduction and chapter 1 on the dimensions of performance, the performance lifecycle, reasoning from hardware costs and common anti-patterns. 2026. Free sample: PDF · EPUB
  2. 2.
    Linux Performance Engineering & Server Benchmarking, Steve Publications: From Kernel Internals to Production Optimization Free sample: the introduction on latency, throughput, utilisation and saturation, measurement and common pitfalls, and the opening of chapter 1 on workloads. 2026. Free sample: PDF · EPUB
  3. 3.
    CPU Performance Engineering, Steve Publications: From Architecture to Optimization - A Practical Guide to Making Software Faster Free sample: the introduction, the plan of the book and the opening of chapter 1 on why processor performance matters. 2026. Free sample: PDF · EPUB
  4. 4.
    High-Performance .NET: From JIT to Hardware, Steve Publications: A Systems-Level Guide to Writing Fast .NET Applications Free sample: the introduction and part of chapter 1 on the cost of slow software, throughput and latency, and the layers from C# to the processor. 2026. Free sample: PDF · EPUB
  5. 5.
    Next Generation Python, Steve Publications: Free-Threading, Rust Extensions, and High-Performance Python Free sample: the introduction and chapter 1 on the kinds of slowness in Python, throughput and latency, and the history of the global interpreter lock. 2026. Free sample: PDF · EPUB
  6. 6.
    Mastering SQL Performance Optimization, Steve Publications: From Query Fundamentals to Production-Grade Tuning Across Database Platforms Free sample: the introduction, the setup of the sample databases and the opening of chapter 1 on how a query is processed. 2026. Free sample: PDF · EPUB
  7. 7.
    vLLM and the Engineering of Fast LLM Inference, Steve Publications: A Systems Guide to High-Performance Large Language Model Serving Free sample: the introduction and the opening chapter on why inference is hard, the two phases of a request and its path through the engine. 2026. Free sample: PDF · EPUB
  8. 8.
    AI Performance Engineering, David Campbell: How Agentic AI is Transforming Load Testing Free sample: the foreword and chapter 1 on the fundamentals of performance testing. 2026. Free sample: PDF
  9. 9.
    Performance and Chaos Engineering: Breaking Things on Purpose, Yuri Syuganov: Load Testing, Stress Testing, and Resilience Engineering Free sample: the introduction and chapter 1 on the cost of slow and unreliable software and the testing lifecycle. 2026. Free sample: PDF
  10. 10.
    Bare-Metal FPGA Acceleration for C++ Trading Systems, Weston Ashgrove: HDL Design, PCIe/DMA Transfer, and Clock-Domain Synchronization for Sub-Micro second Execution. Free sample: the introduction and the opening of chapter 1 on where time goes in a tuned software path. 2026. Free sample: PDF
  11. 11.
    Rethinking Performance Engineering for Agentic AI, Kandasamy Selvaraj: A Practitioner's Guide to Performance, Latency Budgets, and Production-Grade Observability for Scalable Enterprise Agentic AI No sample: from the description and table of contents. 2026.
  12. 12.
    EF Core Performance Cookbook, Krzysztof Kołek No sample: from the description. 2026.
  13. 13.
    Vectorized C++, Weston Ashgrove: SIMD Intrinsics, AVX-512, ARM NEON, and std::simd — From Data Layout and Hardware Dispatch to Production Deployment No sample: from the description. 2026.
  14. 14.
    Ultra-Low-Latency C++ Trading Systems, Weston Ashgrove: Integrating Matching Engines, Risk Controls, and FPGA Execution into a Single Deterministic Pipeline. No sample: from the description. 2026.
  15. 15.
    Chaos Engineering for AI Infrastructure, GitforGits | Asian Publishing House: Fault injection and resilience testing for GPUs, model serving, RAG pipelines, and agentic systems on Kubernetes No sample: from the description. 2026.

Further reading

Other books in the library on the same ground, not cited above.

  • PostgreSQL Under Load: Connections, Transactions, MVCC and Concurrency, Steve Publications: A definitive guide to operating PostgreSQL reliably under real-world production workloads. How PostgreSQL behaves under heavy concurrency, from connections and locking to vacuum and replication lag. 2026. Free sample: PDF · EPUB
  • Building High-Performance LLM Inference Engines in C, Steve Publications: From Transformer Fundamentals to a Complete SafeTensors Inference Runtime A language-model inference engine built in C, then verified, profiled and optimised. 2026. Free sample: PDF · EPUB
  • Running LLMs on Tiny Hardware, Steve Publications: A Systems Engineer's Guide to Edge Inference on Resource-Constrained Devices Language-model inference on microcontrollers and single-board computers, treated as a problem of memory bandwidth. 2026. Free sample: PDF · EPUB
  • Concurrent Programming in Java, Florin Radu: From Traditional Threads to Project Loom Concurrent programming in Java from threads and locks to virtual threads and structured concurrency. 2026. Free sample: PDF · EPUB

This is an article created from the free samples of 10 Leanpub books and the descriptions and tables of contents of 5 more. We're building these articles to provide you, the Leanpub reader, with a good jumping-off point to discover more Leanpub books that are interesting and relevant to you. We never use material which is paid-only when building these articles: we only use material which is already free on Leanpub. However, Leanpub authors can opt out from inclusion in articles from their book settings page.

Updated November 2026.

In the Leanpub store: 33 books in the Performance Engineering category · also filed under Performance Testing

All topics