Memcache VS MySQL Query Cache.
¼ÇµÃÇ°ÌìÓÐÈËÎÊÎÒ£¬ Memcache ºÍ MySQL ×Ô¼ºµÄ Query Cache ÓÐɶÇø±ð? ÎÒÕâÑù»Ø´ðµÄ£¬Ç°ÕßÊÇɽկÖеÄÕ½¶·»ú£¬ºóÕßÊǹٷ½µÄÕ½¶·»ú¡£
ÐÂÊֻشðÎÊÌ⣬´íÁËĪ¹Ö¡£¹þ¹þ¹þ¡£
ºÃÏñϸ½ÚÉϵIJî±ð»¹ÊÇÓеġ£
MemcacheÓŵãÈçÏ£º
1. ÀíÂÛÉÏ¿ÉÒÔÖ§³ÅÎÞÏÞ²¢·¢ÒµÎñ²Ù×÷¡£
2. ¿ÉÒÔÆôÓõ¥¶ÀµÄʵÀýÀ´»º´æ¾Þ¶àµÄÊý¾Ý¡££¨µ±È»ÄãµÄ»úÆ÷ÄÚ´æ×ã¹»´ó£¬¶øÇÒ±ðÊÇ32-bitµÄÁË¡££©
3. ¿ÉÒÔÔڷdz£Á®¼ÛµÄ»úÆ÷ÉÏÔËÐС£
µ±È»Ò²ÓÐȱµã£º
1. ÔÝʱûÓйٷ½·þÎñÖ§³Ö¡£
2. Ì«ÈÝÒײúÉúÄÚ´æËéƬÁË£¬ÀË·ÑÄÚ´æ¡£
3. ÐèÒªÐÞ¸ÄÓ¦ÓóÌÐò¡£
Query Cacahe ÓŵãÈçÏ£º
1. Óйٷ½µÄ¼¼ÊõÖ§³Ö¡££¨Õâ¸öµ¥µ¥Ö»¹ºÂòÁËÆóÒµ°æµÄÓû§£©
2. ¶ÔÓ¦ÓóÌÐò͸Ã÷¡£ ÎÒÃǵĿª·¢ÈËÔ±ÀÖÁË¡£
ȱµãÄØÒ²ÓУº
1. ²»ÄÜ·Ö¿ª×Ô¼ºµÄÕâ¿éBUFFERµ½µ¥¶ÀµÄ»úÆ÷¡££¨²»ÖªµÀÄܲ»ÄܹرÕMySQL µÄÖ÷Òª¹¦ÄÜ£¬¶øµ¥¶À°ÑQuery Cache´ò¿ªÄØ? ÓÐÐËȤµÄ¿ÉÒÔÊÔÑéÏ¡££©
2. Ò²ºÜÈÝÒײúÉúÄÚ´æËéƬ£¬Í¬ÑùÀË·ÑÄÚ´æ¡£
ÆäʵÉÏÃæ˵µÄÓеãǣǿ£¬Èç¹ûÄãµÄÓ¦ÓóÌÐòÍêÈ«OO£¬ÄÇô¶ÔÓÚMemcacheÀ´½²£¬Ö»ÐèÒª×öÉÙÁ¿µÄÐ޸ļ´¿É¡£
Ïà¹ØÎĵµ£º
mysql ´ó¶ÔÏó´æÈ¡:
ÀàÐÍÒ»°ãÓ¦¸ÃÓÃmediumblod,
blobÖ»ÄÜ´æ2µÄ16´Î·½¸öbyte,
mediumblodÊÇ24´Î·½,
Ò»°ãÀ´Ëµ¹»ÓÃÁË.longblobÊÇ32´Î·½ÓÐЩ´ó.
MYSQLĬÈÏÅäÖÃÖ»ÄÜ´æ1M´óСµÄÎļþ,ÒªÐÞ¸ÄÅäÖÃ,WIN°æ±¾µÄÔÚmysql.iniÎļþÖÐ
ÐÞ¸Ämax_allowed_packet,net_buffer_lengthµÈ¼¸¸ö²ÎÊý,»òÖ±½ÓSET GLOBAL varName=value.
linux°æ± ......
ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ñ§Ï°ÈçºÎͨ¹ýPHP 5µÄÒ»¸ö»ù±¾³éÏóÀàʹÓÃÍâ¼üÔ¼ÊøÀ´¸üÐÂÁ½¸öInnoDB±íµÄÊý¾Ý¡£ ÎÒÃǽ«Í¨¹ý¾ßÌåʾÀýÀ´ËµÃ÷ÈçºÎͨ¹ý·þÎñÆ÷¶Ë½Å±¾ÓïÑÔÀ´Ê¹ÓÃÍâ¼üÔ¼Êø¡£
¡¡¡¡Ò»¡¢ÀûÓÃÍâ¼üÔ¼Êø¸üÐÂMySQLÖеÄÊý¾Ý
¡¡¡¡ÏÖÔÚ£¬×îÁ÷ÐеĿªÔ´¹ØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ·ÇMySQLĪÊô£¬¶øMySQLÓÖÖ§³Ö¶à¸ö´æ´¢ÒýÇ棬ÆäÖÐĬÈϵÄÒ²ÊÇËٶȽϿìµÄ´ ......
GROUP_CONCAT ÊÇÒ»¸öºÏ²¢¶àÐеĺ¯Êý£¬Ò»°ãÓõÄÉÙ£¬ËùÒԺܶàÈ˶¼²»ÖªµÀ£¬ÎÒÒ²ÊÇÒ»¸ö£¬½ñÌìżȻ¿´µ½£¬¹Ê¼ÇÏ·½·¨£»
GROUP_CONCATµÄÓï·¨ÈçÏ£º
GROUP_CONCAT([DISTINCT] expr [,expr ...][ORDER BY {unsigned_integer | col_name | expr}[ASC | DESC] [,col_name ...]][SEPARATOR str_val])
ÏÂÃæÑÝʾһÏÂÕâ¸öº¯Êý£¬ÏȽ¨Á¢Ò ......
-static 13%
--with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static
¾²Ì¬Á´½ÓÌá¸ß13%ÐÔÄÜ
Unix Socket 7.5%
--with-unix-socket path=/usr/local/mysql/tmp/mysql.sock
ʹÓÃunixÌ×½Ó×ÖÁ´½ÓÌá¸ß7.5%ÐÔÄÜ£¬ËùÒÔÔÚwindowsÏÂmysqlÐÔÄܿ϶¨²»ÈçunixÏÂÃæ
--enab ......