diff options
author | Aaron Haslett <aaronhaslett@catalyst.net.nz> | 2019-08-13 18:14:12 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-08-30 07:08:36 +0000 |
commit | 961f07fb76287359e6a10263b1ea8035367e5375 (patch) | |
tree | 3386aa288ba4443497bc280ea73555845067c019 /python/samba/tests/dcerpc | |
parent | 3aea2c0f1f498fdb515cbd1d04b1ba3ce7f4cc3b (diff) | |
download | samba-961f07fb76287359e6a10263b1ea8035367e5375.tar.gz |
rpc samr: EnumDomainUsers perf improvement
EnumDomainUsers currently takes too long, significantly slowing down
calls to winbind's getpwent which is a core unix API. The time is taken
up by a GUID lookup for every record in the cached result. The advantages
of this approach are:
1. It meets the specified requirement that if a record yet to be returned
by a search in progress (with a resume handle) is deleted or
modified, the future returned results correctly reflect the
new changes.
2. Memory footprint for a search in progress is only 16 bytes per record.
But, those benefits are not worth the significant performance hit
of the lookups, so this patch changes the function to run the search
and cache the RIDs and names of all records matching the search when
the request is made. This makes the memory footprint around 200 bytes
per record or up to 2MB per concurrent search for a 100k user database.
The speedup achieved by this change is around 50%, and in tandem with
some winbindd improvements as part of the same task has achieved around
15x speedup for getpwent.
The lost specification compliance is unlikely to cause a problem for any
known usage of this RPC call.
Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python/samba/tests/dcerpc')
-rw-r--r-- | python/samba/tests/dcerpc/sam.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/python/samba/tests/dcerpc/sam.py b/python/samba/tests/dcerpc/sam.py index 4d787214b1d..c24d308dd0d 100644 --- a/python/samba/tests/dcerpc/sam.py +++ b/python/samba/tests/dcerpc/sam.py @@ -726,29 +726,7 @@ class SamrTests(RpcInterfaceTestCase): self.assertEquals(len(expected01), num_entries) check_results(expected01, actual.entries) - # - # Check that deleted results are handled correctly. - # Obtain a new resume_handle and delete entries from the DB. - # We will not see the deleted entries in the result set, as details - # need to be read from disk. Only the object GUID's are cached. - # - actual = [] - max_size = calc_max_size(1) - (resume_handle, a, num_entries) = self.conn.EnumDomainUsers( - self.domain_handle, 0, 0, max_size) - self.delete_dns(extra_dns) - while resume_handle and num_entries: - self.assertEquals(1, num_entries) - actual.append(a.entries[0]) - (resume_handle, a, num_entries) = self.conn.EnumDomainUsers( - self.domain_handle, resume_handle, 0, max_size) - if num_entries: - actual.append(a.entries[0]) - - self.assertEquals(len(expected), len(actual)) - check_results(expected, actual) - - self.delete_dns(dns) + self.delete_dns(dns + extra_dns) def test_DomGeneralInformation_num_users(self): info = self.conn.QueryDomainInfo( |