samdb and the session info

tridge at samba.org tridge at samba.org
Thu Jul 5 01:07:38 GMT 2007


Andrew and Simo,

I've been looking into memory usage in Samba4. When we first got the
single process model I had measured memory usage of about 15k-20k per
connection (as seen with vmstat and BASE-BENCH-HOLDCON).

A test on the current code shows 312k per connection. Approximately
90% of this is due to samdb_connect().

By making a small (hackish) patch to samdb_connect() to use a shared
ldb with talloc_reference(), I found that memory usage dropped to 26k
per connection, which is not too much bloat over what we had before
considering the new features. It also halved the time it takes to
establish 1000 connections, and I expect it will greatly speed up many
other operations (as much more memory will be in level 1 cache).

The problem is the session_info argument to samdb_connect(). That
argument is put into the ldb using ldb_set_opaque() then it is used to
get the current credentials for many operations. For my hack I used
system_session() for all ldb contexts, which is obviously not a good
solution!

So, I'd like to look at ways of getting the session_info argument out
of samdb_connect(), and in general remove any connection or user
specific attributes to the ldb context itself. Obviously we could use
a global instead of the ldb opaque approach, but I'd like to see if we
can find a neater way.

Cheers, Tridge


More information about the samba-technical mailing list