[Pkg-db-devel] Bug#520926: should be built with --enable-posixmutexes --with-mutex=POSIX/pthreads

John Morrissey jwm at horde.net
Mon Mar 23 16:56:13 UTC 2009


Package: libdb4.7
Version: 4.7.25-6
Severity: normal

tl;dr summary: It seems BerkeleyDB should be built with:

	--enable-posixmutexes --with-mutex=POSIX/pthreads

on NPTL Linux systems, since native POSIX mutexes substantially lower
context switches, at least with OpenLDAP's slapd.


I've been working out a final OpenLDAP 2.4/BDB 4.x configuration, and wound
up backporting DB4.7 to lenny (it's a straight rebuild except for the Java
bindings, which my cursory examination suggests need Java 5).

It was observed that Debian's BDB4.7 isn't built with POSIX mutexes
(--enable-posixmutexes --with-mutex=POSIX/pthreads), which makes a big
difference on modern Linux (NPTL) systems:

	http://marc.info/?l=openldap-software&m=123619904013849&w=2

The difference in context switches is huge, going from regular peaks of
120k-140k context switches in vmstat(1) output to a steady <2k cs when POSIX
mutexes are enabled. This is with a fairly heavily loaded OpenLDAP slapd.

FWIW, the only difference in the build is that mut_tas.c is linked in. I'm
not super familiar with Linux threading support, but I surmise that adds
support for native POSIX mutexes. The BDB test suite (run automatically by
the packaging) is successful after adding these two build options.

Stock Debian BDB4.7 packaging:
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  0   7376  43448  38868 3536772    0    0    62    28  621 4512  9  5 81  6
 0  0   7376  42936  38868 3537248    0    0   100     0  720 135739 11 23 60  6
 0  0   7376  42680  38868 3537548    0    0    52    72  801 1337  8  6 83  3
 0  0   7376  42308  38876 3537900    0    0    74    28  953 1570 12  8 74  6
 0  0   7376  41812  38876 3538404    0    0   104    12  625 59447  9 15 71  5
 0  0   7376  41564  38876 3538680    0    0    54     0  726 76962 15 15 64  6
 4  1   7376  41192  38884 3538996    0    0    56    26  650 127990 10 20 56 14
 0  0   7376  40820  38884 3539332    0    0    68    56  702 39495 15 12 67  7
 1  0   7376  40584  38884 3539652    0    0    66     0  486  874  6  4 86  5
 0  0   7376  40336  38892 3539928    0    0    50    22  617 1158  6  3 83  9
 1  0   7376  40076  38900 3540140    0    0    38    36  517  888  5  4 85  7
 0  1   7376  38976  38908 3541212    0    0   260    32  629  927  5  2 26 67
 4  1   7376  37952  38916 3542216    0    0   238    42  581 4725  7 16  0 78
 0  1   7376  37480  38916 3542680    0    0    90     0 1121 7524 13 11 69  7
 0  0   7376  36988  38916 3543188    0    0    74     0  960 166086 15 21 52 13
 0  0   7376  36852  38924 3543316    0    0    18    24  693 36271 13 13 69  6
 2  0   7376  36604  38924 3543540    0    0    48     0  481 40781 11 12 72  4
 0  0   7376  36368  38924 3543864    0    0    72   112  591 15125 10  5 79  7
 0  1   7376  36112  38924 3544164    0    0    62     6  678 35590  9  7 18 67
 0  1   7376  35984  38932 3544584    0    0    84    36  690 1076  6  4 18 72
 0  2   7376  35776  38948 3545056    0    0    92    50  374  603  3  2 48 47

BDB4.7 built with --enable-posixmutexes --with-mutex=POSIX/pthreads:
 0  0   7380 1262216  37808 2388312    0    0    18    12  410 1056  3  3 87  6
 0  0   7380 1261864  37808 2388716    0    0    16     2  419  932  3  3 93  1
 0  0   7380 1260768  37824 2390176    0    0   140    58  719 1612  5  8 66 21
 1  0   7380 1259792  37832 2391188    0    0    66    36  756 1267  6  9 80  6
 0  0   7380 1266724  37856 2391804    0    0    24    90  579  957  4  4 86  5
 2  0   7380 1265228  37872 2392276    0    0    36    52  593  946  5  5 85  4
 0  0   7380 1260760  37896 2393768    0    0   238    58  747 1314  7  7 78  8
 0  0   7380 1260108  37896 2394448    0    0    26     0  656 1741  5  6 89  1
 0  0   7380 1259404  37904 2395168    0    0    34    20  709 1778  6  5 85  4
 0  0   7380 1259896  37912 2395940    0    0    30    26  655 1625  7  6 83  4
 0  1   7380 1259636  37920 2396616    0    0    28    12  598 1236  5  3 87  5
 0  0   7380 1259016  37920 2397168    0    0    28     0  553 1217  4  4 88  3
 0  0   7380 1255232  37936 2397800    0    0    32   100  791 1471 14 14 70  3


-- System Information:
Debian Release: 5.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libdb4.7 depends on:
ii  libc6                         2.7-18     GNU C Library: Shared libraries

libdb4.7 recommends no packages.

libdb4.7 suggests no packages.

-- no debconf information

-- 
John Morrissey          _o            /\         ----  __o
jwm at horde.net        _-< \_          /  \       ----  <  \,
www.horde.net/    __(_)/_(_)________/    \_______(_) /_(_)__





More information about the Pkg-db-devel mailing list