Today, when installing MARIADB, I find that compiling has always prompted an error/usr/bin/ld:cannot Find-ljemalloc_pic
I found out because it didn't work. Jemalloc may be mariadb The database uses this method to manage multi-threaded memory allocations by default
First, what is this jemalloc?
Jemalloc from Jason Evans's paper published in Bsdcan conference in 2006: "A Scalable Concurrent malloc implementation for FreeBSD". Jason believes that Phkmalloc (FreeBSD's previous malloc implementation by Kamp (1998)) does not consider multiprocessor scenarios, so performance is low in multithreaded concurrency (this is the case), The Jemalloc is suitable for multi-threaded memory allocation management. It has been introduced to FreeBSD standards since 2007. Many software innovations are initiated by FreeBSD, and a wide range of technologies used in FreeBSD are slowly imported into Linux .
after Redis version 2.4, Jemalloc is used by default to do memory management; Tengine also integrates Jemalloc. Jemalloc from the results of all aspects of the evaluation and Google Tcmalloc are not comparable, are the highest level of Memory manager field. Such as:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/1F/wKioL1Sp-U6gtsSMAAEliq1Q6bc263.jpg "title=" 104620jp-0.jpg "alt=" Wkiol1sp-u6gtssmaaeliq1q6bc263.jpg "/>
On the far left is glibc malloc, and on the far right is jemalloc. As can be seen from the chart, the performance of Jemalloc is more than twice times glibc. A very overwhelming performance difference. As a result, applications that use Jemalloc will naturally be much faster. Next to Jemalloc is Tcmalloc. The performance of Tcmalloc is very small, low jemalloc2.1.0 is 4.5% slower. The 1.4 versions of the figure and Tcmalloc are now in the 2.1 version, so in fact the two should be non-secondary. Jason Evans, the founder of Jemalloc, is aware of this, saying Jemalloc is more efficient on computers with CPU core 8 or higher
Second, use
Installing Jemalloc
CD Lnmp/srcwget Http://www.canonware.com/download/jemalloc/jemalloc-3.4.0.tar.bz2tar XJF JEMALLOC-3.4.0.TAR.BZ2CD Jemalloc-3.4.0./configuremake && make Installecho '/usr/local/lib ' >/etc/ld.so.conf.d/local.confldconfig
Using Jemalloc to optimize MySQL
MYSQL/MARIDDB 5.5 compilation method, cmake the following parameter when precompiled
-dcmake_exe_linker_flags= "-ljemalloc"-dwith_safemalloc=off
or directly load, modify Mysqld_safe
Sed-i ' [email protected] [email protected] mysqld_safe\nexport ld_preload=/usr/local/lib/[email protected] '/usr/local /mysql/bin/mysqld_safeservice mysqld Restart
Third, verification is effective
Lsof-n | grep jemalloc
This article is from "Yun Weibang" blog, please be sure to keep this source http://aklaus.blog.51cto.com/9724632/1599202
Jemalloc Memory allocation Management