3 Colocation
This chapter covers
- Colocating code and data as a latency optimization
- Optimizing for low latency in distributed systems
- Optimizing for low latency in multicore systems
Welcome to the second part of the book!
In the book's first part in Chapters 1 and 2, we explored latency as a performance metric and how to model and measure it, an essential prerequisite for optimizing for low latency. In this book's second part, we'll focus on the various techniques for optimizing latency from a data perspective. The technique we will look at in this chapter is colocation.
Colocation is a technique where you bring two components closer to each other to reduce access latency. For example, if your application is accessing data in a database, the closer you can bring the database, the faster you can access the data. And if you can bring data into your application with an embedded database, you eliminate data movement over the network.
Colocation can also help when your application is communicating with other systems. For example, high-frequency traders discovered long ago that if you have your automated trading system server in the same data center as the exchange where you are trading, you have a latency advantage over those who don’t.
So, with that in mind, let’s dive into colocation!