Regression: ldb performance with indexes

Andreas Schneider asn at samba.org
Fri Mar 1 10:39:15 UTC 2024


On Thursday, 29 February 2024 22:39:35 CET Andrew Bartlett via samba-technical 
wrote:
> On Thu, 2024-02-29 at 22:31 +0100, Andreas Schneider wrote:
> > On Thursday, 29 February 2024 21:19:52 CET Andrew Bartlett via samba-
> > 
> > technical wrote:
> > > On Thu, 2024-02-29 at 16:36 +0100, Andreas Schneider via samba-
> > > 
> > > technical wrote:
> > > > Hi,my colleagues discovered a performance issue in libldb:
> > > > https://bugzilla.samba.org/show_bug.cgi?id=15590
> > > > 
> > > > As soon as you use indexes, ldbadd will be magnitudes slower than
> > > > itwas before.Could some ldb expert please look into it?
> > > 
> > > Your subject says a regression.  What version is this a
> > > regressionagainst?
> > 
> > Isn't that obvious from the bug report?
> > Here is the short summary:
> > $ bash repro.sh 20000 indexesAdded 2 records successfullyAdded 20000
> > records successfully
> > On Samba 4.10: 0m01.231sOn Samba 4.19: 1m30.924s (that's 90 times
> > slower)
> > 
> > > The very nature of a DB index is that it will take time to
> > > create,possibly a lot of time, but should make reads faster.
> > 
> > Either the DB index doesn't work at all in Samba 4.10 or there is a
> > huge performance problem in Samba 4.19. What is it?
> 
> Thanks, that wasn't written as obviously on the bug, thanks for the
> clarification.

I used our CentOS 8 Stream CI image for bisecting. You can't bisect easily on 
a modern Linux Distribution, as the included waf would not have support for 
newer Python versions like 3.12.

In case you want to reproduce it, here is my run:

[samba at 09821f63851d samba]$ git bisect reset                                                                                                                                
Previous HEAD position was 201684e59fd lib ldb ldb_key_value tests: Add tests 
for wrapped operations                                                                                 
Switched to branch 'master'                                                                                                                                                          
Your branch is up to date with 'origin/master'.                                                                                                                                      
[samba at 09821f63851d samba]$ git bisect start                                                                                                                                         
status: waiting for both good and bad commits                                                                                                                                        
[samba at 09821f63851d samba]$ git bisect bad 
763b52d237763e90e67f5061050f99a92ed7901c
status: waiting for good commit(s), bad commit known                                                                                                                                 
[samba at 09821f63851d samba]$ git bisect good 
fb12a252613205dd0ebcfc8716847aed510e07cb                                                                                                 
Bisecting: 31 revisions left to test after this (roughly 5 steps)              
[5823dc5414742b023b1bfee4c9183c9f474e8205] s3:libnet: Use 
gnutls_error_to_ntstatus() in libnet_passwd
[samba at 09821f63851d samba]$ git bisect bad 
Bisecting: 15 revisions left to test after this (roughly 4 steps)   
[aa2a3d95098231f48d7c308881bf66418164111e] dnsp.idl: fix payload for 
DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME
[samba at 09821f63851d samba]$ git bisect bad
Bisecting: 7 revisions left to test after this (roughly 3 steps) 
[565341baf537c9b3145a882d6a23ad4f155c0036] lib ldb key value: add nested 
transaction support.
[samba at 09821f63851d samba]$ git bisect good        
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[feb96ee8e558797d68ad0af669eb9010c0487b9f] lib ldb key value: use 
TALLOC_FREE() per README.Coding
[samba at 09821f63851d samba]$ git bisect bad                      
Bisecting: 1 revision left to test after this (roughly 1 step)
[1a52b03b2f4c1503b52784f1a01f8291b78e7604] lib ldb key value: Remove 
check_parent from ldb_kv_index_idxptr()
[samba at 09821f63851d samba]$ git bisect good   
Bisecting: 0 revisions left to test after this (roughly 0 steps)                       
[b6b5b5fe355fee2a4096e9214831cb88c7a2a4c6] lib ldb key value: fix index 
buffering
[samba at 09821f63851d samba]$ git bisect bad
b6b5b5fe355fee2a4096e9214831cb88c7a2a4c6 is the first bad commit
commit b6b5b5fe355fee2a4096e9214831cb88c7a2a4c6
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Wed Mar 6 15:28:45 2019 +1300
             
    lib ldb key value: fix index buffering

    As a performance enhancement the key value layer maintains a cache of
    the index records, which is written to disk as part of a prepare commit.
    This patch adds an extra cache at the operation layer to ensure that the
    cached indexes remain consistent in the event of an operation failing.

    Add test to test for index corruption in a failed modify.

    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D





More information about the samba-technical mailing list