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

Jeremy Allison jra at samba.org
Mon Feb 11 20:22:03 UTC 2019

On Mon, Feb 11, 2019 at 12:01:15PM -0800, Richard Sharpe via samba-technical wrote:
> Hi folks,
> I have been working on an issue with Mac OS X 11 mishandling credits,
> and we seem to have all the issues resolved, however, there is one
> remaining issue that is provoked when the server is under load.
> Samba is unable to use the crediting system to control the load it is
> under and this can lead to situations where its response times get
> worse and worse and the clients eventually disconnect, where as if
> Samba were to start reducing the credits it gives to clients, they
> would see reduced throughput but no disconnects and the server may
> actually be able to get more useful work done.
> 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?

Interesting. It's not really a filesystem (VFS) issue, but
putting it as a VFS call would make it easily pluggable
for OEMs.

I'm torn by this. I'm happy to have a credit-throttling
call that OEMs can use to throttle credits (maybe a
default that counts outstanding AIO requests and throttles
back once over a threshold) but does it belong in the VFS ?

What do others think ?

More information about the samba-technical mailing list