From 9e34db65e14134bf188162b1efe2c4ce10563579 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Sep 06 2012 18:42:03 +0000 Subject: Ticket #386 - Overconsumption of memory with large cache --- diff --git a/0000-Ticket-386-Overconsumption-of-memory-with-large-cach.patch b/0000-Ticket-386-Overconsumption-of-memory-with-large-cach.patch new file mode 100644 index 0000000..12643a7 --- /dev/null +++ b/0000-Ticket-386-Overconsumption-of-memory-with-large-cach.patch @@ -0,0 +1,55 @@ +From 6d6fa2888fc450dd21a36445d9defa93ea2155ee Mon Sep 17 00:00:00 2001 +From: Mark Reynolds +Date: Thu, 6 Sep 2012 13:21:27 -0400 +Subject: [PATCH] Ticket 386 - Overconsumption of memory with large cachememsize and heavy use of ldapmodify + +Bug Description: With very large entry cache setting, the memory process grows using just + simple ldapmodifies. + +Fix Description: The growth is caused by memory fragmentation. On Linux, we can set a + malloc option that impacts this fragmentation, but impacts performance. + +https://fedorahosted.org/389/ticket/386 + +Reviewed by: richm(Thanks!) +(cherry picked from commit 20dc4bc00b2660e951c1b50008115ef5611a5e24) +--- + ldap/servers/slapd/main.c | 15 ++++++++++++++- + 1 files changed, 14 insertions(+), 1 deletions(-) + +diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c +index 3455852..285cf2c 100644 +--- a/ldap/servers/slapd/main.c ++++ b/ldap/servers/slapd/main.c +@@ -40,7 +40,7 @@ + # include + #endif + +- ++#include + #include + #undef OFF + #undef LITTLE_ENDIAN +@@ -662,6 +662,19 @@ main( int argc, char **argv) + ldap_set_option( 0x1, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns ); + } + #endif ++ ++#ifdef LINUX ++ char *m = getenv( "SLAPD_MXFAST" ); ++ if(m){ ++ int val = atoi(m); ++ int max = 80 * (sizeof(size_t) / 4); ++ ++ if(val >= 0 && val <= max){ ++ mallopt(M_MXFAST, val); ++ } ++ } ++#endif ++ + /* + * Initialize NSPR very early. NSPR supports implicit initialization, + * but it is not bulletproof -- so it is better to be explicit. +-- +1.7.1 + diff --git a/389-ds-base.spec b/389-ds-base.spec index 7f7a41f..7b64bb2 100644 --- a/389-ds-base.spec +++ b/389-ds-base.spec @@ -16,7 +16,7 @@ Summary: 389 Directory Server (base) Name: 389-ds-base Version: 1.2.10.14 -Release: %{?relprefix}1%{?prerel}%{?dist} +Release: %{?relprefix}2%{?prerel}%{?dist} License: GPLv2 with exceptions URL: http://port389.org/ Group: System Environment/Daemons @@ -88,6 +88,7 @@ Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz # 389-ds-git.sh should be used to generate the source tarball from git Source1: %{name}-git.sh Source2: %{name}-devel.README +Patch0: 0000-Ticket-386-Overconsumption-of-memory-with-large-cach.patch %description 389 Directory Server is an LDAPv3 compliant server. The base package includes @@ -134,6 +135,7 @@ Development Libraries and headers for the 389 Directory Server base package. %prep %setup -q -n %{name}-%{version}%{?prerel} cp %{SOURCE2} README.devel +%patch0 -p1 %build %if %{use_openldap} @@ -271,6 +273,9 @@ fi %{_libdir}/%{pkgname}/libslapd.so.* %changelog +* Thu Sep 6 2012 Rich Megginson - 1.2.10.14-2 +- Ticket #386 - Overconsumption of memory with large cache + * Wed Jul 18 2012 Rich Megginson - 1.2.10.14-1 - Ticket #410 - Referential integrity plug-in does not work when update interval is not zero