Results 1 to 9 of 9

Thread: Freeing up cache, are these commands ok to use?

  1. #1
    Join Date
    Dec 2007
    Location
    ..right behind you..BYAH!
    Beans
    969

    Freeing up cache, are these commands ok to use?

    I use the System Monitor addon for my panel and its always bothered me that my mem display is constantly green top the top with cashed data. A quick google search got me this result.

    Running these commands:

    Code:
    echo 1 > /proc/sys/vm/drop_caches
    Code:
    echo 2 > /proc/sys/vm/drop_caches
    Code:
    echo 3 > /proc/sys/vm/drop_caches
    they sure do wipe out the cache and that tickles me pink, but is this detrimental to the system? Discuss.

  2. #2
    Join Date
    Dec 2007
    Location
    ..right behind you..BYAH!
    Beans
    969

    Re: Freeing up cache, are these commands ok to use?

    also if they dont do any damage could someone how me a quick script to run this as a 1 click cure.

  3. #3
    Join Date
    Apr 2006
    Beans
    265

    Re: Freeing up cache, are these commands ok to use?

    Using all of your memory is a VERY GOOD THING. It means a lot of progrmas are already in memory and so will start very quickly. It doesn't make any other programs slower. They still have to be loaded into memory when they start. It doesn't use more power - the memory chips are drawing power whether the memory is used or not.

  4. #4
    Join Date
    Dec 2007
    Location
    ..right behind you..BYAH!
    Beans
    969

    Re: Freeing up cache, are these commands ok to use?

    good point. i was more or less talking about the cache built up after im done encoding a dvd and burning it. not much useful stuff built up in that and i loath it sitting in there lol.

  5. #5
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Freeing up cache, are these commands ok to use?

    Quote Originally Posted by uberlube View Post
    good point. i was more or less talking about the cache built up after im done encoding a dvd and burning it. not much useful stuff built up in that and i loath it sitting in there lol.
    The Linux kernel manages the resources for the best system performance quite efficiently, some very smart people have put in many thousands of hours (at least....) of work into getting this sort of thing right.

    There is nothing to be gained for a user by stuffing around with things like this.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  6. #6
    Join Date
    Dec 2007
    Location
    ..right behind you..BYAH!
    Beans
    969

    Re: Freeing up cache, are these commands ok to use?

    Quote Originally Posted by dcstar View Post
    The Linux kernel manages the resources for the best system performance quite efficiently, some very smart people have put in many thousands of hours (at least....) of work into getting this sort of thing right.

    There is nothing to be gained for a user by stuffing around with things like this.
    hmm well i guess ive been told. wont be using these again.....

  7. #7
    Join Date
    Aug 2008
    Location
    Brazil
    Beans
    12,497
    Distro
    Ubuntu Studio 12.04 Precise Pangolin

    Re: Freeing up cache, are these commands ok to use?

    Quote Originally Posted by dcstar View Post
    The Linux kernel manages the resources for the best system performance quite efficiently, some very smart people have put in many thousands of hours (at least....) of work into getting this sort of thing right.

    There is nothing to be gained for a user by stuffing around with things like this.
    The same old story, which I disagree. There are several threads out there, including one of my own, about decreased system performance when the memory is fully used by the cache.

    Quote Originally Posted by uberlube View Post
    hmm well i guess ive been told. wont be using these again.....
    If you are not experiencing any issues when memory is fully used by the cache, then you don't need to free memory like you probably did on Windows. Nevertheless, I do experience performance issues after a while, when the cache is full. So I do clean up the cache memory sometimes, using this command:

    Code:
    sudo echo "ready" && sudo echo 3 | sudo tee /proc/sys/vm/drop_caches

  8. #8
    Join Date
    Dec 2007
    Location
    ..right behind you..BYAH!
    Beans
    969

    Re: Freeing up cache, are these commands ok to use?

    Im inclined to agree with you about only doing when u see a decrease in performance. Thnx for the code.

  9. #9
    Join Date
    Nov 2005
    Location
    Uppsala, Sweden
    Beans
    2,180
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Freeing up cache, are these commands ok to use?

    Quote Originally Posted by uberlube View Post
    Im inclined to agree with you about only doing when u see a decrease in performance. Thnx for the code.
    I think the decrease in performance you notice when the ram is filled up with cache is because data from ram starts to be swapped to the hard drive, which causes a delay when things that were swapped to the hard drive needs to be read back into ram.
    You can tune how aggressive swapping should be by changing "swappiness":
    Code:
    gksudo gedit /etc/sysctl.conf
    Add this line to the end of the file:
    Code:
    vm.swappiness = 10
    And load the new setting:
    Code:
    sudo sysctl -p
    Swappiness should be a number between 0 and 100, where 100 means things are swapped out very quickly => lots of free memory, but heavy usage of the swap partition, and 0 means things stay in ram as long as possible => high memory usage, but the swap partition is only used if ram is almost full (of other things than cache or buffers).
    The default in ubuntu is 60, I keep mine at 0 without any problems.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •