-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SYSDB: perf improvements in sysdb_add_group_member_overrides(), part 2 #7866
base: master
Are you sure you want to change the base?
Conversation
014b4fe
to
1973b50
Compare
d6089f2
to
cfa33a1
Compare
@joakim-tjernlund, since you tested previous PR in this ares, would you be interested to try this as well (it should be applied on the top of #7841)? |
@marco-kusa, one of original patches in #7841 had to be dropped during review. Would you be able to test this PR in your env ('ignore_group_members = false' code path)? |
Added an top of master on one machine for now |
Now on several machines(5-10) |
And what are observations so far? |
I tested this PR against the current master branch (459cc6b) in the following scenario:
I wanted to see how SSSD would behave in this case, not expecting any significative improvement. I ran the loop twice for each case. Before each loop, I deleted the logs and cache, and restarted SSSD. Master
This PR
My test is slower with this PR than without it. May I have done something wrong? |
I'm pretty sure most of time is spent in 'sssd_be', not in 'sssd_nss'... |
I can't:
sssd-2.11.0-0.250314.164005.git459cc6b15.fc42.x86_64
sssd-9.pr7866-06249.fc42.x86_64
The only case where I got any difference - while I was web-browsing while running the test on the same laptop. This is inline with my expectations: the only large group in this setup is "1 extra group, all 2000 users are members of it". This group is actually read only once, all other reads hit mem-cache. If you can reliably reproduce this performance degradation (while making sure overall load of the host stays the same), please capture logs with debug level 9 and microseconds, a perf flamegraph and share those. |
Still, you can use your setup to actually test code paths being touched in this PR - just resolve this large group in a loop with default debug settings and mem-cache disabled: That's what I got with LDAP: sssd-2.11.0-0.250314.164005.git459cc6b15.fc42.x86_64
9.pr7866-06249.fc42
|
In the #7793 environment results are much more modest: merely 10% perf gain. That's somewhat expected because in that env - a lot of users but only a (small) fraction are members of a given group - it is search-by-memberof what takes the time, not resulting list processing (what is being optimized in this PR). (But, as expected, #7872 makes it blazing fast - ~ x600 faster). |
I don't have exactly this setup. In my case (2000 members in the group) I saw no improvement nor degradation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
there is a typo in the "'tmp_ctx' was removed as it wasn't really used anyway" commit message, 'aboid' vs 'avoid'.
bye,
Sumit
Skip function if group->memberUid is empty. In this case there are no user objects in the cache that would have memberOf == group->dn anyway.
Ensure that `get_user_members_recursively()` returns only POSIX users via search filter. This avoids the need to populate and later check SYSDB_UIDNUM attr.
Don't read unneeded attributes from override_dn.
Replaced `sysdb_search_entry()` with `sysdb_cache_search_entry()` to avoid `sysdb_merge_msg_list_ts_attrs()` that isn't needed here (timestamps aren't used anyway).
d547038
to
4ca7303
Compare
Thank you, fixed. |
if requested debug level isn't set. Meant to be used in hot (performance sensitive) code paths only.
In case of reading a large group (comparable to entire cache) it accounts for some non trivial CPU time (cca ~6..7%)
'tmp_ctx' was removed as it wasn't really used anyway. Code could be changed to make a real use of 'tmp_ctx': to avoid touching '_dom_name' output arg if update of '_shortname' fails. But this is quite unrealistic case and function is in a hot path, so better to avoid unneeded memory manipulations.
Avoid unneeded strlen()'s
Don't use sss_parse_internal_fqname() as domain name copy isn't needed.
Avoid alloc/free tmp_ctx. Not much benefits but a function is in a hot path.
Avoid unnecessary string copy.
Function wasn't used since ed891c0
There were no users of those functions that would need a new copy.
Function is unused since 26c722d
Scan format and alloc string once instead of talloc_strndup_append() for every chunk.
4ca7303
to
3fbeeee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
thank you for the updates, ACK.
bye,
Sumit
sysdb_search_entry()
withsysdb_cache_search_entry()
to avoid
sysdb_merge_msg_list_ts_attrs()
"sss_nss_protocol_fill_members()
(those helpers are also used in other cases), but I admit impact is pretty contained (2..3% of time in my test setup), so if you think some of patches make code readability worse - I'm fine to drop those.Testing with the same setup as in #7841 (comment) but default debug settings:
time SSS_NSS_USE_MEMCACHE=NO getent -s sss group [email protected] > /dev/null
2.11.0-0.250306.171312 (vanilla) : 2.207 .. 2.434
sssd-9.pr7866-06233 (don't read ts) : 1.142 .. 1.271
sssd-9.pr7866-06235 (debug) : 1.035 .. 1.119
sssd-9.pr7866-06249 (fill-members): 1.007 .. 1.086