summaryrefslogtreecommitdiff
path: root/python/samba/provision
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2019-07-03 16:41:59 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-07-04 10:02:23 +0000
commit7a0a2fab0c98cf3bef9d4ba4308405aa695fedd0 (patch)
tree1df388b810d75fc870363fadd8691bf6cfe7615b /python/samba/provision
parent4335f4b4e411d5c58bd0bd873115cb6c670a789c (diff)
downloadsamba-7a0a2fab0c98cf3bef9d4ba4308405aa695fedd0.tar.gz
domain join: set ldb "transaction_index_cache_size" option
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>
Diffstat (limited to 'python/samba/provision')
-rw-r--r--python/samba/provision/__init__.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 74492cd91dc..2ffaf9fc250 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -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