ãåãã®ããã«ãI / Oæäœã¯ãææ°ã®Linuxã·ã¹ãã ã®ããã©ãŒãã³ã¹ã®ç¹ã§éèŠãªãªãœãŒã¹ã®æ°ã«å±ããŸãã Linuxã·ã¹ãã ã®ããã©ãŒãã³ã¹ã®ããã«ããã¯ã®ç¹å®ãšåæã¯éåžžã«è€éã§ãã éåžžããã®ç®çã«ã¯å°çšã®ãŠãŒãã£ãªãã£ã䜿çšãããŸãã æãæåãªããã©ãŒãã³ã¹åæããŒã«ã®äžã§ãsysstatããã±ãŒãžã«å«ãŸãããã¹ãŠã®ãŠãŒãã£ãªãã£ïŒiostatãsarãªã©ïŒã®æåã«èšåãã䟡å€ããããŸãã ãã ããç¶æ³ã«ãã£ãŠã¯ããããã®ãŠãŒãã£ãªãã£ã䜿çšããŠååŸããæ å ±ã§ã¯äžååã§ãã ããšãã°ãiostatã䜿çšãããšãç¹å®ã®æäœãå®è¡ããŠããããã»ã¹ãæ£ç¢ºã«èŠã€ããããšã¯ã§ããŸããã äžæ¹ããã®ãããªæ å ±ã¯ãç¹å®ã®ã¿ã¹ã¯ã解決ãããšãã«å¿ èŠã§ããããšãã°ãããŒã¿ã¹ãã¬ãŒãžã·ã¹ãã ã®ããã«ããã¯ãæ€çŽ¢ããŠåæããå Žåã§ãã
æåãªLinuxã«ãŒãã«éçºè ã®Jens Axboã¯2007幎ã«blktraceãäœæããŸãããããã¯I / Oæäœããã¬ãŒã¹ãããŠãŒã¶ãŒã«è©³çŽ°æ å ±ãæäŸããç¹å¥ãªãŠãŒãã£ãªãã£ã§ãã ãã®èšäºã§ã¯ãblktraceã®æ©èœã«ã€ããŠè©³ãã説æããŸãã
ç¹åŸŽ
blktraceã䜿çšãããšã次ã®åé¡ã解決ã§ããŸãã
- ãããã¯ããã€ã¹ã®ããã©ãŒãã³ã¹ãåæããŸãã
- æœåšçãªãªãœãŒã¹ã³ã¹ããèšç®ããŸãïŒããšãã°ããœãããŠã§ã¢RAIDãæ¥ç¶ããå ŽåïŒã
- ããŸããŸãªããŒããŠã§ã¢æ§æã®ããã©ãŒãã³ã¹ãåæããŸãã
- ç¹å®ã®ãœãããŠã§ã¢ç°å¢ã«æé©ãªæ§æã決å®ããŸãã
- ããŸããŸãªãã¡ã€ã«ã·ã¹ãã ã®ããã©ãŒãã³ã¹ãè©äŸ¡ããŸãïŒããŸããŸãªãã¡ã€ã«ã·ã¹ãã ïŒext4ãJFSãXFSãBtrfsïŒã¯ãããã¯I / Oãµãã·ã¹ãã ãšããŸããŸã«çžäºäœçšããblktraceã䜿çšããŠãç¹å®ã®ã¢ããªã±ãŒã·ã§ã³ãŸãã¯ããŒããŠã§ã¢ã§äœæ¥ãããšãã«æé«ã®ããã©ãŒãã³ã¹ãæäŸã§ãããã¡ã€ã«ã·ã¹ãã ã決å®ã§ããŸãæ§æã
ã€ã³ã¹ããŒã«ãšéå§
Blktraceã¯ã»ãšãã©ã®äžè¬çãªLinuxãã£ã¹ããªãã¥ãŒã·ã§ã³ã§äœ¿çšã§ããããããœãŒã¹ããã³ã³ãã€ã«ããŠã€ã³ã¹ããŒã«ããå¿ èŠã¯ãããŸããã ã€ã³ã¹ããŒã«ã¯ãããã±ãŒãžãããŒãžã£ãŒã䜿çšããŠæšæºçãªæ¹æ³ã§å®è¡ãããŸãã blktraceã«å ããŠãblkparseãŠãŒãã£ãªãã£ãã€ã³ã¹ããŒã«ããããã䟿å©ã§äººéãèªãã圢åŒã§çµæãæ瀺ããŸãã
次ã®ã³ãã³ããå®è¡ããŸãã
blktrace -w 30 -d / dev / sdf -o-
ãã®å Žåã®ã³ãã³ãã©ã€ã³åŒæ°ã¯æ¬¡ã®ããšãæå³ããŸãã
- ãWãã¯ã芳枬ãå®è¡ãããæéïŒãã®å Žåã¯30ç§ïŒãæå³ããŸãã
- åŒæ°ãdãã®åŸã«ãI / Oæäœã«é¢ããçµ±èšãåéãããããã€ã¹ã瀺ãããŸãã
- ã-ãã¯ããã¹ãŠã®çµ±èšãã³ã³ãœãŒã«ã«è¡šç€ºãããç¹å¥ãªããã¹ããã¡ã€ã«ã«ä¿åãããªãããšã瀺ããŸãã
ã³ãã³ãã©ã€ã³åŒæ°ãšã³ãã³ãæ§æã®è©³çŽ°ã«ã€ããŠã¯ã å ¬åŒããã¥ã¡ã³ããã芧ãã ããã
次ã®è¡šãç»é¢ã«è¡šç€ºãããŸãã
=== sdd === CPU 0ïŒ34ã€ãã³ãã2 KiBããŒã¿ CPU 1ïŒ27ã€ãã³ãã2 KiBããŒã¿ CPU 2ïŒ41ã€ãã³ãã2 KiBããŒã¿ CPU 3ïŒã€ãã³ã46件ãKiBãââãŒã¿3件 CPU 4ïŒ2769ã€ãã³ãã130 KiBããŒã¿ CPU 5ïŒ1718ã€ãã³ãã81 KiBããŒã¿ CPU 6ïŒ1326ã€ãã³ãã63 KiBããŒã¿ CPU 7ïŒ2279ã€ãã³ãã107 KiBããŒã¿ CPU 8ïŒ14ã€ãã³ãã1 KiBããŒã¿ CPU 9ïŒ12ã€ãã³ãã1 KiBããŒã¿ CPU 10ïŒ22ã€ãã³ãã2 KiBããŒã¿ CPU 11ïŒ50ã€ãã³ãã3 KiBããŒã¿ CPU 12ïŒ455ã€ãã³ãã22 KiBããŒã¿ CPU 13ïŒ184ã€ãã³ãã9 KiBããŒã¿ CPU 14ïŒ508ã€ãã³ãã24 KiBããŒã¿ CPU 15ïŒ1100ã€ãã³ãã52 KiBããŒã¿ åèšïŒ10585ã€ãã³ãïŒ0ãåé€ïŒã497 KiBããŒã¿
ããã»ããµã³ã¢ã®ããŒãã«é¢ããæ å ±ã衚瀺ãããŸãããå®çšçãªäŸ¡å€ã¯ã»ãšãã©ãããŸãããI/ Oæäœã®ããã©ãŒãã³ã¹ã«é¢ããçµè«ãåŒãåºãããã«äœ¿çšããããšã¯ã§ããŸããã
ãã詳现ãªæ å ±ããããããã圢åŒã§è¡šç€ºããã«ã¯ãblkparseãŠãŒãã£ãªãã£ã䜿çšããŸãã
blktrace -w 1 -d / dev / sdf -o-| blkparse -i-
ããã§ãåºåã¯æ¬¡ã®ããã«ãªããŸãã
8.32 0 19190 28.774795629 2039 DR 94229760 + 32 [fio] 8.32 0 19191 29.927624071 0 CR 94229760 + 32 [0]
/次ã«ãé¢é£ãããã¹ãŠã®ããã»ããµã³ã¢ã®I / Oæäœã«é¢ããçµ±èšã衚瀺ãããŸãã 1ã€ã®ã³ã¢ã«å¯Ÿãããã®ãããªçµ±èšã®äŸã瀺ããŸã/
CPU15ïŒ8.32ïŒïŒ ãã¥ãŒã«å ¥ããããèªã¿åãïŒ0ã0KiBãã¥ãŒã«å ¥ããããèªã¿åãïŒ64ã354 KiB ãã£ã¹ãããã®èªã¿åãïŒ0 0KiBãã£ã¹ãããã®æžã蟌ã¿ïŒ33ã276 KiB ãªãã¥ãŒãããèªã¿åãïŒ0ãªãã¥ãŒãããæžã蟌ã¿ïŒ0 å®äºããèªã¿åãïŒ0.0KiBå®äºããèªã¿åãïŒ0.0KiB ããŒãžã®èªã¿åãïŒ0,0KiBããŒãžã®æžã蟌ã¿ïŒ0,0KiB èªã¿åã深床ïŒ0æžã蟌ã¿æ·±åºŠïŒ68 IOã¢ã³ãã©ã°ïŒ22ã¿ã€ããŒã¢ã³ãã©ã°ïŒ16 åèšïŒ8.32ïŒ ãã¥ãŒã«å ¥ããããèªã¿åãïŒ0ã0KiBãã¥ãŒã«å ¥ããããèªã¿åãïŒ1908ã7665KiB ãã£ã¹ãããã®èªã¿åãïŒ0ã0KiBãã£ã¹ãããã®æžã蟌ã¿ïŒ1,009.7665KiB ãªãã¥ãŒãããèªã¿åãïŒ0ãªãã¥ãŒãããæžã蟌ã¿ïŒ0 å®äºããèªã¿åãïŒ0ã0KiBå®äºããæžã蟌ã¿ïŒ1954,7655KiB èªã¿åãããŒãžïŒ0,0KiBæžã蟌ã¿ããŒãžïŒ0,0KiB IOã¢ã³ãã©ã°ïŒ612ã¿ã€ããŒã¢ã³ãã©ã°ïŒ382 ã¹ã«ãŒãããïŒR / WïŒïŒ0KiB / s / 7701KiB / s ã€ãã³ãïŒ8.32ïŒïŒ11684ãšã³ã㪠ã¹ãããïŒ0åæ¹ïŒ0-0.0ïŒ ïŒ
æåã«ã次ã®åã§æ§æãããè¡šããããŸãã
- ã¡ãžã£ãŒããã³ãã€ããŒããã€ã¹çªå·ïŒãã®å Žåã8ã32ïŒã
- æäœã«é¢äžããã«ãŒãã«ã
- æäœã®ã·ãŒã±ã³ã¹çªå·ã
- æäœå®è¡æéïŒããªç§ïŒã
- ããã»ã¹èå¥åïŒPIDïŒ;
- ã€ãã³ãïŒblktraceã¯ãããèªäœãå«ããã¹ãŠã®I / Oã®ã©ã€ããµã€ã¯ã«ã€ãã³ããç£èŠããŸãïŒ;
- RWBSïŒR-èªã¿åããW-æžã蟌ã¿ãB-ããªã¢æäœãS-åææäœïŒ;
- æäœãéå§ããããããã¯+ãããã¯ã®æ°ã
- æäœãå®è¡ããããã»ã¹ã®ååïŒè§æ¬åŒ§ã§ç€ºãããŠããïŒã
äž»ãªæäœã¯æ¬¡ã®ãšããã§ãã
- A-I / Oæäœãå¥ã®ããã€ã¹ã«è»¢éãããŸããã
- C-æäœãå®äºããŸããã
- F-æäœã¯ãã¥ãŒå ã®é£æ¥ããæäœãšçµåãããŸãã
- I-æäœã®èŠæ±ã¯ãã¥ãŒã«å ¥ããããŸãã
- M-æäœã¯ãã¥ãŒå ã®é£æ¥ããæäœãšçµåãããŸãã
- Q-æäœã¯ãã¥ãŒã«å ¥ããããŸãã
- T-ã¿ã€ã ã¢ãŠãã®ããç¡å¹ã
- X-æäœã¯ããã€ãã®æäœã«åå²ãããŸãã
次ã«ãblkparseã¯ãã¹ãŠã®I / Oæäœã«é¢ããåèšæ å ±ã衚瀺ããèªã¿åãæäœãšæžã蟌ã¿æäœã®è² è·ã¬ãã«ãæ¯èŒããŸãã
è£å©ããŒã«
Blktraceã¯ããŒã¿ãåãåãã人éãèªãã圢åŒã§è¡šç€ºããŸãããåæã¯ããŸããã å°çšã®ãŠãŒãã£ãªãã£ã¯ããã®ããŒã¿ãåæãããããã«åºã¥ããŠã°ã©ããäœæããããã«èšèšãããŠããŸã-ãŸããbttãšseekwatcher / iowatcherãåŒã³åºãå¿ èŠããããŸãã
Btt
ãã®ãŠãŒãã£ãªãã£ã®ååã¯ãåŒblktraceã¿ã€ã ã©ã€ã³ã®ç¥èªã§ããchronicle blktraceããšç¿»èš³ã§ããŸãã blkparseã«ãã£ãŠåŠçãããblktraceåºåãä¿åãããŠãããã¡ã€ã«ãåæãããã¡ã€ã«ããæ å ±ãæœåºããããã«èšèšãããŠããŸãã
- æäœããã¥ãŒã«å ¥ããåã«åŠçã«è²»ãããæéã«ã€ããŠã
- 䞊ãã§åŸ ã€ã®ã«è²»ãããæéã«ã€ããŠã
- æäœã«çŽæ¥è²»ãããæéã«ã€ããŠã
bttã¬ããŒããååŸããã«ã¯ãæåã«blktraceã䜿çšããŠI / Oæäœããã¬ãŒã¹ããå¥ã®ãã¡ã€ã«ã«ä¿åããå¿ èŠããããŸãã
blktrace -d / dev / sda -o-> trace
ãã®ãã¡ã€ã«ãblkparseã§åŠçããŸãã åŠççµæãå¥ã®ãã¡ã€ã«ã«ä¿åããŸãã
blkparse -i trace -d trace1
ïŒãã®å Žåã®-dåŒæ°ã¯ãåŠçãããããŒã¿ãä¿åããããã¡ã€ã«ã瀺ããŸãïŒã
次ã®ã³ãã³ããå®è¡ããŠãbttã䜿çšããŠåä¿¡ããåºåãåŠçããŸãã
btt -i trace1
ã¬ããŒããç»é¢ã®è¡šã«è¡šç€ºãããŸãã å ¬åŒããã¥ã¡ã³ãã§ã bttçµè«ã®æ§é ãšãã®è§£éã«ã€ããŠè©³ããèªãããšãã§ããŸãã
ã·ãŒã¯ãŠã©ããã£ãŒ/ã€ãªãŠã©ããã£ãŒ
seekwatcherãŠãŒãã£ãªãã£ã¯ã2007幎ã«Chris Masonã«ãã£ãŠäœæãããŸããã ããã¯blktraceã¬ããŒããåŠçããã¢ãã¡ãŒã·ã§ã³åããããã®ãå«ããã£ãŒããããããããããã®ãã®ã§ããã ã·ãŒã¯ãŠã©ããã£ãŒãããžã§ã¯ããµã€ãã¯ä»æ¥ãŸã§ååšããŸãããããèšå¿µçãªç¹åŸŽãæã£ãŠããŸãã
ä»æ¥ãã¯ãªã¹ã»ã¡ã€ãœã³ã¯ããŒã¿èŠèŠåblktraceã®æ°ããããŒã«ãiowatcherãéçºããŠããŸãã ãªããžããªããiowatcherãã€ã³ã¹ããŒã«ã§ããŸã ã iowatcherã«ã¯æäœéã®äŸåé¢ä¿ãå¿ èŠã§ããã¢ãã¡ãŒã·ã§ã³ã°ã©ãã£ãã¯ãäœæããã«ã¯ãffmpegãŸãã¯librsvgããã°ã©ã ãã€ã³ã¹ããŒã«ããã ãã§ãã
iowatcherã䜿çšãããšãblkãpinãbttãfioãmstatãŠãŒãã£ãªãã£ã«åºã¥ããŠã°ã©ãïŒã¢ãã¡ãŒã·ã§ã³ã°ã©ããå«ãïŒãäœæã§ããŸãã
ããããããã«ã¯ãæåã«blktraceãå®è¡ããåºåãããã¹ããã¡ã€ã«ã«ä¿åããå¿ èŠããããŸãã
blktrace -w 30 -d / dev / sdf -o-> trace.dump
次ã«ã次ã®ã³ãã³ããå ¥åããŸãã
iowatcher -t trace.dump -o trace.svg
iowatcherã¯blktraceããŒã¿ãã°ã©ãã§è¡šç€ºããŸãã
次ã®ã³ãã³ãã䜿çšããŠãã¢ãã¡ãŒã·ã§ã³ãã£ãŒããååŸã§ããŸãã
iowatcher -t trace.dump --movie -o trace.mp4 /
ã³ãã³ãæ§æã®è©³çŽ°ã«ã€ããŠã¯ã ãã¡ããã芧ãã ãã ã
blktraceã¯ã©ãã§äœ¿çšãããŸãã
Blktraceã¯ãã¹ãã¬ãŒãžã·ã¹ãã ã®ããã©ãŒãã³ã¹ã®åé¡ãåæããã³èšºæããããã«èšèšããããœãããŠã§ã¢ãœãªã¥ãŒã·ã§ã³ã®è£å©ããŒã«ãšããŠäœ¿çšãããŸãã
ããšãã°ãLSIã¯PCIãšã¯ã¹ãã¬ã¹ã«ãŒãã®åœ¢ã§äœãããSSDã®ããã€ãã®ã¢ãã«ãçç£ããŠããŸãã ãŠãŒã¶ãŒãæé©ãªã¢ãã«ãéžæã§ããããã«ãå瀟ã¯ç¹å¥ãªãœãããŠã§ã¢è£œåã§ããNytro PredictorãéçºããŸããã Nytro Predictorã¯ãã¢ããªã±ãŒã·ã§ã³ã«ããã¹ãã¬ãŒãžäœ¿çšç¶æ³ã«é¢ããæ å ±ãåéããããã«åºã¥ããŠå¿çæéãæ¹åããããã®æšå¥šãè¡ããŸãã Blktraceã¯ãLinuxã·ã¹ãã ã®ããŒã¿åéããŒã«ãšããŠäœ¿çšãããŸãã 次ã«ããã®ããŒã¿ã¯ç¹å¥ãªã¢ã«ãŽãªãºã ã䜿çšããŠåŠçããããã®åŸãæé©ãªé床ãå¯èœã«ããããŒããŠã§ã¢ãœãªã¥ãŒã·ã§ã³ãéžæãããŸãã
ã€ã³ãã«ã¯ãLSI- Intel RAID SSD Cache Sizing and Performance Prediction Toolã®ãœãããŠã§ã¢ã³ã³ããŒãã³ãã䜿çšããåæ§ã®è£œåããªãªãŒã¹ããŠããŸãã ãŸããçµ±èšããŒã«ãšããŠblktraceã䜿çšããŸãã
ããŒã¿ãžã®ã¢ã¯ã»ã¹ãå éããå¿çæéãççž®ãããšããåé¡ã¯ãå€æ°ã®ãŠãŒã¶ãŒããããœãŒã·ã£ã«ãããã¯ãŒã¯ã«ãšã£ãŠéåžžã«éèŠã§ãã ãã®åé¡ã解決ããããã®ç©æ¥µçãªäœæ¥ã¯ã2010幎ã«FlashcacheïŒ1ã€ã®ãããã¯ããã€ã¹ã䜿çšããŠä»ã®ãããã¯ããã€ã¹ãžã®ã¢ã¯ã»ã¹ããã£ãã·ã¥ã§ããLinuxã«ãŒãã«ã®ã¢ãžã¥ãŒã«ïŒãäœæããFacebookããã°ã©ããŒã«ãã£ãŠè¡ãããŠããŸãã 補åã¯GPLïŒããã«GitHubã®ãªããžã㪠ïŒã®äžã§ã©ã€ã»ã³ã¹ãããŠããŸã ã Flashcacheéçºè ã¯blktraceã䜿çšããŠãããŒã¿ããŒã¹ã¢ããªã±ãŒã·ã§ã³ã䜿çšãããã£ã¹ã¯ã¢ã¯ã»ã¹ãåæããŸããã
Habréã®æçš¿ã«ã³ã¡ã³ãã§ããªãå Žåã¯ã ããã°ã«ãæåŸ ããŸãã