From 7a0a2fab0c98cf3bef9d4ba4308405aa695fedd0 Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Wed, 3 Jul 2019 16:41:59 +1200 Subject: 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 Reviewed-by: Andrew Bartlett --- python/samba/provision/__init__.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'python/samba/provision') 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 -- cgit v1.2.1