speeding up string_to_sid

Jim McDonough jmcd at us.ibm.com
Thu Oct 20 14:21:06 GMT 2005

We've got a customer hitting the CPU wall on winbind, and a big factor in 
it is the string_to_sid() code (they've got other config issues adding to 
the stress winbind is seeing).  It's calling next_token() which is 
overkill on what we need, plus it's allocating another copy of the string, 
just to satisfy the next_token() requirements.  I wrote a little test code 
to just call string_to_sid() in a loop for the same sid, 
S-1-5-21-69072261-1401482819-3704606377-3012 (which seemed representative 
enough for me), and compared with my updated version here:

> time testsid.old 1000000

real    0m7.321s
user    0m6.188s
sys     0m0.016s

> time bin/testsid 1000000

real    0m5.523s
user    0m4.664s
sys     0m0.032s

So for a million lookups, that's the difference.  And this customer is 
getting a tremendous rate of lookups...

Think i should check this in?  Or some variant?

Jim McDonough
IBM Linux Technology Center
Samba Team
6 Minuteman Drive
Scarborough, ME 04074

jmcd at us dot ibm dot com 
jmcd at samba dot org

Phone: 1-877-228-1846
IBM tie-line: 349-5335
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string_to_sid.patch
Type: application/octet-stream
Size: 2574 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20051020/38cf9d83/string_to_sid.obj

More information about the samba-technical mailing list