VolkanSah / optimize-Samba-settings

Some tips to speed up Samba (SMB) Server
17 stars 2 forks source link

"smb compression = yes" doesn't work #1

Closed Black6spdZ closed 3 weeks ago

Black6spdZ commented 3 weeks ago

what samba version is this implemented in?

VolkanSah commented 3 weeks ago

The 'smb compression = yes' option was introduced in Samba 4.7. If you're using an older version, this option won’t work.

To check your Samba version, run smbd --version in the terminal.

If you're using a newer version and the option still isn't working, make sure that:

  1. The option is in the [global] section of your smb.conf file
  2. You’ve restarted the Samba service after making the change (or rebooted the whole system)
  3. The client you’re using supports this feature

SMB compression is negotiated between the client and server, so both need to support it for it to work.

Additionally, in IT, it is standard practice to provide your system specifications when reporting issues. I'm not a mind reader, and without basic details like your version or error logs, troubleshooting is impossible. Going forward, I will ignore and block such incomplete requests in future!

If you still want help, please provide:

  1. Your exact Samba version
  2. The full error message
  3. The relevant parts of your smb.conf file

With this information, I can better assist you.

P.S. Samba configuration can be complex, and changes can have significant impacts on your system’s security and performance. If you’re not familiar with Samba administration, I strongly suggest reading the official documentation or consulting experienced admins before making changes. Always back up your configuration first.

Black6spdZ commented 3 weeks ago

running samba 4.15.13 and can verify SMB compression works well between two Windows 11 PC clients

my smb.conf:

[global] printcap name=cups winbind enum groups=yes include=/var/tmp/nginx/smb.netbios.aliases.conf min protocol=SMB2 server multi channel support=yes security=user local master=no realm=* aio read size=1 passdb backend=smbpasswd printing=cups max protocol=SMB3 winbind enum users=yes load printers=yes aio write size=1 workgroup=WORKGROUP smb compression = yes

here's a test I just performed between two W11 1Gb connected PCs.. 6GB database file so highly compressible "7z fast shrunk it to ~312MB"

image png de36e86634fbd69fa953da0ec3880e2a

and another, one laptop connected via AC wifi.. same transfer with and without compression enabled

image(1) thumb png 8599d19235a029f22b7247421b5672b1

but when transferring same files to and from my linux samba server still only get wire speed. am I missing something else? I would LOVE to get this working

VolkanSah commented 3 weeks ago

Hey there, thanks for the update!

You're already running a solid Samba version (4.15.13), and your smb.conf looks mostly good at first glance, but there are a few things we can try to dig deeper into this issue.

Check Client Compatibility

SMB compression is negotiated between the client and the server, and it sounds like your Windows 11 clients support it. However, the way Linux handles this could differ slightly. You mentioned getting wire speed, which indicates that compression isn’t happening. Just to rule it out:

robocopy \\your-samba-server\share C:\path-to-copy /compress

This will ensure the compression flag is being negotiated.

SMB Compression Threshold

Sometimes, even with compression enabled, the server may not compress files if it thinks they aren’t compressible. Although 6GB should be compressible, try setting a lower compression threshold:

smb compression = yes

And add:

compression min size = 1024

This ensures smaller files will be compressed as well.

Multi-Channel and AIO Settings

Your aio read size = 1 and aio write size = 1 are enabling asynchronous I/O for any size, which is good for performance but could be affecting the compression. Try temporarily disabling AIO by setting both values to 0:

aio read size = 0
aio write size = 0

Then test the transfer again. You can also try toggling off multi-channel support if you think it's interfering:

server multi channel support = no

Debugging with Logs

To gain more insights into what's happening under the hood during the transfer, increase the Samba log level temporarily. In your smb.conf:

log level = 3

After running the file transfer again, check your Samba logs for any clues as to why compression isn’t being applied.

Let me know if any of these changes help! If you're still not getting anywhere, providing logs or more specific details from the smbd side might help diagnose further.

Black6spdZ commented 3 weeks ago

so far as you've suggested I've tried changing aio to 0, multichannel to no and restarting smbd between config changes as well as using robocopy /compress to copy some known compressible files.. each time I still only get wire speed max. I enabled log level to 3 and see this: Copyright Andrew Tridgell and the Samba Team 1992-2022 ../../lib/param/loadparm.c:753: [2024/09/29 13:10:09.350978, all 0, pid=18975] lpcfg_map_parameter Unknown parameter encountered: "smb compression" ../../lib/param/loadparm.c:1967: [2024/09/29 13:10:09.351014, all 0, pid=18975] lpcfg_do_global_parameter Ignoring unknown parameter "smb compression"

VolkanSah commented 3 weeks ago

It looks like your Samba version (4.15.13) doesn’t recognize the smb compression parameter, as seen from the log:

Unknown parameter encountered: "smb compression"
Ignoring unknown parameter "smb compression"

This likely means that your Samba build doesn't support this feature, even though it's supposed to be available in 4.15. Try running:

testparm -v | grep compression

This will confirm if compression is supported in your build. If not, you may need to update Samba or recompile with full feature support.

As a reminder, it's generally a good idea to avoid system tuning unless you're fully aware of the consequences, especially when certain features aren't working as expected. Improper configurations can reduce performance or introduce other issues.

VolkanSah commented 3 weeks ago

I'm closing this issue as it seems you don't have a full understanding of Samba's functionality. I strongly advise against using the settings from my markdown unless you have compiled Samba correctly or have an experienced admin assist you. I’m not here to provide free support, especially for issues unrelated to my shared configurations or actual errors. Please take the time to read the Samba documentation and ensure your system has Samba fully compiled.

Black6spdZ commented 3 weeks ago

I never claimed to be a programmer but your guide obviously DOESN'T apply to everyone and currently millions of Synology NAS units around the world

VolkanSah commented 3 weeks ago

Ah , so now you finally drop the bombshell that you're tinkering with a Synology NAS. Well, that explains everything. You're seriously comparing a cheap consumer platform that's primarily built to store data on a glorified motherboard to a professional high-performance server tuned for flexibility and peak efficiency? Wow.

Let me explain the differences for you, because clearly, this has completely flown over your head:

And the fact that you bring up "millions of Synology NAS units worldwide" is irrelevant. It doesn't change the fact that you're comparing a consumer-grade solution with a server infrastructure that's in a completely different league. Your setup cannot and will not have the same capabilities—this is not a flaw in my guide, but your stupidity in using the wrong hardware and software combination for what you're trying to achieve.

Let me be clear: If I had known from the start that you were working with a Synology NAS, I would have told you right away to forget about SMB compression. You're not just wasting my time, you're also wasting your own, trying to bring a rudimentary toy like Synology to the level of a professional Samba server. It's just not possible. And frankly, it's childish!

Next time, take the time to provide the correct information instead of wasting my time with incomplete queries. Synology is not a professional solution for what you're trying to do. Period.

Remember Titel: Optimize your Samba Server 2024 -> Server ! Not Toy!

Learn first some respect for the free-work others, and realize that GitHub is not meant for children like you. IT is a complex field with its own standards and norms. Get out of my codebase. Understood?

VolkanSah commented 3 weeks ago

closed