This chapter covers
- Picking a concurrency model for your application
- Reducing latency with data and task parallelism
- Understanding the effect of transaction isolation levels on concurrency
- Building intuition about the effect of database concurrency control algorithms on latency
Building on the last chapter’s deep dive into synchronization in latency-sensitive applications, we’ll now focus on improving application latency by exploiting concurrency more generally. While chapter 8 demonstrated how wait-free synchronization could mitigate the tail latency impacts of mutual exclusion, which is necessary when you cannot partition your data (a topic discussed in chapter 4), this chapter will examine concurrent execution more broadly.
Fundamentally, concurrency is the ability of a system to execute multiple tasks at the same time—a critical capability for low-latency systems that must handle long-running operations or I/O-bound tasks without blocking. Rather than letting a single slow operation become a bottleneck, well-designed concurrent systems can maintain responsiveness by switching between multiple tasks. In other words, instead of allowing a long-running operation to dominate the CPU or waiting for an I/O task to complete, concurrent execution can reduce latency by letting other tasks run at the same time.