Samba/remote copy exhausts local memory

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Bert

Well-Known Member
Mar 31, 2018
841
392
63
45
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
956
359
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

Well-Known Member
Mar 31, 2018
841
392
63
45
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