“My linux server is running so slow and it appears I am using all of my RAM what is going on?”.
To which we reply “It’s a feature not a bug”.
Linux is actually being smart and when it encounters a large file transfer (such as backing up large data directories etc) it attempts to cache recently used blocks in RAM in order to speed up the process. This is great for the file transfer but what about all the other services on your server, well you guessed it they suffer.
For backups etc we will be fine just not using the cache that is where nocache comes in. Our install base for this example is Gentoo but this has also been tested on CentOS and Ubuntu to work just fine.
#Get nocache from github mkdir /root/build ; cd /root/build/ ; wget https://github.com/Feh/nocache/archive/master.zip #unzip the file unzip /root/build/*.zip #Build the program cd /root/build/nocache-master ; make ; make install #Optional remove the build directory cd /root ; rm -rf /root/build
Once you have built and installed the program it should be located at /usr/local/bin/nocache
Now you just have to call the nocache program before calling your large file transfer
/usr/local/bin/nocache cp /data/large_directory /mnt/backup/
If you are interested in further information there is a good blog post here to refer to: