ͨ¹ýÐÞ¸ÄLinuxϵͳϵÄswappinessÀ´½µµÍ¶ÔÓ²Å̵Ļº´æ
Ê×Ïȼòµ¥µÄ˵һÏÂswap·ÖÇøµÄ×÷Óã¬ÆäʵlinuxϵͳϵÄswap·ÖÇøÓëwindowsϵÄÐéÄâÄÚ´æ²î²»¶àÒ»¸öÒâ˼£¬swap¿Õ¼äµÄ×÷Óÿɼòµ¥ÕâÑùÀí½â£ºµ±ÏµÍ³µÄÎïÀíÄÚ´æ²»¹»ÓõÄʱºò£¬¾ÍÐèÒª½«ÎïÀíÄÚ´æÖеÄÒ»²¿·Ö¿Õ¼äÊͷųöÀ´£¬ÒÔ¹©µ±Ç°ÔËÐеijÌÐòʹÓá£ÄÇЩ±»ÊͷŵĿռä¿ÉÄÜÀ´×ÔһЩºÜ³¤Ê±¼äûÓÐʲô²Ù×÷µÄ³ÌÐò£¬ÕâЩ±»ÊͷŵĿռ䱻ÁÙʱ±£´æµ½swap¿Õ¼äÖУ¬µÈµ½ÄÇЩ³ÌÐòÒªÔËÐÐʱ£¬ÔÙ´ÓswapÖлָ´±£´æµÄÊý¾Ýµ½ ÄÚ´æÖС£ÕâÑù£¬ÏµÍ³×ÜÊÇÔÚÎïÀíÄÚ´æ²»¹»Ê±£¬²Å½øÐÐswap½»»»¡£
Ò²¾ÍÊÇ˵linux »áʹÓÃÓ²Å̵ÄÒ»²¿·Ö×öΪswap·ÖÇø£¬ÓÃÀ´½øÐнø³Ìµ÷¶È--½ø³ÌÊÇÕýÔÚÔËÐеijÌÐò--°Ñµ±Ç°²»ÓõĽø³Ìµ÷³É¡®µÈ´ý£¨standby£©¡®£¬ÉõÖÁ¡®Ë¯Ãߣ¨sleep£©¡¯£¬Ò»µ©ÒªÓã¬ÔÙµ÷³É¡®»î¶¯£¨active£©¡¯£¬Ë¯ÃߵĽø³Ì¾ÍÌɵ½SWAP·ÖÇø˯´ó¾õ£¬°ÑÄÚ´æ¿Õ³öÀ´Èøø¡®»î¶¯¡¯µÄ½ø³Ì¡£
¡¡¡¡Èç¹ûÄÚ´æ¹»´ó£¬ÄÇôÕâ¸öʱºòÓ¦¸ÃÈà linux ²»±ØÌ«¶àµÄʹÓÃswap·ÖÇø£¬ ¿ÉÒÔͨ¹ýÐÞ¸ÄswappinessµÄÊýÖµ¡£µ±swappinessΪ0µÄʱºò±íʾ×î´óÏÞ¶ÈʹÓÃÎïÀíÄڴ棬Ȼºó²ÅÊÇ swap¿Õ¼ä£¬µ±swappinesΪ100µÄʱºò£¬Ôò±íʾ»ý¼«µÄʹÓÃswap·ÖÇø£¬²¢ÇÒ°ÑÄÚ´æÉϵÄÊý¾Ý¼°Ê±µÄ°áÔ˵½swap¿Õ¼äÀïÃæ¡£
ÔÚCentOS¡¢Red Hat¡¢ubuntuµÈϵͳÖУ¬swappinessµÄĬÈÏÖµ¶¼Îª60£¬Èç¹ûLinux·þÎñÆ÷µÄÄÚ´æºÜС£¬±ÈÈç˵µÍÓÚ4G£¬ÄÇô¿ÉÒÔ²»Óøü¸ÄÕâ¸öÖµ£¬ÒòΪ±Ï¾¹¿¼Âǵ½ÄÚ´æ²»¹»ÓöøÈ¥½èÓÃswapµÄÇé¿ö¡£¶øÏà¶ÔÓںܶà·þÎñÆ÷À´Ëµ£¬Ä¿Ç°»¹Êǽ¨ÒéÉèÖÃÔÚֵΪ25ÒÔÏ£¬Èç¹û³¬¹ýÁË8GÄڴ棬¶øÇÒÄ¿Ç°ÄÚ´æʹÓÃÁ¿»¹ÓÐÊ£ÓàµÄ»°£¬½¨ÒéÖ±½Ó½«swappiness¸Ä³É0£¬ÕâÑù¿ÉÒÔ×î´óÏ޶ȵÄʹÓÃÎïÀíÄڴ棬¼õÉÙÓ²Å̵ĸºÔØ£¬Í¬Ê±¼Ó¿ìËٶȡ£Ò²±ÜÃâÔÚʹÓÃMemcachedµÄʱºò³öÏÖ"memcached timeout error because of slow response"ÕâÑùµÄ´íÎó¡£
¹ØÓÚswappiness²Ù×÷Ïà¹ØµÄÃüÁî:
²é¿´swappinessµ±Ç°ÉèÖõÄÖµ
#cat /proc/sys/vm/swappiness
ÐÞ¸ÄswappinessµÄÖµ
#echo 0 > /proc/sys/vm/swappiness
ʹswappinessÖµÔÚÐ޸ĺó£¬ÖØÆô²»»áʧЧ
#vi /etc/sysctl.conf£¬ÔÚ×îºóÒ»ÐмÓÉÏ"vm.swappiness=0"
Èç¹ûÔÚ²Ù×÷¹ý³ÌÖÐÏëÒªÇå¿Õ swap ¿Õ¼ä£¬¿ÉÒÔÏȽûÓà swap£¬È»ºóÔÙ´ÎÆôÓá£
#swapoff -a
#swapon -a
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ