A mechanism to throttle credits granted when a Samba server is under load

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Feb 11 20:32:11 UTC 2019

On Mon, Feb 11, 2019 at 12:01:15PM -0800, Richard Sharpe via samba-technical wrote:
> To that end, I suggest we add a new VFS call (heh) called something
> like SMB_VFS_GATE_CREDITS_GRANTED that would be added in
> smb2_set_operation_credit between these lines of code:
>         credits_granted = MIN(credits_granted, credits_possible);
> +      gated_credits = SMB_VFS_GATE_CREDITS_GRANTED(credits_granted, ...)
> +      credits_granted = MIN(credits_granted, gated_credits);
>         SSVAL(outhdr, SMB2_HDR_CREDIT, credits_granted);
> The VFS function might monitor things like /proc/sys/fs/aio_nr for
> some max allowable number or might also look at CPU load, or might,
> with enough info (like credit_charge, etc) also track the number of
> credits granted to this smbd over time, but that is all for future
> thought.
> Any thoughts?

Is the VFS really the right place for this? What we need is a global
crediting system. The difficulty here is a mechanism to grant the
credits across all smbds. Every smbd has to acquire some credits from
a common pool. If more smbds come in, the common pool will have less
available per smbd. Then you can externally manage the pool based on
load. Taking credits from a central pool is just a small tdb
operation, the problem though is crash recovery. How do you get back
the credits that an smbd has retrieved and not given back because it
did not shut down properly?


SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: 0551-370000-0, mailto:kontakt at sernet.de
Gesch.F.: Dr. Johannes Loxen und Reinhild Jung
AG Göttingen: HR-B 2816 - http://www.sernet.de

More information about the samba-technical mailing list