ãæå®ã®ãã¼ã¸ãè¦ã¤ããã¾ããã§ãã URLã®å¤æ´ããããã¯ãã¼ã¸ãåé¤ãããå¯è½æ§ãããã¾ãã ãææ°ã§ããã以ä¸ã®ãªã³ã¯ããç®çã®ãã¼ã¸ããæ¢ããã ããã
MySQL 5.1.38ããMySQLæ¬ä½ã«InnoDB Pluginãã³ãã«ããã¦ãããä¸é¨ã®å é§çãªã¦ã¼ã¶ã¼ä»¥å¤ã«ããInnoDB使ã£ã¦ã¾ããï¼ããããã¯ãæ¤è¨¼ãã¦ããï¼ãã¨ãã話ããã¾ãèããªããããããã§ããããInnoDB Pluginã£ã¦ãªããï¼ï¼ã¨ãã人ãå¤ããã§ã¯ãªããã¨æãã®ã ããå®éã¯ã©ããªã®ã ããï¼ç¾å¨ã¯RCçï¼ãªãªã¼ã¹åè£çï¼ã¨ããä½ç½®ã¥ãã®InnoDB Pluginã§ããããä¸é¨å½±é¿åº¦ã®é«ããã°ãæ®ã£ã¦ããããã¦GAçã»ã©ã®å®å®æ§ã¯æ±ããããªããã®ã®ãã»ã¨ãã©å®ç¨ã«èãããå質ã«ãªã£ã¦ããã¨ãããããããªããã§ãä»æ¥ã¯æ¹ãã¦InnoDB Pluginã®ä½¿ãæ¹ã»ä½¿ãã©ããã«ã¤ãã¦èª¬æããã®ã§ããã²çããã®æã§InnoDB Pluginãè©ä¾¡ãã¦ã¿ã¦é ãããã ãªãã以ä¸ã®è§£èª¬ã¯ç¾å¨ã®ææ°ãã¼ã¸ã§ã³ã§ãããInnoDB Plugin 1.0.6ãåæã«ãã¦ããã®ã§ãå°
åºã¾ãããä»åã¯æ©è½è¿½å ã1件ããã°ä¿®æ£ã55件ããã¾ãããã°ä¿®æ£ã®ãã¡ã»ãã¥ãªãã£ã«é¢ãããã®ã1件ããã¼ãã£ã·ã§ãã³ã°ã«é¢ãããã®ã5件ãã¬ããªã±ã¼ã·ã§ã³ã«é¢ãããã®ã7件ã¨ãªã£ã¦ãã¾ãã MySQL 5.1.38ããæ¬ä½ã«ä»å±ããããã«ãªã£ãInnoDB Pluginã§ããããã¼ã¸ã§ã³ã1.0.7ã«ä¸ããRCããGA(Generally Availableãæ£å¼ç)ã¨ãªãã¾ãããã¤ãã«æ£å¼ãªãªã¼ã¹ã§ããã¨ããããã§ä½åº¦ãç¹°ãè¿ãã¦ãã話é¡ã§ãããä»åã¯InnoDB Pluginã«ã¤ãã¦å度ããããããã¦ããããã¨æãã¾ãã InnoDB Pluginã®ä½¿ãæ¹ MySQL 5.1.38以éã§ããã°InnoDB Pluginã使ãããã«è¨å®ããã®ã¯ç°¡åã§ãã/etc/my.cnfã«ä»¥ä¸ã®è¨å®ãæ¸ãå ãããã¨ã§InnoDB Pluginãæå¹åããã¾ãã ignore-builtin-in
InnoDB ã¯ããã©ã«ãã§ã¯åæI/O *1ã ãã©ã innodb_flush_method=nosyncã£ã¦ããé ããªãã·ã§ã³ããã£ã¦ããããæå¹ã«ãã㨠MyISAM ã¿ãã fsync ããªããªãããã£ã¦ã½ã¼ã¹ã³ã¼ãã¡ãè¦ããèªåãè¨ã£ã¦ãã ãã®è¨å®ãããããã®ã£ã¦ãã©ãããæã ããï¼ MySQL â Wikipedia ã«ãæ¸ãã¦ãããã©ãã¹ã¬ã¼ãéç¨ãã¦ã¦ãã¯ã©ãã·ã¥ããããªã«ããªã§æ°æéããããããã¼ã¿ä¸è²«æ§ãã§ãã¯ãããããã ã£ããããã¯ã¢ãããããªã¹ãã¢ãã¦åéãã¡ãããããããçãªåãã«ã¯ãããããªã®ããããã ã¨ã¯è¨ããfsync ããªãã£ã¦ãã¨ã¯ OS ã®ãã¼ã¸ãã£ãã·ã¥ã«æ¸è¾¼ã¿ãã¼ã¿ãæ»çãããã¨ã«ãªã â buffer_pool åãå¿ è¦ãåºã¦ãã â ç¡é§ãª I/O ãå¢ãããããã§ãè¨å®ããã¡ãªããããããã©ããã¯ç¥ããªããswappiness=0 ã«ãã¨
æè¿ãInnoDBã®ãã¼ã¿é åï¼ãã¼ãã«ã¹ãã¼ã¹ï¼ãæé·ãã¦ãã¾ã£ã¦å ã«æ»ããã¨ãåºæ¥ãªãå ´åã®å¯¾å¦ã«ã¤ãã¦ãã質åãããã®ã§ãä»æ¥ã¯ãã¼ãã«ã¹ãã¼ã¹ãæé·ãããã¨ã¸ã®å¯¾çã«ã¤ãã¦èª¬æããããï¼ããã®ã¨ããMySQLãã¿ãç¶ãã¦ããããPlanet MySQLæ¥æ¬èªçãæèãã¦ããããã§ã¯ãªãã®ã§ãããããï¼ï¼ï¼ï¼ãã³ãããï¼ï¼ï¼ä¿ºï¼ InnoDBã®ãã¼ãã«ã¹ãã¼ã¹ãæé·ãã¦ãã¾ãã®ã¯ããºããªèªåæ¡å¼µãã¦ããããã§ããããã¼ãã«ã¹ãã¼ã¹ã«å¯¾ãã¦ä½ããªãã·ã§ã³ãæå®ããªãã¨ãããã©ã«ãã§ã¯æ¬¡ã®ãããªè¨å®ã¨åããã¼ãã«ã¹ãã¼ã¹ãä½æãããã [mysqld] innodb_data_file_path=ibdata1:10M:autoextend ãµã¤ãºã¯10MBãããªãããèªåæ¡å¼µããã®ã§ãããèªåæ¡å¼µãã¦ãã¾ãã¨ä½ãåé¡ãªã®ãã¨ããã¨ããã¼ã¿ãå¢ããå ´åã«ãã¡ã¤ã«ã·ã¹ãã ã®ç©ºãé åã使ãå
MySQL InnoDB Pluginã®ãã¼ã¿å§ç¸®æ©è½ã®ç¶ãã§ããååã¯InnoDB Pluginã®ç¬èªæ©è½ã§ãããã¼ã¿å§ç¸®ã®ä»çµã¿ã解説ããWikipediaæ¥æ¬èªçã®ãã¼ã¿ãç´ååã«ã¾ã§å§ç¸®ããããã¨ã確èªãã¾ãããä»åã¯ãã¼ã¿å§ç¸®ã«ãã£ã¦æ§è½ãã©ã®ããã«å¤åãããããå®éã«ãã³ããã¼ã¯è©¦é¨ãè¡ã£ã¦è¦ã¦ããã¾ãã 試é¨ã®æ¹é ãã¼ã¿å§ç¸®ã«ããæ§è½ã¸ã®å½±é¿ã¯ã以ä¸ã®äºç¹ãèãããã¾ãã ã¡ãªããï¼ãã¼ã¿ãµã¤ãºãå°ãããªãããããã£ã¹ã¯I/Oãæ¸ã ãã¡ãªããï¼å§ç¸®ã»å±éã®å¦çãè¡ããããããCPUè² è·ãé«ããªã ããã§ããããã®ç¹å¾´ãããåããããã«è©¦é¨ãã¿ã¼ã³ã工夫ãã¾ããWikipediaæ¥æ¬èªçã®ãã¼ã¿ã¯InnoDBä¸ã§ããã5GBããã¾ãããã¾ãçãç¯å²ã«çµã£ã¦èªã¿åãå¦çãè¡ããã¨ã§ãã£ã¹ã¯I/Oããã¾ãçºçããªãããã«ãã¾ããããã§CPUè² è·ã®å¾åã確èªãããã¨ãã§ãã¾ãã次
drop table if exists t; create table t ( iid int ,nid int ,bid binary(3) ,msg varchar(69) ,key (iid) ,key (bid) ) ENGINE=InnoDB; insert into t values (1,1,1,"ichi"),(2,2,2,"ni"),(3,3,3,"san") ,(4,4,4,"si"),(5,5,5,"go"),(6,6,6,"roku") ; ãªãã¼ãã«ã¨ãã¼ã¿ã§ã2ã¤ç«¯æ«ãç¨æã㦠update ãããã£ããã¦ã¿ã¾ãã ã¾ããããâã¯ä¸¡æ¹ã¨ãupdateãå®äºãã¦ã¹ã³ã£ã¨è¿ã£ã¦ãã¾ããè¡ã¬ãã«ããã¯++ begin; update t set msg = "t1" where iid = 1; 㨠begin; update t set msg = "t2" wh
MySQL 5.1.38 ããªãªã¼ã¹ããã¾ããã5.1ã·ãªã¼ãºã¯ããæ°ã¶æã¯æ¯ææåã«å¿ ããªãªã¼ã¹ããã¦ãã¦ãMySQLãªãªã¼ã¹ç®¡çãå®å®ãããã¨ãæãããããã¾ãã http://www.mysql.gr.jp/frame/modules/news/article.php?storyid=147 ä»åã®ãªãªã¼ã¹ãã¼ãã«ã¯ããã¤ãã®ãå¤æ´ç¹ãã®ç®æ¡æ¸ãã ãã§ãªããä»åã®ãªãªã¼ã¹ããå ãããããInnoDB Pluginãã«ã¤ãã¦ã®èª¬æãé·ã ã¨æ¸ããã¦ãã¾ãããè±èªã¯å¤å½èªã«ããè¦ããªãç§ã«ã¨ã£ã¦ï¼âå½ããåã ï¼èªåã®ç解ã®ããã«ä¾ã«ãã£ã¦ãè¶ è¨³ããã¦ã¿ã¾ãããã訳ãªãã¦è¨èã使ãã¨ãããããããããªã®ã§ãç§ã®ç解ãããªãã¹ãåæã®è©±ã®çã«æ²¿ã£ã¦ç§ã®è¨èã§èª¬æãã¦ã¿ã¾ããããããã®æãã ã¨æã£ã¦ä¸ããã誤ããåéããªã©ã«æ°ã¥ããããã¯æãã¦ä¸ããã åæã¯ããï¼http://dev.mysq
ãã¼ã¿ãã¼ã¹ã®éç¨ã§é¿ããããªãã®ããããã¯ç«¶åã«ãã£ã¦èµ·ããã·ã¹ãã ãã©ãã«ã¸ã®å¯¾å¿ã§ããã2æã¾ã§ã«çµããã¯ãã®ãããå¦çãæã«ãªã£ã¦ãçµãã£ã¦ããªããã¨ããè² è·ãé«ãããã§ããªãã®ã«ã·ã¹ãã ãç¡å¿çã«ãªã£ã¦ãããã¨ãã£ããã©ãã«ãçºçããã¨ããDBã¨ã³ã¸ãã¢ã¯ãããããã¯ç«¶åã«ãããã®ãªã®ãã©ãããåãåãã¦ãé©åã«å¯¾å¦ããªããã°ãªãã¾ããã ããã¾ã§InnoDBã¯ããã¯ç«¶åã«å¯¾ãã¦ã»ã¨ãã©æã¤æããªãã£ãã®ã§ãããæè¿ãããã対å¦æ¹æ³ãã§ã¦ãã¾ãããä»æ¥ã¯ãã®æé ã確èªãã¦ããããã¨æãã¾ãã åæ ä»åãç´¹ä»ããæé ã¯ãMySQLã®ä»¥ä¸ã®ãã¼ã¸ã§ã³ã対象ã«ãã¦ãã¾ãã MySQL 5.1ï¼InnoDB Plugin 1.0 MySQL 5.4 ãããªããã¼ãã«ãä¸ãã¦ãã¾ã£ã¦ç³ã訳ããã¾ãããããã¼ã¸ã§ã³5.0以ä¸ãç´ ã®5.1ã§ã¯ä½¿ãã¾ããã®ã§ã注æãã ããã以éã®å®è¡ä¾ã¯ãã¹ã¦
show innodb status\G ã㦠Buffer pool hit rate ã 997/1000 以ä¸ã ã£ãè¯ããã¨ããã®ã¯ããã£ã¹ã¯ãã¦ã³ãã®ãã¼ã¿ãã¼ã¹ã®è©±ãªã®ããªãå人çã«ã¯ãFILE I/O ã® reads/s ã®æ¹ãæ°ã«ãã¦ãããã¡ãªã¿ã«ä»¥ä¸ã¯ããããã¡ãã¡ãªãã¿ã¼ã³ãBuffer pool hit rate 㯠1000/1000 ã ãã©ä¸ç§éã« 44 åã HDD ããèªã¿è¾¼ãã§ãã (O_DIRECTè¨å®ãã¦ã) ããã§ãå®æ ã¯éæ¯åæ¯ (MyISAM ã使ã£ã¦ããããã®ã§)ãã¨ãããã㧠Pathtraq ã®ã¡ã³ããã³ã¹ãéå§ãã¾ãã -------- FILE I/O -------- I/O thread 0 state: waiting for i/o request (insert buffer thread) I/O thread 1 state:
MySQLã®ã¢ãã¿ããã®ã«ä¾¿å©ãªmytopãªãã§ãããMySQL 5ã«å¯¾ãã¦ä½¿ãã¨ãã¯ã¨ãªã®å²å表示ãå ¨é¨ã¼ãã«ãªã£ã¦ãã¾ã£ããã¾ãã ããã¯ãMySQL 5.0.2ã§SHOW STATUSæãå¤æ´ãããGLOBALãSESSIONã¨ãããªãã·ã§ã³ãæå®ã§ããããã«ãªã£ããã¨ã«èµ·å ãã¾ãããã®ãªãã·ã§ã³ãçç¥ããéã¯SESSIONãæå®ããã¨ãã¨åãåä½ã¨ãªããSHOW STATUSæã§å¾ãããã®ã¯èªåèªèº«ã®æ¥ç¶ã«ã¤ãã¦ã®æ å ±ã®ã¿ã¨ãªãã¾ãã mytopã¯ãªãã·ã§ã³ãªãã®SHOW STATUSæã使ã£ã¦ããã®ã§ãMySQL 5ã§ã¯mytopèªèº«ã®æ¥ç¶ã«ã¤ãã¦ã®æ å ±ããå¾ãããããã®å½±é¿ã¨ãã¦ãã¯ã¨ãªã®å²å表示ãå ¨é¨ã¼ãã«ãªã£ã¦ãã¾ã£ããããããã§ãã 対å¿ã¯ç°¡åã§ãmytopã®SHOW STATUSãSHOW GLOBAL STATUSã«æ¸ãæããã°ãã(æ¸ãæããã¨MySQL 4.1以å
AWSã¢ããã³ã¹ãã³ã³ãµã«ãã£ã³ã°ãã¼ããã¼ã®ä¸å¡ã¨ãã¦æ´»åããæ ªå¼ä¼ç¤¾ã¹ã¿ã¤ã«ãºããAWSå°å ¥ã移è¡ãéçºãã»ãã¥ãªãã£ãéç¨ä¿å®ãªã©ããã¹ã¦ã®ãç¸è«ã«ä¹ããã¦ããã ãã¾ãã AWSãå°å ¥ããããä½ããå§ããããããããããªã æ¢åã®ãã³ãã¼ãæ°æè¡ã«å¼±ããè¯ãææ¡ãããããªã ã¯ã©ã¦ãã®å°å ¥ã«ã»ãã¥ãªãã£ã®ä¸å®ããã AWSãã¨ããããå°å ¥ããããããã«æ´»ç¨ãã¦ãããã 社å ã«AWSã®ç¥è¦ãæã£ã¦ãã人ãããªã AWSãªãã§ã¯ã®ã·ã¹ãã éçºã詳ããç¥ããã
ã¹ãã¬ã¼ã¸ã¨ã³ã¸ã³ã¨ãã¦InnoDBã使ãã¨ãã¯MyISAMã®ã¨ãã¨è§¦ãã¹ããã¤ã³ããéãã®ã§æ³¨æã http://www.mysqlperformanceblog.com/files/presentations/OSCON2004-MySQL-Innodb-Performance-Optimization.pdf ãèªã¿ãªããåã£ãã¡ã¢ãç¶æ³ã¨ãã¦ã¯RedHat AS3.0ã§åãããã¨ãã®DBT2*1ã®ããã©ã¼ãã³ã¹ãæ¹åãã¦ããã¨ãããã®ãMySQL ããã©ã«ãç¶æ ã§ã®åæ Handler_read_nextãå¤ããã¤ã¾ãrange scanãindex scanãå¤ããã slow query logã§ä½ãæªãããå¼ã£ããã ä¾ã§ã¯2ç§ä»¥ä¸å¦çã«ããã£ãqeuryãè¨é²ããããã«ãã¦ãã çµæãåæ updateæãé ãã£ããã©ãupdateæãã®ã¾ã¾ã§ã¯explainã§ããªãã®ã§ã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}