Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
1¡¢ºÁÃ뼶³¬Ê±¿ØÖÆ
memcacheĬÈϳ¬Ê±Ê±¼äÊÇ£º1s£¬µ«²é¿´Êֲἰ²é¿´À©Õ¹Ô´Âë·¢ÏÖÆäʵmemcacheÊÇ¿ÉÒÔÖ§³ÖºÁÃ뼶³¬Ê±¿ØÖƵģ¬ÐèҪעÒâphp memcache²»Í¬°æ±¾µÄ²îÒ죬addServerº¯Êý˵Ã÷ÈçÏ£º
ÔÚÖ´ÐÐaddServerʱ²»»áÁ¬½Ómemcached·þÎñÆ÷£¬¶øÔÚµÚÒ»´ÎÖ´ÐÐÃüÁîʱºòÐèÒª2±¶µÄtimeoutʱ¼ä£¬ËùÓе±memcached»ñÈ¡Êý¾Ý³¬Ê±µÄʱºò£¬»¨·Ñʱ¼äÊÇ2±¶µÄtimeoutʱ¼ä¡£
- 3.0.4֮ǰµÄ°æ±¾£¨ÀýÈ磺2.2.5£©£º
Memcache::addServer·½·¨bool Memcache::addServer ( string $host [, int $port = 11211 [, bool $persistent [, int $weight [, int $timeout [, int $retry_interval [, bool $status [, callback $failure_callback [, int $timeoutms ]]]]]]]] )
- ÔÚphp.iniÖмÓÈëmemcache.default_timeout_ms ²ÎÊý
- ÔÚphp½Å±¾ÖÐini_set("memcache.default_timeout_ms", 200)£¬Èç´ËÉèÖøüÁé»î
- ÔÚphp½Å±¾ÖÐaddServerʱÔö¼ÓÈ«²¿µÄ²ÎÊýÉèÖã¬ÀýÈ磺
$mem->addServer("127.0.0.1", 11211, true, 1, 1, -1, true, NULL, 200);
´ËʱÐè×¢Ò⣺$weight²ÎÊý¶ÔmemcacheµÄÁ¬½Óʱ¼äÓÐÏÔÖøµÄÓ°Ï죬$weightµÄĬÈÏֵΪ1£¬Ò»µ©ÉèÖÃΪ±ðµÄÊýÖµ£¬Á¬½Óʱ¼ä±ã»áÓɺÁÃ뼶±ä³É50ms×óÓÒ£¬Á¢¸Í¼ûÓ°¡£
- 3.0.4¼°Ö®ºóµÄ°æ±¾£¨ÀýÈ磺3.0.6£©£º
Memcache::addServer·½·¨£¬È¥³ýÁËÀÏ°æ±¾ÖеÚ9¸ö²ÎÊý£¬µÚ5¸ö²ÎÊýtimeoutÖ§³ÖfloatÀàÐÍ£¬¼´ÉèÖÃΪ0.2±íʾ200ºÁÃëbool Memcache::addServer ( string host [, int port [, bool persistent [, int weight [, double timeout [, int retry_interval [, bool status [, callback failure_callb ack ] ] ] ] ] ] ] )
- ÔÚphp½Å±¾ÖÐaddServerʱÉèÖó¬Ê±Ê±¼ä£¬ÀýÈ磺
$mem->addServer("127.0.0.1", 11211, true, 1, 0.2);
- ÔÚphp½Å±¾ÖÐaddServerʱÉèÖó¬Ê±Ê±¼ä£¬ÀýÈ磺
2¡¢memcachedÄܽÓÊܵÄkeyµÄ×î´ó³¤¶ÈÊǶàÉÙ£¿
key µÄ×î´ó³¤¶ÈÊÇ250¸ö×Ö·û¡£ÐèҪעÒâµÄÊÇ£¬250ÊÇmemcached·þÎñÆ÷¶ËÄÚ²¿µÄÏÞÖÆ£¬Èç¹ûÄúʹÓõĿͻ§¶ËÖ§³Ö¡±keyµÄǰ׺¡±»òÀàËÆÌØÐÔ£¬ÄÇô key£¨Ç°×º+Ôʼkey£©µÄ×î´ó³¤¶ÈÊÇ¿ÉÒÔ³¬¹ý250¸ö×Ö·ûµÄ¡£
ÎÒÃÇÍƼöʹÓÃʹÓý϶̵Äkey£¬ÒòΪ¿ÉÒÔ½ÚÊ¡ÄÚ´æºÍ´ø¿í¡£
3¡¢memcached¶ÔitemµÄ¹ýÆÚʱ¼äÓÐʲôÏÞÖÆ£¿
¹ýÆÚʱ¼ä×î´ó¿ÉÒÔ´ïµ½30Ìì¡£memcached°Ñ´«ÈëµÄ¹ýÆÚʱ¼ä£¨Ê±¼ä¶Î£©½âÊͳÉʱ¼äµãºó£¬Ò»µ©µ½ÁËÕâ¸öʱ¼äµã£¬memcached¾Í°ÑitemÖÃΪʧЧ״̬¡£ÕâÊÇÒ»¸ö¼òµ¥µ«obscureµÄ»úÖÆ¡£
4¡¢memcached×î´óÄÜ´æ´¢¶à´óµÄµ¥¸öitem£¿
1MB¡£Èç¹ûÄãµÄÊý¾Ý´óÓÚ1MB£¬¿ÉÒÔ¿¼ÂÇÔÚ¿Í»§¶ËѹËõ»ò²ð·Öµ½¶à¸ökeyÖС£
5¡¢ÎªÊ²Ã´memcached»á¶Â³µ£¿
²Î¿¼µØÖ·£ºhttp://www.cnblogs.com/cmt/archive/2013/04/25/3041555.html
linux·þÎñÆ÷ϵͳÖÐÓиö²ÎÊý£ºvm.swappiness£¬´Ë²ÎÊýµÄÖµÔÚ0-100Ö®¼ä£¬±íʾÔÚramºÍÐéÄâÄÚ´æÖеIJÙ×÷±ÈÀý£¨²Î¿¼µØÖ·£ºhttps://scottlinux.com/2010/06/23/adjust-your-swappiness/£©
0£ºÈ«²¿ÔÚramÖÐ
100£ºÈ«²¿ÔÚÐéÄâÄÚ´æÖÐ
6¡¢¸ß²¢·¢ÏÂmemcache³¬Ê±Öظ´Ð´ÈëµÄÎÊÌâ
²Î¿¼µØÖ·£ºhttp://www.tuicool.com/articles/vyAFVv
7¡¢memcacheÄÚÈÝ´æ´¢»úÖÆ
²Î¿¼µØÖ·£ºhttp://www.cnblogs.com/liupeizhi/articles/2678121.html
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- 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ÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ