chapter seven

7 Eliminating work

 

This chapter covers

  • Eliminating work by taming algorithmic complexity
  • Reducing serialization overhead
  • Managing memory with low latency
  • Mitigating OS overhead
  • Replacing slow computations with precomputing

In the previous part of the book, we examined different techniques for organizing data when designing an application for low latency. The part introduced techniques that aim to reduce latency to ensure data access is not a latency bottleneck for your application:

  • Colocation brings two components closer together.
  • Replication maintains multiple (consistent) copies of the data.
  • Partitioning reduces synchronization costs.
  • Caching temporarily keeps a copy of the data.

In other words, we looked at how your data organization decisions impact latency and what you can do to mitigate that. In this third part of the book, we’re switching gears to explore how you can build low-latency applications from the computational perspective, focusing on how you can structure your application logic when building for low latency.

7.1 Ways of eliminating work

7.2 Algorithmic complexity

7.3 Serializing and deserializing

7.4 Memory management

7.4.1 Dynamic memory allocation

7.4.2 Garbage collection

7.4.3 Virtual and physical memory

7.4.4 Demand paging

7.4.5 Memory topology

7.5 Operating system overhead

7.5.1 Scheduling delay and context switching

7.5.2 Background tasks and interrupts

7.5.3 Network stack

7.6 Precomputation

7.7 Putting it together: Benchmarking with Criterion

Summary