This is part 3 of my Tyrant extra’s, part 1 focused on durability, part 2 focused on the perceived performance wall.
#3.Â Tokyo Cabinet Can have only a single writer thread, bottlenecking performance
When writing an application using Tokyo Cabinet only one connection can be opened as a â€œwriterâ€Â while the rest are readers.Â Tyrant allows for multiple â€œwritesâ€Â to be sent in from multiple applications but it still single threads them when writing out to disk.Â Â If you run several threads all just inserting into Tyrant your will see tyrant hit 100% Cpu on 1 core, and your writes will start to peter out quickly.
In my tests when I was not disk bound (FS Cache writes) I was able to complete 4Million inserts in a little over 91 seconds using 8 threads.Â I actually averaged 43896.98 inserts per second during my 8 thread test.Â Moving to 10 threads doing the same 4Million inserts I completed the test in 96 seconds and averaged 41649.42 inserts per second.Â Â Â Compare this to 4 Million rows using 4 threads which averagedÂ 40933.86 and you start to see that around 40K inserts per second is the most this particular server is capable of ( single threaded ).Â Hopefully this is something that maybe able to be fixed internally in the near future.Â Until then you may consider breaking up your data into multiple tables each with there own cache.Â This limit is per TC DB so this should work.Â I had an idea about using the memcached client to distribute the data accross multiple TC database files in the back end.Â This should work, I just need to test it
Ever notice how as my multi-part posts go on they get shorter and shorter:)Â This will be the last Tyrant related post for a little bit.Â The 4th & 5th posts were supposed to deal with replication and scaling… this may take a little while.Â Thanks for reading!
Percona’s widely read Percona Data Performance blog highlights our expertise in enterprise-class software, support, consulting and managed services solutions for both MySQL® and MongoDB® across traditional and cloud-based platforms. The decades of experience represented by our consultants is found daily in numerous and relevant blog posts.
Besides specific database help, the blog also provides notices on upcoming events and webinars.
Want to get weekly updates listing the latest blog posts? Subscribe to our blog now! Submit your email address below.