Bug 1301224

Summary: [RFE] Alternate memory allocator support (tcmalloc)
Product: Red Hat Directory Server Reporter: Nathan Kinder <nkinder>
Component: Directory ServerAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: high Docs Contact: Petr Bokoc <pbokoc>
Priority: high    
Version: 10.0CC: amsharma, arubin, mreynolds, msauton
Target Milestone: DS10.1Keywords: FutureFeature, TestOnly
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-07 15:39:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
tcmalloc_vs_glibc_add_srch_mod_del.png none

Description Nathan Kinder 2016-01-22 22:12:32 UTC
Jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support.

Using the jemalloc library for memory allocation has significantly reduced the memory usage for  389 DS, with no perceptible downside in performance.

We should support using jemalloc for memory allocation as a non-default configuration.

Design Document: http://www.port389.org/docs/389ds/FAQ/jemalloc-testing.html

Comment 1 Viktor Ashirov 2016-07-21 15:26:59 UTC
tail -n 5 /etc/sysconfig/dirsrv
# jemalloc is a general purpose malloc implementation that emphasizes
# fragmentation avoidance and scalable concurrency support.  jemalloc
# has been shown to have a significant positive impact on the Directory
# Server's process size/growth.
#LD_PRELOAD=/usr/lib64/dirsrv/libjemalloc.so.1 ; export LD_PRELOAD

This should be changed to tcmalloc.

Comment 5 Amita Sharma 2016-08-25 14:34:51 UTC
For verification ::

1. yum install gperftools-libs
2. In /etc/sysconfig/dirsrv uncomment LD_PRELOAD=@libdir@/libtcmalloc.so.4  
3. and restart the server
4. Now check :: 

# ps -aef | grep slapd
dirsrv   23745     1  7 19:07 ?        00:00:00 /usr/sbin/ns-slapd -D /etc/dirsrv

# pldd 23745 | grep tcmalloc
/usr/lib64/libtcmalloc.so.4

Also, http://www.port389.org/docs/389ds/FAQ/jemalloc-testing.html can be used for testing.

Comment 6 Viktor Ashirov 2016-10-18 14:11:16 UTC
Created attachment 1211761 [details]
tcmalloc_vs_glibc_add_srch_mod_del.png

Test results with tcmalloc vs glibc malloc:

Memory consumption with tcmalloc was 18-30% lower than using glibc malloc (see attachment)

There is a slight improvement in performance:

[1] Adding 10k entries
glibc:
Average rate:  752.00/thr  ( 752.00/sec), total:   7520

tcmalloc:
Average rate:  803.90/thr  ( 803.90/sec), total:   8039

[2] Modifying 10k entries
glibc:
Average rate: 1272.10/thr  (1272.10/sec), total:  12721

tcmalloc:
Average rate: 1382.00/thr  (1382.00/sec), total:  13820

[3] Searching 10k entries
glibc:
Average rate: 6851.40/thr  (6851.40/sec), total:  68514

tcmalloc:
Average rate: 6924.20/thr  (6924.20/sec), total:  69242

[4] Deleting 10k entries
glibc:
Average rate:  712.90/thr  ( 712.90/sec), total:   7129

tcmalloc:
Average rate:  717.60/thr  ( 717.60/sec), total:   7176

Comment 8 errata-xmlrpc 2016-11-07 15:39:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2665.html