Ubuntu: Speeding up ubuntu machine [closed]



Question:

Does below command improved performance of the machine:
sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches

I know this is for freeing RAM. Please guide


Solution:1

No, it just dumps a load of stuff (slab objects and pagecache) from the system cache.

If your system is out of memory (and I mean: deep into swap usage, nothing free, hard disk churning) then yes, this might help... But not as much as:

  • Buying more RAM, it isn't expensive or hard to fit.
  • Closing something that's using lots of memory (or tabs from a browser).
  • Using something faster for swap space (eg SSD)
  • Compressing swap

So while it may work for a few seconds, if you have something rampaging all over your RAM, you'd do better just to close it, or buy it more RAM with which to rampage over. Freeing up inode and page cache isn't going to help you for long.


Solution:2

No, see How do I clean or disable the memory cache? for an indepth answer.

Cache is there to be used and to speed things up. So Linux makes full use of caching. If you do this it will takes seconds for the cache to be filled up again.

Adding hardware to your system would be more efficient (depending on what triggered your question it might be memory or a better hard disk).


Solution:3

You can also write command as:

echo 3 > /proc/sys/vm/drop_caches  

The above command will free pagecache, dentries and inodes. And

sudo sync  

is used to to make sure all cached objects are freed as dirty objects are not free-able and the echo operation is non-destructive.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »