LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Rsync hogs memory (https://www.linuxquestions.org/questions/linux-server-73/rsync-hogs-memory-758345/)

alienDog 09-28-2009 08:14 PM

Rsync hogs memory
 
I'm using rsync on my fileserver to backup the data. The problem is that rsync doesn't seem to release the memory it uses. After booting ~20 MB of memory is in use. This jumps up to 270 MB after running rsync. I know rsync uses quite a bit of memory when it's running, but surely it should be released upon completion.

Here's the situation after booting the system (free -m):
Code:

            total      used      free    shared    buffers    cached
Mem:          501        48        453          0          2        23
-/+ buffers/cache:        22        479
Swap:            0          0          0

... and here after running rsync:
Code:

            total      used      free    shared    buffers    cached
Mem:          501        480        20          0        53        156
-/+ buffers/cache:        270        230
Swap:            0          0          0

Very troublesome, any ideas?

chrism01 09-28-2009 08:23 PM

Linux uses all the RAM it can find for active progs and caches. If a program exits, the RAM remains cached until another process needs it, at which pt the kernel will flush the old/unwanted stuff and re-use the RAM for the new proc.
The kernel handles all this transparently.
IOW, ignore it, it's not an issue.

alienDog 09-28-2009 08:43 PM

I knew someone would say that ;) That's why I posted the output of the free command in the first place.

I know about Linux caching. However, if you take a look at the output of the free command above, you'll notice that 480 MB of total memory is in use and only 156 MB cached + 53 MB buffered (i.e. 209 MB), so I'm still missing the mentioned 270 MB (well, 271 MB actually, but that's a rounding error). It _is_ an issue because after a couple of rsyncs almost all the memory is used (disappeared, not cached+buffered) and the system becomes very unresponsive.

alienDog 10-04-2009 02:42 PM

Anyone?

foodown 10-04-2009 02:47 PM

Wow . . . well, if you really think that rsync is leaking or failing to free memory, then I would suggest building a fresh version from source or downloading another binary and seeing if it still happens. I know that rsync does not do this to me.

If it still happens, the problem may not be with rsync.

Are we talking Slackware 13 here?

alienDog 10-07-2009 11:00 AM

Nope, it's not Slack 13, it's 11 (with all the available upgrades installed, though). So far I've seen no reason to upgrade it since 11 really does everything I want it to do. rsync is version 2.6.9 on this system. I'll try to build a newer one to see if that works better.

sleddog 10-07-2009 08:05 PM

Quote:

Originally Posted by alienDog (Post 3700035)
I knew someone would say that ;) That's why I posted the output of the free command in the first place.

I know about Linux caching. However, if you take a look at the output of the free command above, you'll notice that 480 MB of total memory is in use and only 156 MB cached + 53 MB buffered (i.e. 209 MB), so I'm still missing the mentioned 270 MB (well, 271 MB actually, but that's a rounding error). It _is_ an issue because after a couple of rsyncs almost all the memory is used (disappeared, not cached+buffered) and the system becomes very unresponsive.

I've seen the same think after rsyncing a largish directory tree. From the bit of research I did, it seems to be attributable to dentries /inode buffers. You can flush those buffers and reclaim the memory by doing:

Code:

[root@server] sync; echo 2 > /proc/sys/vm/drop_caches
But I don't think it's really necessary. Linux will eventually reclaim the memory when needed.

A note about rsync: it's recommended to have the same rsync version on both ends of the transfer for best performance and to avoid possible issues. And v. 3 brings some important changes -- have a look through the release notes.

alienDog 10-07-2009 09:28 PM

drop_caches doesn't work with 2.4 series kernel. I think I'll just compile a newer version of rsync and see how that goes.

Quanticles 11-09-2009 02:23 PM

Quote:

Originally Posted by sleddog (Post 3711660)
I've seen the same think after rsyncing a largish directory tree. From the bit of research I did, it seems to be attributable to dentries /inode buffers. You can flush those buffers and reclaim the memory by doing:

Code:

[root@server] sync; echo 2 > /proc/sys/vm/drop_caches
But I don't think it's really necessary. Linux will eventually reclaim the memory when needed.

A note about rsync: it's recommended to have the same rsync version on both ends of the transfer for best performance and to avoid possible issues. And v. 3 brings some important changes -- have a look through the release notes.


I'm running RHEL5.4 and am using rsync for backup onto a 2nd disk (something like poor man's RAID 1). This worked for me. Thanks!


All times are GMT -5. The time now is 12:25 PM.