How to adjust parameters for jemalloc profiling

Jason Evans jasone at canonware.com
Thu Feb 28 08:33:43 PST 2013


On Feb 25, 2013, at 6:53 AM, Yingfeng Zhang <yingfeng.zhang at gmail.com> wrote:
> Hi, 
> Recently I've met a profiling challenge that has something to do with jemalloc:
> 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!

I don't have a complete enough understanding of you application to offer any concrete advice.  Unless the two threads are acting as producer and consumer (of allocated memory), or the total amount of memory being allocated/deallocated is on the order of many megabytes, it seems unlikely that jemalloc would be directly to blame for the performance degradation.

Jason


More information about the jemalloc-discuss mailing list