2

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 ?

Claudiu
  • 85
  • 1
  • 10

3 Answers3

7

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.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • 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 05 '10 at 16:28
2

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).

timday
  • 856
  • 1
  • 10
  • 24
1

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.

David Spillett
  • 22,534
  • 42
  • 66