Memory Ram And Swap
Autor: Milton Kowalewski | Publicado: 2012-06-18T06:02:00-07:00







VIEW MEMORY RAM AND SWAP

See terms of memory.

free -m
Memory Ram And Swap
Terminal

ubuntu@ubuntu-12:~$ free -m
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp; &nbsp; free &nbsp; &nbsp; shared &nbsp; &nbsp;buffers &nbsp; &nbsp; cached
Mem: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3889 &nbsp; &nbsp; &nbsp; 2615 &nbsp; &nbsp; &nbsp; 1274 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;172 &nbsp; &nbsp; &nbsp; 1533
-/+ buffers/cache: &nbsp; &nbsp; &nbsp; &nbsp;909 &nbsp; &nbsp; &nbsp; 2980
Swap: &nbsp; &nbsp; &nbsp; &nbsp; 3954 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 3954



Clean Ram Memory



echo 3 &gt; /proc/sys/vm/drop_caches

Terminal


ubuntu@ubuntu-12:/home/ubuntu# free -m
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp; &nbsp; free &nbsp; &nbsp; shared &nbsp; &nbsp;buffers &nbsp; &nbsp; cached
Mem: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3889 &nbsp; &nbsp; &nbsp; 2356 &nbsp; &nbsp; &nbsp; 1533 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;170 &nbsp; &nbsp; &nbsp; 1436
-/+ buffers/cache: &nbsp; &nbsp; &nbsp; &nbsp;749 &nbsp; &nbsp; &nbsp; 3140
Swap: &nbsp; &nbsp; &nbsp; &nbsp; 3954 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 3954
root@ubuntu-12:/home/ubuntu# echo 3 &gt; /proc/sys/vm/drop_caches
root@ubuntu-12:/home/ubuntu# free -m
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp; &nbsp; free &nbsp; &nbsp; shared &nbsp; &nbsp;buffers &nbsp; &nbsp; cached
Mem: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3889 &nbsp; &nbsp; &nbsp; &nbsp;844 &nbsp; &nbsp; &nbsp; 3045 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp;142
-/+ buffers/cache: &nbsp; &nbsp; &nbsp; &nbsp;699 &nbsp; &nbsp; &nbsp; 3189
Swap: &nbsp; &nbsp; &nbsp; &nbsp; 3954 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 3954


MEMORY SWAP
Ubuntu beyond the memory ram uses a partition called swap, the recommendation is that this partition has doubled in size for systems that have little memory, and up to 1Gb for systems with 1GB or more of memory. Using more than 2 Gb Swap and reckless for after Swap 2 gbs of the system begins to lose performance.

Ex.: 256mb ram &nbsp; / 512mb swap
Ex.: 512mb ram &nbsp; / 1024mb swap
Ex.: 1024mb ram / 1024mb swap
Ex.: 2048mb ram / 1024mb swap

BALANCING RAM MEMORY AND SWAP


For the best performance of your Ubuntu machine can change the default value that the system uses RAM memory or swap.




On machines with low memory ram is interesting to use more system memory swap not to overload the memory ram, but for computers with enough memory can download the values ​​of swap memory for quicker access to temporary data.



The values ​​of this management swappiness range from 0 to 100 where 0 shall use the minimum swap and 100 maximum.



To do this you must modify a line from a file of Ubuntu sysctl.conf

to access the file:


sudo gedit /etc/sysctl.conf

The line to be modified must be the same below:

vm.swappiness = 40
Where should the place of number 40 (the number varies for each installation), plus or minus the desired value.

After modifying the value is to reboot for the changes to take effect.