The Performance Cost of RwLock in Our Read-Heavy Workload

In one of my past interviews, I was discussing my previous work and mentioned that we used lock-free data structures in a service. The interviewer replied, People these days keep saying they use lock-free structures, but I don't know how beneficial they really are.

It was a fair question. And there is no right answer when it comes to choosing between locked or lock-free. It depends on what is being synchronized, how often the data is updated and what the read pattern looks like.

Here is a simplified version of one workload where we used both.