[SSSD] [PATCH 0/0] A shared memory cache to perform better

Simo Sorce simo at redhat.com
Tue Jan 10 17:28:46 UTC 2012


On Tue, 2012-01-03 at 17:59 -0500, Simo Sorce wrote:
> Hello team,
> 
> the recent break provided me with some spare time and I decided to use
> it to make a gift to SSSD.
> Santa agreed that SSSD has been a good kid this year and here we
> go :-)
> 
> 2 years ago I opened this bug:
> https://fedorahosted.org/sssd/ticket/357
> [SSSD should provide fast in memory cache to provide similar
> functionality as NSCD currently provides]
> 
> I have been thinking about this feature since I started the SSSD
> project
> more than (gasp!) 3 years ago, time flies ...
> 
> So after a few weekend musings during last fall I had enough will and
> clout to actually go and do it in small sprints during my vacation.
> 
> The feature is not finalized, many small touches are still necessary
> but
> the bulk of it is there and it happens to work too :-)
> 
> Currently only the passwd and group maps are implemented and
> enumerations are not cached this way by design.
> 

I was just reminded I didn't mention what's the extent of performance
gain this work can provide.

I wrote a small local test that simply spawns X processes that do Y
loops around getpwnam_r() for user Z.

I have patched the code to make libnss_sss honour a special env var so
that I can easily use/not use the cache. When the cache is not used the
code falls back to using the standard sssd_nss pipes.

The results have been repeated for 2 configurations. One in which we
have files configured for passwd in nsswitch.conf and one in which we do
not have them (almost equivalent to a configuration where files is set
after sss).

You can see that in the worst case (when files is enabled) we still gain
an order of magnitude performance on cached lookups.

Simo.


DATA

nsswitch.conf -> passwd: sss

        NO CACHE
                [simo at season tests]$ export _SSS_MC_SPECIAL=NO
                [simo at season tests]$ time ./multi_getpwnam 10 100000 simo
                
                real	1m34.284s
                user	0m2.014s
                sys	0m18.971s
                
        WITH CACHE
                [simo at season tests]$ export _SSS_MC_SPECIAL=
                [simo at season tests]$ time ./multi_getpwnam 10 100000 simo
                
                real	0m0.448s
                user	0m0.349s
                sys	0m0.459s
                

--------------------------------------------------------

nsswitch.conf -> passwd: files sss

        NO CACHE
                [simo at season tests]$ export _SSS_MC_SPECIAL=NO
                [simo at season tests]$ time ./multi_getpwnam 10 100000 simo
                
                real	1m41.707s
                user	0m13.508s
                sys	0m31.139s
                
        WITH CACHE
                [simo at season tests]$ export _SSS_MC_SPECIAL=
                [simo at season tests]$ time ./multi_getpwnam 10 100000 simo
                
                real	0m12.344s
                user	0m11.413s
                sys	0m10.261s
                
                
-- 
Simo Sorce * Red Hat, Inc * New York




More information about the sssd-devel mailing list