Bug 15757 - Changes from memcpy to NDR push/pull - performance drops
Summary: Changes from memcpy to NDR push/pull - performance drops
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.20.0rc1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-27 18:02 UTC by Subba Ramanna Bodda
Modified: 2024-11-28 23:03 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Subba Ramanna Bodda 2024-11-27 18:02:21 UTC
commit c9cf90aee864d8131dc386d61f3e35602c2ed63c
Date:   Thu Sep 14 18:24:36 2023 +1200
s3-lib/util_nttoken: Reimplement dup_nt_token() with NDR pull/push

The above commit replaces memcpy with ndr pull, and also uses ndr push, which seem to be more expensive. With this commit, SpecFS DB benchmarks showed performance degradation only at higher loads, on our filesystem. With the revert of this commit, numbers became normal like found with SMB 4.19 based code.

Also some approximate profiling using clock() gave timings as below.

Old Code
talloc_zero - 0.001000 ms
memdup section - if (ptoken->sids && ptoken->num_sids) { token->sids = (struct dom_sid *)talloc_memdup(.....); } - 0.002000 ms

New Code with NDR pull/push
talloc_zero - 0.002000 ms
frame = talloc_stackframe(); - 0.002000 ms
ndr_push_struct_blob - 0.018000 ms
ndr_pull_struct_blob - 0.009000 ms
Comment 1 Douglas Bagnall 2024-11-28 22:41:35 UTC
We could probably add a shortcut in the `if (src->num_local_claims == 0 && src->num_user_claims == 0 && src->num_device_claims == 0)` case.