https://bugs.openldap.org/show_bug.cgi?id=10274
--- Comment #11 from Ondřej Kuzník ondra@mistotebe.net --- Retrying with the provided configs and a 4-way delta-MPR with absolute precision lastbind (same as MODs, it generates a lot of mutually conflicting traffic). I picked extremely underpowered machines so as to keep the saturating throughputs reasonably low and not have to worry about I/O being the limiting factor.
During the test, replication slows down to ~10-20 % of regular throughput (e.g. ~7ms to ~50-80ms per message processed in my tests). Investigating further, 40-70 % of replication wall-clock time (~25ms here) is spent on syncrepl_op_modify (deltaMMR mod resolution), specifically running the (entryCSN>=receivedCSN) part of the filter. It seems this effectively imposes a quadratic complexity on the delta-resolution traffic.
A representative traceback from master (`perf top` shows that mdb_idl_next/mdb_idl_union together take up about half of the CPU time):
``` (gdb) bt #0 0x00007fa2c37fea6a in mdb_idl_next (ids=0x7fa195476018, cursor=0x7fa1ab7ebcf0) at idl.c:947 #1 0x00007fa2c37fe80e in mdb_idl_union (a=0x7fa195476018, b=0x7fa195376018) at idl.c:831 #2 0x00007fa2c37f6823 in inequality_candidates (op=Search request rid=003 = {...}, rtxn=0x7fa1a445b1e0, ava="entryCSN"="20250904095808.059675Z#000000#003#000000", ids=0x7fa195476018, tmp=0x7fa195376018, gtorlt=165) at filterindex.c:1157 #3 0x00007fa2c37f2e35 in mdb_filter_candidates (op=Search request rid=003 = {...}, rtxn=0x7fa1a445b1e0, f=LDAP_FILTER_GE = {...}, ids=0x7fa195476018, tmp=0x7fa195376018, stack=0x7fa195576018) at filterindex.c:172 #4 0x00007fa2c37f43f8 in list_candidates (op=Search request rid=003 = {...}, rtxn=0x7fa1a445b1e0, flist=LDAP_FILTER_GE = {...}, ftype=160, ids=0x7fa1951f6018, tmp=0x7fa195376018, save=0x7fa195476018) at filterindex.c:582 #5 0x00007fa2c37f307d in mdb_filter_candidates (op=Search request rid=003 = {...}, rtxn=0x7fa1a445b1e0, f=LDAP_FILTER_AND = {...}, ids=0x7fa1951f6018, tmp=0x7fa195376018, stack=0x7fa195476018) at filterindex.c:195 #6 0x00007fa2c37ee81d in search_candidates (op=Search request rid=003 = {...}, rs=0x7fa1ab7fc6e0, e="cn=accesslog", isc=0x7fa1ab7ec1c0, mci=0x7fa1b01212e0, ids=0x7fa1951f6018, stack=0x7fa195376018) at search.c:1419 #7 0x00007fa2c37ec1aa in mdb_search (op=Search request rid=003 = {...}, rs=0x7fa1ab7fc6e0) at search.c:678 #8 0x000055b51e99feef in overlay_op_walk (op=Search request rid=003 = {...}, rs=0x7fa1ab7fc6e0, which=op_search, oi=0x55b54e3b7280, on=0x0) at backover.c:706 #9 0x000055b51e9a0178 in over_op_func (op=Search request rid=003 = {...}, rs=0x7fa1ab7fc6e0, which=op_search) at backover.c:766 #10 0x000055b51e9a02b1 in over_op_search (op=Search request rid=003 = {...}, rs=0x7fa1ab7fc6e0) at backover.c:796 #11 0x000055b51e9879b7 in syncrepl_op_modify (op=Modify request rid=003 = {...}, rs=0x7fa1ab7fced0) at syncrepl.c:3122 #12 0x000055b51e99fe49 in overlay_op_walk (op=Modify request rid=003 = {...}, rs=0x7fa1ab7fced0, which=op_modify, oi=0x55b54e367380, on=0x55b54e3f2c60) at backover.c:691 #13 0x000055b51e9a0178 in over_op_func (op=Modify request rid=003 = {...}, rs=0x7fa1ab7fced0, which=op_modify) at backover.c:766 #14 0x000055b51e9a0305 in over_op_modify (op=Modify request rid=003 = {...}, rs=0x7fa1ab7fced0) at backover.c:808 #15 0x000055b51e98918f in syncrepl_message_to_op (si=0x55b54e3f4fc0, op=Modify request rid=003 = {...}, msg=0x7fa1a422c190, do_lock=0) at syncrepl.c:3411 #16 0x000055b51e9822c0 in do_syncrep2 (op=Modify request rid=003 = {...}, si=0x55b54e3f4fc0) at syncrepl.c:1575 #17 0x000055b51e98549d in do_syncrepl (ctx=0x7fa1ab7fdb70, arg=0x55b54e3f3950, _rid=3) at syncrepl.c:2334 #18 0x000055b51e8faa6d in connection_read_thread (ctx=0x7fa1ab7fdb70, argv=0x13) at connection.c:1280 #20 0x00007fa2c41321f5 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442 #21 0x00007fa2c41b289c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81 (gdb) frame 4 #4 0x00007fa2c37f43f8 in list_candidates (op=Search request rid=003 = {...}, rtxn=0x7fa1a445b1e0, flist=LDAP_FILTER_GE = {...}, ftype=160, ids=0x7fa1951f6018, tmp=0x7fa195376018, save=0x7fa195476018) at filterindex.c:582 582 rc = mdb_filter_candidates( op, rtxn, f, save, tmp, (gdb) p flist $1 = LDAP_FILTER_GE = {f_next = LDAP_FILTER_EQUALITY, f_un.f_un_ava = "entryCSN"="20250904095808.059675Z#000000#003#000000"} ```