I've got a system that collects a lot of data, than backs it up occasionally and pushes it to another server. My problem is that, while data collection process is taking 2-3% of memory, the rest of RAM fills up with PageCache, which causes problems for me.
sysctl -w vm.drop_caches=1
clears the memory, and I can set up chron job to clean it now and than, but this seems like inelegant solution. I'd rather disable the pagecache altogether on the raid disc that the app uses, or if that is not possible, on the whole server.
I've tried this code to start the app, and it doesn't work for me, pagecache keeps accumulating.
I'm running the program on Ubuntu server 20
How do I disable the PageCache on a hard drive/whole system?
UPDATE
Here's free over time:
>>> free
total used free shared buff/cache available
Mem: 3981820 202180 3600504 852 179136 3565116
Swap: 0 0 0
>>>free
total used free shared buff/cache available
Mem: 3981820 202336 3593204 852 186280 3561364
Swap: 0 0 0
>>>free
total used free shared buff/cache available
Mem: 3981820 203132 3505208 852 273480 3547512
Swap: 0 0 0
Buff/cache continues growing until I flush the memory
>>>sudo lshw -C memory
*-firmware
description: BIOS
vendor: Amazon EC2
physical id: 0
version: 1.0
date: 10/16/2017
size: 64KiB
capacity: 64KiB
capabilities: pci edd acpi virtualmachine
*-memory
description: System memory
physical id: 1
size: 4GiB
>>>sysctl vm.swappiness
vm.swappiness = 60
free -h
andsudo lshw -C memory
andsysctl vm.swappiness
.