Samba/remote copy exhausts local memory

Bert

Active Member
Mar 31, 2018
418
159
43
42
I am performing copy of large files over a 10Gb/s connection. The source is running on a fast source, providing read speeds 400MB/sec. Target disk is slow. When I use cp or rsync, my destination machine runs of memory and becomes unresponsive.

It seems like destination server hogs lots of memory and exhausts virtual memory and become unresponsive. Both source and target are debian 10.

I am curious if there is a fix for this problem other than limiting the bandwidth. Is there something about samba server to throttle?
 

RTM

Well-Known Member
Jan 26, 2014
781
287
63
It sounds to me like the problem is that Samba is doing asynchronous writes (copying to memory on server before flushing to disk).

I see two possible solutions (though I have not tried them myself):
  1. Ensure Samba is doing synchronous writes (perhaps this guide will help) - keep in mind this will probably be slower
  2. Try to limit the write cache, it looks like you want to set "write cache size" as shown here (note that apparently this parameter appears to have been removed in Samba 4.15, so in a future update beyond even debian 11 you may lose this. As indicated perhaps io_uring is the solution to that?)
 
  • Like
Reactions: Bert

Bert

Active Member
Mar 31, 2018
418
159
43
42
It sounds to me like the problem is that Samba is doing asynchronous writes (copying to memory on server before flushing to disk).

I see two possible solutions (though I have not tried them myself):
  1. Ensure Samba is doing synchronous writes (perhaps this guide will help) - keep in mind this will probably be slower
  2. Try to limit the write cache, it looks like you want to set "write cache size" as shown here (note that apparently this parameter appears to have been removed in Samba 4.15, so in a future update beyond even debian 11 you may lose this. As indicated perhaps io_uring is the solution to that?)
Thanks for your help. I have tried sync writes and that brought down the performance to unacceptable levels. I use the "write cache size" setting to control the memory usage. So far, it works!
 
  • Like
Reactions: RTM