Felix E. Klee
2025-Sep-12 02:01 UTC
[Samba] How to speed up small file writes? (WSL2 / Windows)
On Wed, Sep 10, 2025 at 9:49?PM Michael Tokarev <mjt at tls.msk.ru> wrote:> Please also do another test: windows to a network drive which > is run by another windows machine (I dunno if you can do this on > a single machine though).That?s a great suggestion! It would be possible to test Windows-to-Windows SMB performance with a Windows VM, but I am too lazy to set that up right now. What I did, however, is test extraction speed with the tar file hosted on Windows from Linux: root at felix-x1t3-11:/tmp/test# time tar xfz 2025-09-10+08_test.tgz real 0m38.990s user 0m3.082s sys 0m3.037s I also tried a few more tweaks to the Samba configuration by removing meta data preservation, see below. With that I can get down to 135 seconds: PS Microsoft.PowerShell.Core\FileSystem::\\172.18.61.229\share\test> Measure-Command { >> tar xfz .\2025-09-10+08_test.tgz >> } Days : 0 Hours : 0 Minutes : 2 Seconds : 15 Milliseconds : 199 Ticks : 1351991956 TotalDays : 0.00156480550462963 TotalHours : 0.0375553321111111 TotalMinutes : 2.25331992666667 TotalSeconds : 135.1991956 TotalMilliseconds : 135199.1956 That?s still 3.5 times slower than in the other direction: At least for small file writes, the SMB server built into Windows seems to be considerably faster than Samba! Next I want to try KSMBD. The goal is to get maximum small file write speed. No file meta data needs to be preserved. My current `/etc/samba/smb.conf`: [global] workgroup = WORKGROUP security = user map to guest = Bad User load printers = no disable spoolss = yes strict locking = no use sendfile = yes min receivefile size = 128k socket options = IPTOS_LOWDELAY TCP_NODELAY oplocks = yes aio read size = 1 aio write size = 1 kernel oplocks = no host msdfs = no strict sync = no smb encrypt = disabled ea support = no store dos attributes = no map archive = no nt acl support = no durable handles = no posix locking = no [share] path = /home/felix/tmp read only = no browseable = yes force user = felix create mask = 0644 directory mask = 0755
Felix E. Klee
2025-Sep-14 14:35 UTC
[Samba] How to speed up small file writes? (WSL2 / Windows)
The big question still is: Can it be made faster? Find some more tests below, now with the following setup: * SMB Guest: Windows 11 Pro x64 * SMB Host: Hyper-V/Arch Linux inside the above Windows, connected via an internal Hyper-V bridge Samba 4.22.4: * `/etc/samba/smb.conf`: [global] load printers = no disable spoolss = yes strict locking = no use sendfile = yes min receivefile size = 128k socket options = IPTOS_LOWDELAY TCP_NODELAY oplocks = yes aio read size = 1 aio write size = 1 kernel oplocks = no host msdfs = no strict sync = no client smb encrypt = off [share] path = /home/felix/tmp read only = no store dos attributes = no * I mounted the share and extracted the test data (see initial post): PS C:\> net use Z: \\10.149.217.2\share /user:felix * PS C:\> z: PS Z:\> Measure-Command { tar xfz 2025-09-10+08_test.tgz } Days : 0 Hours : 0 Minutes : 1 Seconds : 28 Milliseconds : 789 Ticks : 887896536 TotalDays : 0.00102765802777778 TotalHours : 0.0246637926666667 TotalMinutes : 1.47982756 TotalSeconds : 88.7896536 TotalMilliseconds : 88789.6536 KSMBD with (dangerous) multi channel is just 23% faster: * `/etc/ksmbd/ksmbd.conf`: [global] server multi channel support = yes smb3 encryption = disabled [share] path = /home/felix/tmp read only = no hide dot files = no store dos attributes = no * Extraction takes 72 seconds: PS Z:\> Measure-Command { tar xfz 2025-09-10+08_test.tgz } Days : 0 Hours : 0 Minutes : 1 Seconds : 12 Milliseconds : 5 Ticks : 720059246 TotalDays : 0.000833401905092593 TotalHours : 0.0200016457222222 TotalMinutes : 1.20009874333333 TotalSeconds : 72.0059246 TotalMilliseconds : 72005.9246 Extracting the archive on Linux is 25 times faster than KSMBD: $ time tar xfz 2025-09-10+08_test.tgz real 0m2.931s user 0m2.292s sys 0m1.220s