<div dir="auto">Just note this patch has nothing to do with memory consumption vs performance. It just avoids allocating memory that was left unused anyway.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Oct 2, 2021, 12:51 devzero--- via rsync <<a href="mailto:rsync@lists.samba.org">rsync@lists.samba.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>>In the exchange I argued that proper use of ram as a buffer would have cut down backup time to minutes instead of days.<br>
<br>
could you give an example where rsync is slowing things down so much due to ram constraints or inefficient ram use?</div>

<div><br>
please mind that disk bandwith and file copy bandwith is not the same. random i/o and seek time is the culprit.<br>
<br>
why should rsync use ram for buffering data it copies, if the linux kernel / vm subsystem already does this?<br>
<br>
roland
<div> 
<div style="margin:10.0px 5.0px 5.0px 10.0px;padding:10.0px 0 10.0px 10.0px;border-left:2.0px solid rgb(195,217,229)">
<div style="margin:0 0 10.0px 0"><b>Gesendet:</b> Samstag, 02. Oktober 2021 um 12:07 Uhr<br>
<b>Von:</b> "Rupert Gallagher via rsync" <<a href="mailto:rsync@lists.samba.org" target="_blank" rel="noreferrer">rsync@lists.samba.org</a>><br>
<b>An:</b> <a href="mailto:makovick@gmail.com" target="_blank" rel="noreferrer">makovick@gmail.com</a>, <a href="mailto:rsync@lists.samba.org" target="_blank" rel="noreferrer">rsync@lists.samba.org</a><br>
<b>Betreff:</b> Re: [PATCH] Reduce memory usage</div>

<div>If you look at my previous exchange in the list, I raised the need for more ram usage via a tool option. In the exchange I argued that proper use of ram as a buffer would have cut down backup time to minutes instead of days. At the time, my proposal was dismissed by someone saying that rsync uses as much ram as it needs. I still feel the need to free rsync from this mindless constraint, while also welcoming ram usage optimisations such as yours in this patch. How hard can it be to allow rsync to use 1GB of ram instead of 100MB? The benefit would be huge. In my case, where a supermicro server uses a shared bus to transfer data from two disks, the overhead caused by frequent small buffer IO is so high that backup time is still huge. And I am using server hardware! PC and laptops are even worse.<br>
<br>
RG<br>
<br>
<br>
<br>
<br>
-------- Original Message --------<br>
On Sep 26, 2021, 13:54, Jindřich Makovička via rsync < <a href="mailto:rsync@lists.samba.org" target="_blank" rel="noreferrer">rsync@lists.samba.org</a>> wrote:<br>
Hi,<br>
<br>
When using rsync to back up the file system on my laptop, containing a pretty much default linux desktop, I was wondering how rsync uses over 100MB of RAM it allocates.<br>
<br>
It turned out that most of the memory is used for the arrays of file_struct pointers, most of which end up unused - much more than the actual file_struct entries. In my case, the peak usage was 135MB of pointers, and just 1.5MB of the file_struct entries themselves.<br>
<br>
The problem seems to be that the default file_list allocation parameters predate the incremental recursion, which allocates a huge number of small file lists, while AFAICS originally rsync allocated just one large list.<br>
<br>
Applying the attached patch, which reduces the default allocation to 32 pointers, and preallocates 32K pointers only for the main file lists in send_file_list and recv_file_list, reduces the peak memory usage in my case from 142MB to 12MB.<br>
<br>
Regards,<br>
--<br>
Jindřich Makovička<br>
-- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: <a href="https://lists.samba.org/mailman/listinfo/rsync" target="_blank" rel="noreferrer">https://lists.samba.org/mailman/listinfo/rsync</a> Before posting, read: <a href="http://www.catb.org/~esr/faqs/smart-questions.html" target="_blank" rel="noreferrer">http://www.catb.org/~esr/faqs/smart-questions.html</a></div>
</div>
</div>
</div></div></div>

-- <br>
Please use reply-all for most replies to avoid omitting the mailing list.<br>
To unsubscribe or change options: <a href="https://lists.samba.org/mailman/listinfo/rsync" rel="noreferrer noreferrer" target="_blank">https://lists.samba.org/mailman/listinfo/rsync</a><br>
Before posting, read: <a href="http://www.catb.org/~esr/faqs/smart-questions.html" rel="noreferrer noreferrer" target="_blank">http://www.catb.org/~esr/faqs/smart-questions.html</a><br>
</blockquote></div>