]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
domain join: set ldb "transaction_index_cache_size" option
authorGary Lockyer <gary@catalyst.net.nz>
Wed, 3 Jul 2019 04:41:59 +0000 (16:41 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 4 Jul 2019 10:02:23 +0000 (10:02 +0000)
Set the "transaction_index_cache_size" on a join to improve
performance. These setting reduced a join to a 100k user domain from
105 minutes to 44 minutes.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/provision/__init__.py

index 74492cd91dc236e4488a79efa7d985d7d482183a..2ffaf9fc2500021e68fc1eb8a7d4543aaa6081d5 100644 (file)
@@ -1314,17 +1314,21 @@ def setup_samdb(path, session_info, provision_backend, lp, names,
                            backend_store=backend_store,
                            backend_store_size=backend_store_size)
 
+    store_size = DEFAULT_BACKEND_SIZE
+    if backend_store_size:
+        store_size = backend_store_size
+
     options = []
     if backend_store == "mdb":
-        if backend_store_size:
-            store_size = backend_store_size
-        else:
-            # If no lmdb map size provided default to the default of
-            # 8 GiB
-            store_size = DEFAULT_BACKEND_SIZE
-        options = ["lmdb_env_size:" + str(store_size)]
+        options.append("lmdb_env_size:" + str(store_size))
     if batch_mode:
         options.append("batch_mode:1")
+    if batch_mode:
+        # Estimate the number of index records in the transaction_index_cache
+        # Numbers chosen give the prime 202481 for the default backend size,
+        # which works well for a 100,000 user database
+        cache_size = int(store_size / 42423) + 1
+        options.append("transaction_index_cache_size:" + str(cache_size))
 
     # Load the database, but don's load the global schema and don't connect
     # quite yet