ubuntu:samba:optimize_samba
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:samba:optimize_samba [2019/12/04 19:02] – peter | ubuntu:samba:optimize_samba [2023/06/09 16:55] (current) – peter | ||
---|---|---|---|
Line 3: | Line 3: | ||
Samba, like any other program can use a little speed boost. | Samba, like any other program can use a little speed boost. | ||
- | You want to get the most out of your machines and optimizing your applications can extend their life by doing the job longer. | + | * You want to get the most out of your machines and optimizing your applications can extend their life by doing the job longer. |
- | + | | |
- | Samba needs to be tuned to your network because every environment offers its own unique set of challenges. | + | |
Here is a collection of hints and tricks tp Optimize Samba. | Here is a collection of hints and tricks tp Optimize Samba. | ||
Line 34: | Line 33: | ||
===== Raw read and write ===== | ===== Raw read and write ===== | ||
- | These are important performance configuration options; they enable Samba to use large reads and writes to the network, of up to 64KB in a single SMB request. | + | These are important performance configuration options; they enable Samba to use large reads and writes to the network, of up to 64KB in a single SMB request. |
+ | |||
+ | They also require the largest SMB packet structures, SMBreadraw and SMBwriteraw, | ||
+ | |||
+ | In the past, some clients failed if you tried to use read raw. No clients suffer from this problem now. Read and write raw default to yes, and should be left on unless you find you have one of the ancient buggy clients. | ||
---- | ---- | ||
Line 40: | Line 43: | ||
===== Opportunistic locking ===== | ===== Opportunistic locking ===== | ||
- | Opportunistic locks, or oplocks, allow clients to cache files locally, improving performance on the order of 30 percent. | + | Opportunistic locks, or oplocks, allow clients to cache files locally, improving performance on the order of 30 percent. |
+ | |||
+ | For read-only files, the fake oplocks provides the same functionality without actually doing any caching. | ||
+ | |||
+ | If you have files that cannot be cached, oplocks can be turned off. | ||
+ | |||
+ | Database files should never be cached, nor should any files that are updated both on the server and the client and whose changes must be immediately visible. | ||
+ | |||
+ | oplocks can be turned off on a share-by-share basis if you have large groups of files you don't want cached on clients. | ||
---- | ---- | ||
Line 46: | Line 57: | ||
===== Log level ===== | ===== Log level ===== | ||
- | Samba produces a lot of debugging messages at level 3 and above, and writing them to disk or syslog is a slow operation. | + | Samba produces a lot of debugging messages at level 3 and above, and writing them to disk or syslog is a slow operation. |
+ | |||
+ | Much of the disk I/O would be wasted on debugging messages. | ||
+ | |||
+ | Reduce the logging level to 2 or under. | ||
---- | ---- | ||
Line 54: | Line 69: | ||
The following Samba options will affect performance if they are not set correctly. | The following Samba options will affect performance if they are not set correctly. | ||
- | **hide files** provide a pattern to identify files hidden by the Windows client hide files will result in any file matching the pattern being passed to the client with the DOS hidden attribute set. It requires a pattern match per file when listing directories, | + | * **hide files** provide a pattern to identify files hidden by the Windows client hide files will result in any file matching the pattern being passed to the client with the DOS hidden attribute set. It requires a pattern match per file when listing directories, |
- | **lpq cache time** is used if your lpq (printer queue contents) command takes a long time to complete, you should increase lpq cache time to a value higher than the actual time required for lpq to execute, so as to keep Samba from starting a new query when one's already running. | + | * **lpq cache time** is used if your lpq (printer queue contents) command takes a long time to complete, you should increase lpq cache time to a value higher than the actual time required for lpq to execute, so as to keep Samba from starting a new query when one's already running. |
- | **strict locking** sets the strict locking option and causes Samba to check for locks on every access, not just when asked to by the client. | + | * **strict locking** sets the strict locking option and causes Samba to check for locks on every access, not just when asked to by the client. |
- | **strict sync** sets strict sync and will cause Samba to write each packet to disk and wait for the write to complete whenever the client sets the sync bit in a packet. | + | * **strict sync** sets strict sync and will cause Samba to write each packet to disk and wait for the write to complete whenever the client sets the sync bit in a packet. |
- | **sync always** is used to "sync always" | + | * **sync always** is used to "sync always" |
- | **wide links** act by turning off wide links prevents Samba from following symbolic links in one file share to files that are not in the share. | + | * **wide links** act by turning off wide links prevents Samba from following symbolic links in one file share to files that are not in the share. |
- | **getwd cache** option caches the path to the current directory, avoiding long tree-walks to discover it. It's a nice performance improvement on a printer server or if you've turned off wide links. | + | * **getwd cache** option caches the path to the current directory, avoiding long tree-walks to discover it. It's a nice performance improvement on a printer server or if you've turned off wide links. |
ubuntu/samba/optimize_samba.1575486133.txt.gz · Last modified: 2020/07/15 09:30 (external edit)