sahlberg / libsmb2

SMB2/3 userspace client
Other
322 stars 135 forks source link

Very slow performance w/MacOS SMB server #271

Closed NonBozo closed 5 months ago

NonBozo commented 1 year ago

Testing libsmb2 from my ARM dual-core A15 linux platform to a Windows 10-based server and a MacOs 13.4.1 server, I see excellent transfer speeds to the Windows box (>600Mbits/sec effective rate on a 1GBit network) but less than 10% of this when going to a MacOS server (~40Mbits/sec on the same network.) All machines are SSD-based and the file transfers were for ~1Gbytes of data (the put/get examples were modified to use a 256KB buffer for these tests.)

Also noted in my testing is a large difference in smb2 client CPU use: for a Windows share, the transfer incurs about 40% CPU, shared across both cores, and with almost all of that spent in the network and storage drivers; but against the MacOS box I see one CPU core almost fully saturated (>90% CPU) in user-space, i.e. libsmb2, and almost no CPU use on the other core.

Other (non-libsmb2) clients against the MacOS server are also slower by about 30% compared to the Windows server, but using libsmb2 the mac transfer is 93% slower. For my use case the slowdown and the CPU use will be prohibitive if it can't be fixed.

Any ideas about why this would be happening? Possibly related to issue #223 ("credits")? How could it best be addressed?

sahlberg commented 1 year ago

Check if there is a difference in signing/encryption. libsmb2 uses unoptimized C-routines for the crypto (to be compatible with as many platforms as possible) You can also check what the size of the READ/WRITE pdus are between the two servers.

amosavian commented 10 months ago

You are right. it becomes very slow when I use encryption. @sahlberg