0

In a VM of 16GB RAM, we are running rsync as a cron job(for every 10 minutes) on our production to sync GBs of folder from AWS EFS to local storage. After few days of running we found that the VM is running low on memory and we found that size of our buffer/cache is more than 4GB and using vmtouch we confirmed that entire folder we are syncing is getting cached.

Since we are running this on production we have an alerting system which alerts whenever available memory in VM is less than 20%.

So as a quick fix we are clearing cache after each time rsync runs using command echo 2 > /proc/sys/vm/drop_caches.

I'm completely against this, because clearing cache will affect the performance. But on the internet there are few articles which suggests clearing cache after running rsync jobs some of them are 1, 2. Also there are lot of other resources on internet which says not to clear cache.

Considering only rsync

  1. Do we really need to worry about aggressive caching it is doing because of which our buff/cache is very high
  2. How rest of the world is dealing with this? are you guys clearing cache each time you run rsync

rsync command we are using rsync -aA --delete /... /...

1
  • cache is cache and will be freed if memory is required do not cleqn cqche like that and do not qlert on high cache uses, it's normal for linux to cache stuff but hte memory is available. Commented Dec 3, 2022 at 12:40

1 Answer 1

0

Unused memory is wasted, so any spare memory is considered by the kernel to be available as buffer cache. It can be discarded as soon as necessary should an application need the memory.

If your entire folder is cached then that should mean that comparison between the source files and the destination files is very efficient.

The rsync command itself looks fine. You're not using -H (which can be very memory hungry), and you are usefully retaining timestamps (-t implied by -a). The only other part to be aware of is that as far as rsync is concerned you are copying from one part of the local filesystem to another, so files that just need to be updated will still be copied in their entirety.

3
  • -aA & --delete these are the flags I'm using, am I missing something? Commented Dec 3, 2022 at 14:44
  • we are syncing from folder X mounted on EFS(NFS) to another folder on local storage, are there any concern about this? Commented Dec 3, 2022 at 15:07
  • No concern. Just that rsync treats this as a local copy. You'd potentially get better efficiencies if you could run an instance of rsync on the remote server Commented Dec 3, 2022 at 16:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.