Buy Percona ServicesBuy Now!

Improved InnoDB rw_lock patch

 | October 20, 2008 |  Posted In: Percona Software


There is patch from Google to improve SMP performance , but for some workloads it showed for us reverse scalability.
E.g. update_key benchmark from sysbench. There are also results with Yasufumi’s rw_locks (

Threads Standard InnoDB Google smpfix Yasufumi rw_lock
1 9700.28 10601.96 9432.44
2 14355.66 16673.31 12783.58
4 16104.20 2669.39 6308.92
8 18507.55 780.22 1854.43
16 16178.09 842.73 1601.05
32 12337.50 2028.89 3274.13
64 7801.18 1911.94 4043.85

results are in tps, more are better

(result in tps, more is better)
The benchmark was made on 8cores box, and as you see for 4+ threads we have worse results than for 2 threads. That is was main reason why we did not include InnoDB smp fixes in our build yet.

Fortunately we get fixed version of Yasufumu’s rw_locks and you can download them there

The results for the same benchmark:

Threads Standard InnoDB Yasufumi rw_lock ver 2
1 9700.28 9812.18
2 14355.66 14602.46
4 16104.20 18726.22
8 18507.55 19099.80
16 16178.09 17470.22
32 12337.50 12407.24
64 7801.18 7669.73

And for other workloads new rw_locks show results comparable with Google’s smpfix, so we will include
innodb_rw_lock into our next -percona-highperf release

Vadim Tkachenko

Vadim Tkachenko co-founded Percona in 2006 and serves as its Chief Technology Officer. Vadim leads Percona Labs, which focuses on technology research and performance evaluations of Percona’s and third-party products. Percona Labs designs no-gimmick tests of hardware, filesystems, storage engines, and databases that surpass the standard performance and functionality scenario benchmarks. Vadim’s expertise in LAMP performance and multi-threaded programming help optimize MySQL and InnoDB internals to take full advantage of modern hardware. Oracle Corporation and its predecessors have incorporated Vadim’s source code patches into the mainstream MySQL and InnoDB products. He also co-authored the book High Performance MySQL: Optimization, Backups, and Replication 3rd Edition.


  • Many thanks to Yasufumi for his innodb_rw_lock patch. I was close to loosing my trust in FreeBSD before applying the patch. Running our 7G InnoDB database on MySql 5.0.67 on FreeBSD 7.0 on a 8core Box we had severe context-switching problems without the patch. After applying it it works like a charm. Close to no contentions left!

Comments are closed