Monitoring Samba's memory usage: A cautionary tale

Richard Sharpe realrichardsharpe at gmail.com
Wed Feb 3 18:22:06 UTC 2016


Hi folks,

We spent a lot of time recently trying to understand Samba's memory usage
and the incremental cost of an additional smbd. This was sparked by the
fact that we had a couple of memory leaks in our VFS module.

After we fixed the memory leaks we then spent an enormous amount of time
down in the weeds because top and ps are not actually good tools for this.
Specifically, they overstate the RSS size by including the text segments of
all the shared libraries used.

See, for example, this page:
http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html

I still have not found the best tool for this, but you can use pmap and
process the output to exclude all TDBs (because there will only be one copy
of them in memory and thus they should count once) and the text regions of
all shared libraries (all RO memory segments.)

I hope this saves some people some time and also dispels the view held by
some that Samba is a memory hog.

Also, you can check for heap growth by looking at the size of the memory
segment just before the stack. If that is constantly growing, you probably
have a problem.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list