Disable cache patch

Tim Dijkstra newsuser at famdijkstra.org
Fri Sep 29 05:48:48 PDT 2006


On Thu, 28 Sep 2006 18:22:23 -0400
Havoc Pennington <hp at redhat.com> wrote:

> Hi,
> 
> This looks fine to me, thanks, though I'm still worried there was a
> good reason we did the caching in the first place. Maybe in
> benchmarking your glibc is set up differently from the default (or
> historical default)? I'm thinking now that when we added this, every
> call to get groups was opening and parsing /etc/groups, and this
> happens on *every* bus message.... that would probably make dbus
> about 100x slower than it is today.

I think it only happens on every connection, could that be? Also you
would guess that most OSs have some caching. I know glibc has nscd.
 
> Maybe you could commit this as a nice cleanup anyhow, but with
> #define DBUS_ENABLE_USER_CACHE 1 for now, some of us can test, then
> we'll see whether we can kill caching by default.

Uhmm, I don't have commit access...

> Unfortunately I don't see how to make this sane since there's no way
> to find out if getting a user's groups will be fast, and afaik no way
> to check group membership without getting a user's groups.

The big problem I have with that current cache, is that it never
expires and that it can go out of sync with the cache the OS has. We
could try to build expiry in dbus... But it feels a bit insane to do
that, IMO the OS (libc) should do the caching, name service caching
daemons do exist already. 
Maybe Dbus should strongly suggest using one. Packages could Depend: on
it.

> I am idly wondering if there was some reason for having the userdb 
> object in the BusContext instead of using the get_system one, but I 
> can't think of anything.

I couldn't find any clue in the code. The way it was now, was a bit
weird; two databases at the same time, only one got flushed on
reload, ... 
From the stucture of the code, it seemed that it was put in
specifically for the  _dbus_user_database_get_groups function.

> Be sure you try "make check" also.

Sure.

grts Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060929/71db0ad3/signature.pgp


More information about the dbus mailing list