How to adjust parameters for jemalloc profiling

Yingfeng Zhang yingfeng.zhang at
Mon Feb 25 06:53:47 PST 2013

Recently I've met a profiling challenge that has something to do with
There are two threads, one of which runs the following index() function
while the other runs search() below. Within each thread, memory allocation
is frequently called especially within the index() function.  Although
there does not exist any race condition between the two threads, I could
see that the performance of search() has been seriously affected---maybe
downgraded to tens of times than the situation no index thread is running.
>From some profiling tools could I conclude that the performance downgrading
has something to do with the memory allocation. Suppose within search(),
over 2k malloc/free is called, and the overall time could be lowered from
3ms to 0.4s if index thread is started, but search() will never be affected
if it runs within a forked process instead of thread.

void index()

void search()

I believe it has something to do with the parameter tuning for jemalloc,
could anybody help me in figuring out such configuration?
Very grateful!

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the jemalloc-discuss mailing list