LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   rsync memory usage (https://www.linuxquestions.org/questions/linux-server-73/rsync-memory-usage-4175571386/)

paul2015 02-04-2016 02:40 AM

rsync memory usage
 
hellow everyone,

I backup my webserver's data daily with rsync. after backup it caches memory and when web server is loaded memory is swapping. If i reboot server after rsync backup web server does not swap memory. So it happens because of rsync's memory usage. Can you suggest how to limit rsync memory usage. I do incremental backups with rsync.

thank you.

juandresen 02-04-2016 03:10 AM

Have you checked if your target hard drive has enough space for the backup?

paul2015 02-04-2016 03:13 AM

yes it has 700BG free backup size is max 11GB, ram on server is 8GB

juandresen 02-04-2016 03:34 AM

Did you also check if your ionodes aren't all used?

$ df -i

juandresen 02-04-2016 03:34 AM

can you post your rsync command?

paul2015 02-04-2016 03:50 AM

rsync command:

rsync -Aaxv

inodes:
used free
166 60882778

juandresen 02-04-2016 04:24 AM

after using rsync the memory should be released. if indeed the memory does not get released it might point to a memory leak somewhere. i found that other people had the same problem, a possible (but I do not know if recommendable) solution is to drop the cache after rsync

sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

see

https://www.linuxquestions.org/quest...memory-758345/

http://askubuntu.com/questions/46565...c-memory-usage

Guttorm 02-04-2016 04:25 AM

Hi

rsync uses memory depending on how many files are rsynced. So one way to limit memory usage is to do it in many operations instead. Version 3 and newer use less than older, but both sender and receiver has to be version 3 or newer.

But are you sure it really is a problem? Typically, you configure the server to use more memory for the web server and database. When rsync runs, it needs more. It can then swap out unused memory - which can be unused services, video memory and such things. When rsync is finished, that unused memory stays in the swap until it's needed. If it's not needed, it will just stay there. You now have more free memory, which is typically used for file cache and kernel buffers.

paul2015 02-04-2016 04:27 AM

yes will try but php files and web server data is also cached in memory. I think it will be safe to drop cache.

Guttorm 02-04-2016 04:33 AM

Why drop the cache? All it does is to drop the file cache, so it will have to be read again later. It will just make things slower.

Is the reason simply that you see swap is uses with for example top? Then I think you are mistaken. It's a good thing that unused memory is put in swap. You now have more memory for file system cache and buffers.

paul2015 02-04-2016 04:37 AM

yes reason is that and may be it's my mistake or don't understan something but, as I know if apache data will be swapped it will slow down server. so it's memory in swap from rsync not webserver's data?

syg00 02-04-2016 04:38 AM

Listen to @Guttorm - if you don't know what you are looking at, how can you make a proper decision ?.

juandresen 02-04-2016 04:40 AM

If the data in the memory will be used only every 24 hours, there is really no need to keep it there. Moreover, if other programs start to swap, it could actually be a memory leak, so that memory would not be used again.

paul2015 02-04-2016 09:08 AM

thanks guys, my mistake :D now it's clear little bit. I have also read this now I have clear understanding about that. and it has solved my problem.


All times are GMT -5. The time now is 09:31 AM.