3. Mobageéç¨æè¡DBç·¨
Mobage MySQLéç¨
ç»å£è ï¼DeNA岩永æ§
Many Servers
Master - Slave
critical SELECT -> master
non critical SELECT -> slave
ã¬ããªã±ã¼ã·ã§ã³ã¯ãéåæã¨ãªã£ã¦ãããææ°çã¯ã対å¿ã§ãã¦ããé¨åãããã
Sharding
+ divide per tables ( no join )
+ record sharding (difficult range scan)
ã¬ã³ã¼ãã§åããã®ã¯ãã¯ã©ã¤ã¢ã³ããµã¤ãã®ãã¸ãã¯ã§åããæ¹æ³ã¨ããããã³ã°æ
å ±ãå¥ãã¼ãã«ãç¨æããæ¹æ³ãããã
hash or mapping
ScaleOut
1. auto increment
- same schema - different database
2. MyISAM sequence table
ã¢ããªã±ã¼ã·ã§ã³å´ã§å¯¾å¦
Scale back
Reduce scale-outed servers
- 1ãµã¼ãã§è¤æ°ããã»ã¹èµ·åãã¦å¯¾å¿ãã¦ãã
- MySQLã¯ãã¹ã¿ã1ã¤ããæå®ãã§ããªã
- ä»®æ³IPã¢ãã¬ã¹ãå²ãå½ã¦ãããã®ã¿ãLISTENããããã«ãã(my.cnf)
- ãã¼ããå¤ããæ¹æ³ã¯ããã¼ã管çã大å¤
- ã¢ããªã±ã¼ã·ã§ã³å´ã§å¤æ´ããªããªãã®ã§ãä»®æ³IPã¢ãã¬ã¹ã®æ¹æ³ãè¡ãªã£ã¦ãã
Databackup
- ãã ã®ã¹ã¬ã¼ãããµã¼ãã¹ã«å ¥ã£ã¦ããªã
- mysqldumpã§è¡ãªã£ã¦ãã
- ããã使ã£ã¦ãslaveããã¤ã§ãä½ããã¨ãã§ãã
- slaveã®è¿½å ãããµã¼ãã¹ã«å½±é¿ãä¸ããã§ãã
MHA
- ãã¹ã¿ãè½ã¡ãéã«ãèªåã§ããã¹ã¿ææ ¼ããã¹ã¯ãªãã
Big Data
Purge
- ãããããã®ã¯ãå¤ããã¼ã¿ãæ¶ã
- å¤ããã¼ã¸ã§ã³ã§ã¯ãDELETEã§æ¶ãã¦ããæ¹æ³ãããªãã£ã
- DELETEã¯éãå¦ç
- 5.1以éã§ã¯ããã¼ãã£ã·ã§ã³æ©è½ã§ãã¼ãã«ã«ãã£ã¦ã¯ãç°¡åã«åé¤ã§ããããã«ãªã£ã
- range partition ã使ãã°ç°¡åã«åé¤ã§ãã
- drop table ã¨åãæè¦
High Traffic
- Range Scan ã¯æ°ãã¤ããã¹ã
- Primary Keyã§SELECTãããã¨ãå¤ã
- Handler socket plugin (made by higuchi)
- Too many UPDATE
- ããã¯ã®æéãã§ããã ãçããã
- SINãè½ã¡ããã¨ã¯ãã
- ã³ãã¯ã·ã§ã³ãã¯ã£ããã¨ã§ããã¯ãã¦ãã
- ããããªãã¹ã¿ã«å¯¾ãã1åã§æ´æ°ãè¡ããã
- 1ã¤ã®ãµã¼ãã§çºçããå ´åã¯ãæ¤ç¥ãã§ããããè¤æ°ãµã¼ãã§çºçããå ´åã¯ãè¨å®ãã¡ã¤ã«ã§åé¿ãããããªããâæéãããã
- ã¾ãã¯ããããããã¯ãèµ·ããªãããã«ãããã¥ã¼ãã³ã°
- 楽観çããã¯ããã¼ã¸ã§ã³ã«ã©ã ã¨ãããã®ãç¨æãã
- æ´æ°ããã¨ãã«ããã¼ã¸ã§ã³ã«ã©ã ãæ´æ°ãã
- ã¬ããªã±ã¼ã·ã§ã³é 延ãèµ·ãã¦ãã¾ã
- ãã®é 延ãã©ã®ããã«ãã¦è¨æ¸¬ããã
- ããã¯ã¢ãããµã¼ãã¯ãã¹ã¬ã¼ãããã¹ããã¯ãä½ããã¨ãå¤ã
- ããã¯ã¢ãããµã¼ãã§é 延ãçºçããããã¹ã¬ã¼ãã§ãçºçããã ããã¨ããèã
- ããã¯ã¢ãããµã¼ãã®ç¶æ ã確èªãããã¥ã¼ãã³ã°ãã¦ãã
- SSD ã¯ãã¬ããªã±ã¼ã·ã§ã³é 延ãçºçãã«ãã
- ã¬ããªã±ã¼ã·ã§ã³ã¯ã1ã¹ã¬ããã§è¡ããããã©ããã¦ãé 延ãããã
- HDDã§ã¯é 延ããããSSDã§ã¯ä½è£ã¨ããã±ã¼ã¹ã¯å¤ã ãã
- SATA-SSD is good
- SAS-SSD ã¯ãç¾æç¹ã§ã¯ã¾ã 使ããã¬ãã«ã§ã¯ãªãã¨èãã¦ãã