Friday, December 08, 2006

tcmalloc success

Domas Mituzas, a MySQL employee and Wikipedia hacker, just posted a great writeup of his recent experience using tcmalloc (an open source Google perftool) to debug some nasty memory leaks:
"Once we started profiling libc, one of initial assumptions appeared to be true - our heap was awfully fragmented, slowing down malloc()."

"Here comes our steroids part: Google has developed a drop-in malloc replacement, tcmalloc, that is really efficient. Space efficient, cpu efficient, lock efficient. This is probably the most-used (and sophisticated) libc function, that was suffering performance issues that not many people wanted to actually tackle. The description sounded really nice, so we ended up using it for our suffering Squids."

"The results were what we expected - awesome :) Now the nice part is that the library is optimized for multi-threaded applications, doing lots of allocations for small objects without too much of lock contention, and uses spinlocks for large allocations. MySQL exactly fits the definition, so just by using simple drop-in replacement you may achieve increased performance over standard libc implementations."

Domas' blog has further details.

2 comments:

  1. hmmm....decent enough for a beginner...thanks..:)

    ReplyDelete
  2. Did you try comparing tcmalloc to other allocators optimized for multi-threading such as hoard, mtmalloc or ptmalloc?

    ReplyDelete