Mark Callaghan continues his research and benchmarking of MongoDB, TokuMX, and InnoDB. This post focuses on the impact of locks in MongoDB and the different solutions that were implemented over time in InnoDB. Fantastic read.
MongoDB and TokuMX saturated at a lower QPS rate then MySQL when running
read-only workloads on a cached database with high concurrency. Many of the
stalls were on the per-database RW-lock and I was curious about the benefit
from removing that lock. I hacked MongoDB to not use the RW-lock per query
(not safe for production) and repeated the test. I got less than 5% more QPS
at 32 concurrent clients. I expected more, looked at performance with PMP
and quickly realized there were several other sources of mutex contention
that are largely hidden by contention on the per-database RW-lock. So this
problem won’t be easy to fix but I think it can be fixed.
Original title and link: RW locks are hard