Chris Fanning wrote:>snip
>
> But I am worried about the cache that Samba makes use of. We would
> like samba to write to disk immediately.
> We've found these two options for smb.conf
>
> sync always = yes
> strict sync = yes
>
> I can't quiet see the difference between the two in my case.
> If I set 'sync always = yes' _or_ 'strict sync = yes', I
can copy
> files at 70MB/s (similar to NFS using async).
> If I set both options, file transfer speed drops to about 20MB/s
>
> Does that mean that I do need to set both options to ensure the cache
> is written to disk before the server returns the ok to the client?
> How could I test this?
>
> And now while I'm here ;) , does anyone have any other recommendations
> for this kind of setup?
>
> Thanks,
> Chris.
Hi Chris, I did an investigation on this in 2003. Here are the
results. Not sure if things have changed since then.
---------------------------------------------------------------
Samba defaults to asynchronous writes. smbd writes to memory buffer,
then returns to processing. Buffer is flushed to disk later. This is
the most efficient behavior.
Windows CreateFile API has the FILE_FLAG_WRITE_THROUGH flag, which
requests synchronous writes. smbd writes to memory buffer, blocks until
buffer contents are written to disk, which results in poor performance,
but better data integrity.
When "strict sync = yes" (default = no) Samba honors the
FILE_FLAG_WRITE_THROUGH flag, and results in synchronous writes when
called by the CreateFile API.
When "sync always = yes" (default = no) Samba executes all writes
synchronously. This requires that ?strict sync = yes?.
StrictSync SyncAlways ff_write_through Sync-Writes
no no no no
yes no no no
yes no yes Yes (slow)
no yes yes no
yes yes yes/no yes (very slow)
Eric Roseme