4 ms·
Apparently once you start having more threads than cores, tcmalloc really shines: http://i.imgur.com/4RzmQD6.png http://i.imgur.com/4RzmQD6.png Looks like tho
by ck2 14y ago
Apparently once you start having more threads than cores, tcmalloc really shines:
http://i.imgur.com/4RzmQD6.png http://i.imgur.com/4RzmQD6.png
Looks like those on centos can install it easily via
yum install gperftools-libs --enablerepo=epel
which installs
/usr/lib64/libtcmalloc.so.4
/usr/lib64/libtcmalloc_minimal.so.4
then you just need to edit your mysql init script?
test -e /usr/lib64/libtcmalloc_minimal.so.4 && export LD_PRELOAD="/usr/lib64/libtcmalloc_minimal.so.4"
You can also try jemalloc which supposedly is close to as good as tcmalloc but uses less memory
yum install jemalloc --enablerepo=epel
which installs
/usr/lib64/libjemalloc.so.1
and for your init.d
test -e /usr/lib64/libjemalloc.so.1 && export LD_PRELOAD="/usr/lib64/libjemalloc.so.1"
- ck2 14y agooh and apparently mysql 5.5 users (not 5.1) can just directly use in my.cnf [mysqld_safe] malloc-lib=/usr/lib64/libtcmalloc_minimal.so.4 or malloc-lib=/usr/lib64/libjemalloc.so.1 http://dev.mysql.com/doc/refman/5.5/en//mysqld-safe.html#option_mysqld_safe_malloc-lib http://dev.mysql.com/doc/refman/5.5/en//mysqld-safe.html#opt... no export or script editing required
- stock_toaster 14y agoThis is what I do at $dayjob. We have been using tcmalloc for a while on our databases, as well as disabling the transparent huge pages and transparent huge page defrag (centos6). It made a big difference for us.
- ck2 14y agoCan I ask you a dumb question: I think I just turned it on properly but I have no idea how to proactively confirm that mysql is actually using jemalloc, rather than just wait for better performance numbers? Because it's an external environment variable, it doesn't actually show inside any of mysql's settings. No startup errors or runtime problems is always nice but I really am curious to know for a fact it worked. Will probably have to ask this on stackexchange if you don't know.
- stock_toaster 14y agoWith tcmalloc I get a few messages in the log about a large allocation on startup, but you can probably find it with this. # as root or sudo pmap -x $(pidof mysqld)|grep malloc