Is there a way to modify Debian settings so the memory could be used more for disk read/write caching ? I am already using RAID 0 but thats not enough for multiple users, and the disk is almost struggled.

Torrents use the disk very much and rTorrent doesn't have cache settings.

Update: the output of free -m is

              total       used       free     shared    buffers     cached
Mem:          7899       7848         50          0         59       7369
-/+ buffers/cache:        420       7479
Swap:         3998          0       3998

Why is so much memory cached ?


Looks like another shout out to LinuxAteMyRam is necessary. :)

The "cached" column is how much it's using for disk cache. The only way to increase that amount is by adding more RAM.

| improve this answer | |
  • 2
    +1 for LinuxAteMyRam.com - I'll have to remember that one for future forwarding. – David Spillett Apr 20 '10 at 21:06
  • Ok, let me put another question: how do I know that my rTorrent instances uses that cache or not. This is my issue, I think rTorrent doest use enough RAM though there is enough of it available. – Claudiu Apr 20 '10 at 21:09
  • 1
    rTorrent will use as much as it needs for current activity - there are options to tweak memory use but these are generally to make it use less, not more. You are better off letting the app keep only as much as it needs and letting the OS manage caching. If you want to force rtorrent to have extra chunks of its content in memory you could perhaps create a ram-based filesystem and save/serve the files from there. – David Spillett Apr 20 '10 at 21:29
  • +1 for the clear site, saves a lot of hassle explaining :) – Wrikken Jun 5 '10 at 16:28

You can control a lot of this stuff from /proc/sys/vm. I doubt prodding any of it will help if the problem is just that more RAM is needed, but "dirty ratio" might be worth tweaking to help batch up multiple small writes. See also this tale of performance tuning a disk system (just to give you an idea of the sort of complication you can get into).

| improve this answer | |
  • I don't think more RAM is needed, server has 8 GB, but htop reports only 500-600MB RAM used. – Claudiu Apr 20 '10 at 19:23
  • 1
    The "used" figure in htop does not count memory used for cache and buffers. See the top line of the output from free -m for figures that take this into account. – David Spillett Apr 20 '10 at 19:59
  • main post updated with free -m results – Claudiu Apr 20 '10 at 20:44

If there is any RAM not currently in use and there is IO activity to physical devices (i.e. your disks) then the kernel will use the free memory to hold a copy of the transferred data in RAM in case it is needed again shortly. As soon as an application asks for some RAM some of that cache/buffer memory will be freed and handed over, the least recently touched data being purged first.

If a system running as a file server or otherwise transferring large amounts of data but nut running much else (i.e. running a torrent client in your example) seeing that much RAM used for cache is not at all unexpected.

There are other things that can get counted in the "cached" figure. See In Linux, what is the difference between "buffers" and "cache" reported by the free command? for some more detail on that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.