Script to flush cache in ram?
Posted: Wed Mar 03, 2010 7:20 pm
I've noticed that when I'm streaming videos over my wireless network that after a short period of time watching, and/or after transferring a large file from my hda, that the transfers slow significantly (ie., slow transfers or stalled video streaming).
One thing that seems to solve the problem is clearing the cache from my ram using the following:
This seems to speed the system right back up, so I don't think it's a network issue. Got the code from here :http://www.scottklarr.com/topic/134/lin ... om-memory/
MY QUESTION IS:
Does anyone know how to insert this into a bash script that would clear the cache when it reaches a certain percentage of ram usage (eg.,50%)? That way I could insert the script at startup and keep my speed all spiffy and shiny like new!!!![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
Example equation (logic):
I know the code is nowhere near correct
but the logic is simple enough.
P.S. I've got plenty of ram (4x1gb) so I'm certain I'm not the only one (at least I think...) that experiences this, plenty of other Amahi users would benefit greatly from a solution to this!!![Smile :)](./images/smilies/icon_e_smile.gif)
One thing that seems to solve the problem is clearing the cache from my ram using the following:
Code: Select all
sync; echo 3 > /proc/sys/vm/drop_caches
MY QUESTION IS:
Does anyone know how to insert this into a bash script that would clear the cache when it reaches a certain percentage of ram usage (eg.,50%)? That way I could insert the script at startup and keep my speed all spiffy and shiny like new!!!
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
Example equation (logic):
Code: Select all
#! /bin/bash
IF="% of cache using ram >/=50%" THEN="sync; echo 3 > /proc/sys/vm/drop_caches"
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
P.S. I've got plenty of ram (4x1gb) so I'm certain I'm not the only one (at least I think...) that experiences this, plenty of other Amahi users would benefit greatly from a solution to this!!
![Smile :)](./images/smilies/icon_e_smile.gif)