Cache Shared Data

Anytime you can skip a visit to a critical section, you are looking at a scalability gain. The simplest application of this idea is by caching shared data and reusing it in future access without needing to lock and unlock a shared resource. This was actually the single biggest scalability optimization that we made to our original Web server design and implementation. Initially, not only did it not scale, it had actually exhibited fractional scaling—throughput was slashed in half when we moved from a uniprocessor to a 4-way SMP. Something was seriously wrong.

We have already described the overall design of our Web server earlier in this chapter. We had a 1-1 mapping between threads and requests. A pool of available threads had ...

Get Efficient C++ Performance Programming Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.