MySQLã®DRBDæ§æã«ããããããã¯ã¼ã¯é 延ã®å½±é¿ã«ã¤ãã¦
ä»ããã§ãããAmazon RDSã®ãã«ãAZãããã¤ã¡ã³ãã«ã¤ãã¦èª¿ã¹ã¦ãã¾ããããã«ãAZãããã¤ã¡ã³ãã¨ã¯ãç¬ç«ããé»æºã空調ããããã¯ã¼ã¯ãã»ãã¥ãªãã£ãåããç©ççã«ç°ãªããã±ã¼ã·ã§ã³ã«å¯¾ãã¦åæã¬ããªã±ã¼ã·ã§ã³ãè¡ããã¨ã§ããã¼ã¿ãã¼ã¹ã®èé害æ§ãé«ããæ©è½ã§ããAZã¯Availability Zoneã®ç¥ã§ãã
ç°ãªããã±ã¼ã·ã§ã³ã«å¯¾ããåæã¬ããªã±ã¼ã·ã§ã³ã¨èãã¨ãæ§è½ãåºãªãã®ã§ã¯ãªããã¨ããæ¸å¿µãã©ããã¦ãåºã¦ãã¾ããããã§ãã©ã®ç¨åº¦æ§è½ãè½ã¡ããã®ãªã®ãæ¤è¨¼ãè¡ãã¾ããããªãããã§ã«å®éã®Amazon RDSãå©ç¨ãã¦æ¤è¨¼ãè¡ã£ãæ¹ãããã£ãããã¾ããã®ã§ãä»åã¯æå
ã®ç°å¢ãå©ç¨ãã¦ããããã¯ã¼ã¯é
延ãMySQLãã©ã¡ã¼ã¿ã¨æ§è½ã¨ã®é¢é£æ§ã確èªãã¦ããããã¨æãã¾ãã
ãã«ãAZãããã¤ã¡ã³ãã®å ·ä½çãªã¢ã¼ããã¯ãã£ã¯å ¬éããã¦ãã¾ãããã以ä¸ã®ãããªç¹å¾´ãããã¾ãã
- MySQLã ãã§ãªãOracle Databaseã«ã対å¿ãã¦ãã
- MySQLã¬ããªã±ã¼ã·ã§ã³ã®ããã«ãã¹ã¬ã¼ããåç §ç®çã§å©ç¨ãããã¨ã¯ã§ããªã
ãã®ãã¨ãã示åãããã®ã¯ãMySQL 5.5ã®æºåæã¬ããªã±ã¼ã·ã§ã³ãOracle Database Enterprise Editionã®Data Guardã¯å©ç¨ãã¦ãããããã£ã¨ä½ãã¬ã¤ã¤ã§ã¬ããªã±ã¼ã·ã§ã³ãè¡ã£ã¦ããã¨ãããã¨ã§ããããããAmazon社ã¯ã¬ããªã±ã¼ã·ã§ã³ã®ä»çµã¿èªä½ãèªç¤¾éçºãã¦ãããã®ã¨å人çã«æ¨æ¸¬ãã¦ãã¾ããããããæ¢åã®è£½åã§å®ç¾ããã«ã¯ä»¥ä¸ã®æ¹æ³ãããã¾ãã
- EMC SRDFãMirrorViewãHP XP Continuous AccessãContinuous Access EVAãªã©ã®ã¹ãã¬ã¼ã¸è£½åã«ããæ¹æ³
- DRBDãªã©ã®ã½ããã¦ã§ã¢è£½åã«ããæ¹æ³
ä»åã¯DRBDãå©ç¨ãã¾ãããã·ã¹ãã æ§æå³ã以ä¸ã«ç¤ºãã¾ãã
KVMã²ã¹ãã4ã¤ãä»®æ³ãããã¯ã¼ã¯ã2ã¤ä½æãã¦ãã®å³ã®ããã«æ¥ç¶ãã¾ããè² è·ã¯ã©ã¤ã¢ã³ãk01sl6ããã®SQLã¢ã¯ã»ã¹ã¯192.168.1.0/24ã®ãããã¯ã¼ã¯ãçµç±ãã¦ãã©ã¤ããªDBãµã¼ãk02c5ã«å¯¾ãã¦è¡ããã¾ãããã©ã¤ããªDBãµã¼ãk02c5ã¨ã»ã«ã³ããªDBãµã¼ãk03c5ã®éã§ã¯ã192.168.100.0/24ã¨192.168.101.0/24ã®ãããã¯ã¼ã¯ãçµç±ãã¦DRBDã¬ããªã±ã¼ã·ã§ã³ãè¡ããã¾ãã192.168.100.0/24ã¨192.168.101.0/24ã®ãããã¯ã¼ã¯ã¯ãã²ã¼ãã¦ã§ã¤k05wanã«ãã£ã¦æ¥ç¶ããã¦ãã¾ãã
ã²ã¼ãã¦ã§ã¤k05wanã§ã¯tcã³ãã³ããç¨ãã¦ãããã¯ã¼ã¯é
延ãçºçããã¾ãã以ä¸ã«ä¾ã示ãã¾ãã
k05wan# tc qdisc add dev eth1 root handle 1: netem delay 5ms k05wan# tc qdisc add dev eth2 root handle 1: netem delay 5ms k02c5$ ping 192.168.101.33 PING 192.168.101.33 (192.168.101.33) 56(84) bytes of data. 64 bytes from 192.168.101.33: icmp_seq=1 ttl=63 time=10.3 ms 64 bytes from 192.168.101.33: icmp_seq=2 ttl=63 time=10.4 ms 64 bytes from 192.168.101.33: icmp_seq=3 ttl=63 time=10.3 ms
netemã«ã¼ãã«ã¢ã¸ã¥ã¼ã«ã¯ããã¤ã¹ããéä¿¡ããããã±ããã«å¯¾ãã¦ã®ã¿é 延ãä¸ãããã®ã§ãã®ã§ãWANç°å¢ã«ããããããã¯ã¼ã¯é 延ãã¨ãã¥ã¬ã¼ã·ã§ã³ããã«ã¯eth1ã¨eth2ã®ä¸¡æ¹ã«åãå¤ãè¨å®ããå¿ è¦ãããã¾ããpingã®å¤ã¯å¾å¾©æé(Round Trip Timeã以ä¸RTT)ã示ãã¦ããããã®å ´åã¯ç´10ããªç§ã¨ãªãã¾ãã
- CPUï¼Intel Core i5-2400S (Quad-Coreã2.50GHzãMax 3.30GHz)
- SSDï¼PLEXTOR PX-M2P 256GB
- OS(KVM HostãClientãGateway)ï¼Scientific Linux 6.2 64bit
- OS(PrimaryãSecondary)ï¼CentOS 5.8 64bit
- RDBMSï¼MySQL 5.5.25ãinnodb_buffer_pool_size=2048Mãinnodb_flush_log_at_trx_commit=1
- REPLICATIONï¼DRBD 8.3.13ãProtocol C
- TOOLï¼JdbcRunner 1.3-alphaãTiny TPC-CãScale Factor 16
以ä¸ã®ãã©ã¡ã¼ã¿ãå¤åããã¦TPC-Cã®ã¹ã«ã¼ãããã測å®ãã¾ããåè¨ã§98ãã¿ã¼ã³ã¨ãªãã¾ãã
- sync_binlogï¼0ã1
- ã¬ããªã±ã¼ã·ã§ã³æ§æï¼DRBDãªããDRBDåæãRTT <1ã2ã4ã10ã20ããªç§
- ã¯ã©ã¤ã¢ã³ãã®å¤é度ï¼1ã2ã4ã8ã16ã32ã64
ã¾ãã¯sync_binlog=0ã®çµæããè¦ã¦ããã¾ãããã
ãããã¯ã¼ã¯é
延ã大ããã»ã©æ§è½ãä½ä¸ããã¨ããã®ã¯ãã®éããªã®ã§ãããä¸ããæ¹ã«ç¹å¾´ãããã¾ããDRBDãªãã«ãããã¹ã«ã¼ãããã100%ã¨ããã¨ãã®ç¸å¯¾å¤ã«æãç´ãã¦ã¿ã¾ãã
ã¯ã©ã¤ã¢ã³ãã®å¤é度ã1ã®æã¯ãããã¯ã¼ã¯é
延ã«å¿ããæ§è½ä½ä¸çã¨ãªã£ã¦ãã¾ãããã¯ã©ã¤ã¢ã³ãã®å¤é度ãä¸ãã¦ããã«ã¤ãã¦æ§è½ä½ä¸ãç®ç«ããªããªã£ã¦ããã¾ããã©ãã¾ã§ã許容ãããã¯ä¸æ¦ã«ã¯è¨ãã¾ããããããç¨åº¦ã®å¤éè² è·ããããç°å¢ã«ããã¦ã¯RTT 4ããªç§ã¾ã§ãªãã¾ã許容ç¯å²ããªã¨æãã¾ãã
å¤é度ãä¸ãã¦ããã¨ãªãæ§è½ä½ä¸ãç®ç«ããªããªãã®ãã§ãããããç°¡åã«èª¬æããã¨ãããã¯ã©ã¤ã¢ã³ããDRBDã®ãããã¯ã¼ã¯å¦çã§å¾
ãããã¦ããéã«ä»ã®ã¯ã©ã¤ã¢ã³ããCPUã使ãå¥ã®å¦çãæ¿ãè¾¼ããããã§ãããã¹ã¦ã®ã¯ã©ã¤ã¢ã³ããDRBDã®ãããã¯ã¼ã¯å¦çå¾
ã¡ã«ãªããããªæ¥µç«¯ãªã¯ã¼ã¯ãã¼ãã§ãªããã°ãå¤é度ãä¸ãã¦ããã°ãã¤ãã¯CPUã使ãåããã¹ã«ã¼ãããã¨ãã¦ã¯å·®ããªããªãã¨ãããã¨ã«ãªãã¾ãã
次ã«ãsync_binlog=1ã®çµæãè¦ã¦ã¿ã¾ãããã
ä¸è¦ãã¦sync_binlog=0ã®ã¨ãã¨ã¯ç¶æ³ãç°ãªãã¨ãããã¨ãåããã¨æãã¾ããå¤é度ãä¸ãã¦ãã£ã¦ãæ§è½ä½ä¸ãç·©åããã¾ããããããããã®ã¹ã«ã¼ããããä½ããã¾ããããããRTT 2ããªç§ã®æ®µéã§ãããå®ç¨ã«å ªããªãã®ã§ã¯ãªããã¨èãããã¾ããsync_binlog=1ã®èª²é¡ã«ã¤ãã¦ã¯æ¬¡ã®ã¨ã³ããªã§èª¬æãããã¨ã«ãã¦ãä»åã¯sync_binlog=1ãããªãæªãã¨ãããã¨ãã¾ãè¦ãã¦ããã ããã°ã¨æãã¾ãã
åæã¬ããªã±ã¼ã·ã§ã³ã«ããããããã¯ã¼ã¯é
延ã®å½±é¿ãåãã£ãã¨ããã§ãAmazon RDSãã©ã®ããã«ãã¦ãã®èª²é¡ã«å¯¾å¦ãã¦ãããã確èªãã¦ããã¾ãã調ã¹ãã¨ããã以ä¸ã®ãããªä»çµã¿ã«ãªã£ã¦ããããã§ãã
- sync_binlogã®è¨å®ã¯ã¦ã¼ã¶ã«ä»»ããã¦ãã¦ãããã©ã«ãã¯0ã§ãã (åè)
- Availability Zoneéã®RTTã¯ã1ããªç§ç¨åº¦ã§ãã (åè)
ããã©ã«ããsync_binlog=0ã ã¨ããã®ã¯æå¤ã§ãããå å
ããã®è³æã«ãæ¸ããã¦ããããã«sync_binlog=0ã§ã¯ãã§ã¤ã«ãªã¼ãã¼æã«ãã¤ããªãã°ãæ¬ æããã®ã§ããªã¼ãã¬ããªã«ãå£ãã¦ãã¾ãã¾ããæ§è½ã¨ã®ãã¬ã¼ããªãã§ãã®ãããªè¨è¨ã«ããã®ã ããã¨ãããã¨ã¯ä»åã®æ¤è¨¼çµæãããç解ã§ããã®ã§ãããã客ãã¾ã«å¯¾ãã¦å£ãããªã¼ãã¬ããªã«ã¯å度ä½ãç´ãã¦ãã ããã¨ã¯ãªããªãè¨ãã¥ããã¨ããã§ããã¡ãªã¿ã«ãã¹ã¿ã¯InnoDBã®ã¯ã©ãã·ã¥ãªã«ããªã«ãã£ã¦å¾©æ§ããã®ã§ãinnodb_flush_log_at_trx_commit=1ããè¨å®ãã¦ããã°å¤§ä¸å¤«ã§ãã
Availability Zoneéã®RTTã1ããªç§ç¨åº¦ã ã¨ããã®ã寡èã«ãã¦ç¥ãã¾ããã§ãããç§ã®èªå®
(åè)ãããããã®VPS(大éª)ã¾ã§ã®RTTãç´20ããªç§ã ã¨ãããã¨ãèããã¨ãåAvailability Zoneã¯ããªãè¿ãè·é¢ã«ããã®ã§ã¯ãªããã¨æ¨å®ã§ãã¾ããå°éã®ãªãå½ã§ããã°ç¹ã«åé¡ãªãã¨æãã¾ãããæ±äº¬ãªã¼ã¸ã§ã³ã¯ã©ããªã£ã¦ããã®ãå°ãæ°ã«ãªãã¨ããã§ãã