From: Jeremy Allison on
On Wed, Jan 27, 2010 at 05:03:37PM -0600, Stan Hoeppner wrote:
> Samba 3.2.5 on Debian Lenny
>
> From: http://www.samba.org/samba/docs/server_security.html
> "Samba is able to limit the number of concurrent connections when smbd is
> launched as a daemon (not from inetd). The 'max smbd processes' smb.conf option
> allows Administrators to define the maximum number of smbd processes running at
> any given point in time. Any further attempts from clients to connect to the
> server will be rejected."
>
> I'm using max smbd processes for another reason. I'm trying to optimize memory
> usage on this box, which really only ever has one samba client machine
> connecting. I'm trying to get the number of smbd processes down to 1 but to
> this point have failed. I have in /etc/samba/smb.conf:
>
> max smbd processes = 1
>
> Yet once restarting samba and connecting to a share, I get this:
>
> [04:41:16][root(a)greer]/$ ps -ef|grep smbd
> root 8586 1 0 00:12 ? 00:00:00 /usr/sbin/smbd -D
> root 8591 8586 0 00:12 ? 00:00:00 /usr/sbin/smbd -D
> stan 8596 8586 0 00:13 ? 00:00:56 /usr/sbin/smbd -D
>
> top:
> 8586 root 20 0 12368 2828 2168 S 0 0.7 0:00.12 smbd
> 8591 root 20 0 12368 984 340 S 0 0.3 0:00.00 smbd
> 8596 stan 20 0 12912 3972 2896 S 0 1.0 0:56.46 smbd
>
> I've set max smbd processes to 1, yet I see 3 smbd processes. Is something
> broken?

No.

> Is "max smbd processes" not an accurate description? Would it better
> be described as "max smbd concurrent clients" or "max smbd user processes"?

Yes, that's a better description.

> I can understand the need for a master daemon process that spawns children for
> each connection, but at most that should require 2 smbd processes, not 3. As
> you can see from the top output, only one smbd process is actually servicing a
> client. One is completely idle, sucking up resources. The other appears to be
> the master which spawns the children.

There's also the printer background lpq updater process, that's the
third one. We should probably update the description to make this
clear. It's all working as designed. You can always comment out
the code for this (it's in printing/printing.c:start_background_queue())
if you are resource constrained.

Jeremy.
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
From: Stan Hoeppner on
Jeremy Allison put forth on 1/27/2010 5:18 PM:

>> Is "max smbd processes" not an accurate description? Would it better
>> be described as "max smbd concurrent clients" or "max smbd user processes"?
>
> Yes, that's a better description.

Understood.

> There's also the printer background lpq updater process, that's the
> third one. We should probably update the description to make this
> clear. It's all working as designed. You can always comment out
> the code for this (it's in printing/printing.c:start_background_queue())
> if you are resource constrained.

Aha, so that's what the third one is. As I don't do printer sharing this
possibility slipped my mind. I'm not so resource constrained as to start
hacking source. I always stick with my distro's packages unless extreme
circumstances require going to source, and this really isn't one of them.

Maybe there could be a future smb.conf option to completely disable printer
sharing and the launch of the deamon process?

I noticed in the documentation I quoted earlier something about running Samba
from inetd. Is this (easily) doable? Would running from inetd be advantageous
in my low resource consumption scenario, processes exiting after a period of
inactivity? Or would this cause more problems than it would solve?

Thanks Jeremy.

--
Stan

P.S. We briefly met once a few years ago when you were in St. Louis. You
stopped by Whitfield School to troubleshoot an issue with the AD code. I was
the sysadmin there at the time. You were working for Novell at that time.
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
From: Jeremy Allison on
On Wed, Jan 27, 2010 at 06:21:36PM -0600, Stan Hoeppner wrote:
>
> Aha, so that's what the third one is. As I don't do printer sharing this
> possibility slipped my mind. I'm not so resource constrained as to start
> hacking source. I always stick with my distro's packages unless extreme
> circumstances require going to source, and this really isn't one of them.
>
> Maybe there could be a future smb.conf option to completely disable printer
> sharing and the launch of the deamon process?

Good point, I'll think about this.

> I noticed in the documentation I quoted earlier something about running Samba
> from inetd. Is this (easily) doable? Would running from inetd be advantageous
> in my low resource consumption scenario, processes exiting after a period of
> inactivity? Or would this cause more problems than it would solve?

Should work. Log a bug if it doesn't. It will also prevent the
backend printer smbd from running as well.

> P.S. We briefly met once a few years ago when you were in St. Louis. You
> stopped by Whitfield School to troubleshoot an issue with the AD code. I was
> the sysadmin there at the time. You were working for Novell at that time.

Oh that's great ! I am actually wearing my green Whitfield School fleese
right now ! It's one of my favourite items of clothing :-).

Thanks,

Jeremy.
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
From: Stan Hoeppner on
Jeremy Allison put forth on 1/27/2010 7:20 PM:
> On Wed, Jan 27, 2010 at 06:21:36PM -0600, Stan Hoeppner wrote:

>> I noticed in the documentation I quoted earlier something about running Samba
>> from inetd. Is this (easily) doable? Would running from inetd be advantageous
>> in my low resource consumption scenario, processes exiting after a period of
>> inactivity? Or would this cause more problems than it would solve?
>
> Should work. Log a bug if it doesn't. It will also prevent the
> backend printer smbd from running as well.

I'd never dug into inetd.conf before today. Luckily I've got smbd working via
inetd now. I didn't configure nmbd in inetd as I don't really need browsing. I
have netbios disabled everywhere anyway so it's of little use.

So, this is great, exactly what I was looking for. When I click my mapped
drive(s) in Windows, a single smbd process fires on the Debian host, and it
works, just as it should.

I've not rebooted the system since making the inetd changes, merely killing
inetd with -HUP to reload its config. The Samba init script is still going to
be run during the next boot as I haven't monkeyed with the rcX.d directories or
anything. I set RUN_MODE="inetd" in the /etc/init.d/samba script. Will that
change by itself keep the script from launching the normal set of daemon
processes or is there something else I need to do to prevent this and have inetd
handle it all?

>> P.S. We briefly met once a few years ago when you were in St. Louis. You
>> stopped by Whitfield School to troubleshoot an issue with the AD code. I was
>> the sysadmin there at the time. You were working for Novell at that time.
>
> Oh that's great ! I am actually wearing my green Whitfield School fleese
> right now ! It's one of my favourite items of clothing :-).

I guess that clothing is better than the name it bears. Do you wear any of your
Novell clothing? If not, you'll understand why I no longer wear any of my
Whitfield clothing. ;) However, I'm glad I was working there at that time, as
it offered me the rare opportunity to meet one of the great wizards in the FOSS
realm. ;) I must admit I haven't kept tabs on you since you left Novell and
landed at Google. I just recently joined the samba list (should have long ago).
I noticed the listserv seems to be hosted in Utah. Are you still living in the
mountains or did you migrate to the Bay Area? Novell has its problems, but one
has to admit they picked a spot with one heck of view for their HQ. I was there
for Brainshare '07. The view of those mountains almost made me want to move
there. Then I came to my senses when taking the local religion factor into
account. ;) Sorry I'm getting OT. I guess we could pick up the reminiscing off
list.

--
Stan
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba