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

Richard Sharpe realrichardsharpe at gmail.com
Mon Feb 11 20:01:15 UTC 2019


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?

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)(传说杜康是酒的发明者)



More information about the samba-technical mailing list