Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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"
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.
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.