[
https://issues.apache.org/jira/browse/MESOS-7876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16127194#comment-16127194
]
Benno Evers commented on MESOS-7876:
------------------------------------
Licensing: 2-clause BSD, there should be no problem.
Availability: jemalloc uses a standard autotools-based build, so adding it to
our build should be no problem. As far as I know, mesos allocates all memory
using operator new which is a standard interface, so there should be no
platform-specific problems.
Performance: To test malloc performance, I compiled two versions of jemalloc
4.5.0 with the default configuration options used in
[https://www.freebsd.org/cgi/man.cgi?jemalloc(3)](FreeBSD), i.e. `--enable-fill
--enable-lazy-lock --enable-munmap --enable-tcache --enable-tls --enable-utrace
--enable-xmalloc`. For one of them, I addtionally specified the flags
`--enable-stats --enable-prof` to disable heap statistics gathering and
profiling options, for the other I specified `--disable-stats --disable-prof`.
Next, I spawned n threads per allocator (i.e. 3*n threads in total) and had
each thread do 125.000 allocation and deallocation operations with memory
regions uniformly distributed between 1 byte and 64 MiB. All three allocators
were running at the same time to ensure the system base load was the same for
all of them.
!noprof.png|Results run 1!
!prof.png|Results run 2!
More or less as predicted by other peoples experience, these results show that
the heap tracking functionality has almost no runtime impact when enabled but
not actively used, and as a bonus jemalloc actually seems to have a substantial
speedup for multi-threaded allocations, although its debatable if this will be
noticable during normal operation. I didn't manage to get a clean measurement
from mesos own' benchmark tests yet.
This post by Facebook describes some implementation details of jemalloc, along
with a very extensive comparison of several malloc implementations, although it
seems the actual results are missing from the page:
https://www.facebook.com/notes/facebook-engineering/scalable-memory-allocation-using-jemalloc/480222803919/
> Investigate alternative malloc's for mesos
> ------------------------------------------
>
> Key: MESOS-7876
> URL: https://issues.apache.org/jira/browse/MESOS-7876
> Project: Mesos
> Issue Type: Improvement
> Reporter: Benno Evers
> Assignee: Benno Evers
> Attachments: jemalloc_benchmark_raw.txt, malloc.cpp, noprof.png,
> prof.png
>
>
> It is currently very hard to debug memory issues, in particular memory leaks,
> in mesos.
> An alluring way to improve the situation would be to change the default
> malloc to jemalloc, which has built-in heap-tracking capabilities.
> However, some care needs to be taken when considering to change such a
> fundamental part of mesos:
> * Would such a switch have any adverse impact on performance?
> * Is it available and will it compile on all our target platforms?
> * Is the jemalloc-licensing compatible with bundling as third-party library?
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)