ãè¿½è¨ 2018/01/06ãç¾å¨Mackerelã¯ã時系列データベースという概念をクラウドの技で再構築する - ゆううきブログã®æç³»åãã¼ã¿ãã¼ã¹å®è£ ã¸ç§»è¡ãã¦ãã¾ãã
ãµã¼ãã¢ãã¿ãªã³ã°ãµã¼ãã¹ Mackerel ã§æ¡ç¨ãã¦ããæç³»åãã¼ã¿ãã¼ã¹ Graphite ãç¨ããã·ã¹ãã ã®æ§ç¯ã¨éç¨äºæ ãç´¹ä»ãã¾ããGraphiteã«ã¤ãã¦ã¯ããããã¸ã§ãã³ã°ãã¢ããªã±ã¼ã·ã§ã³ããã®ä½¿ãæ¹ãGraphiteèªä½ã®ã¢ãã¿ãªã³ã°ãªã©æ§ã ãªãããã¯ãããã¾ãããç¹ã«å¤§è¦æ¨¡ãªãã§ã¯ã®ãããã¯ã¨ãã¦ãGraphiteã®å é¨ã¢ã¼ããã¯ãã£ãããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°ããã³ã¯ã©ã¹ã¿æ§æã«ã¤ãã¦ã®ç¥è¦ãæ¸ãã¾ãã
- èæ¯
- Graphiteã·ã¹ãã æ¦è¦³
- ãã¼ã¿æ§é ã¨ã¢ã¼ããã¯ãã£
- ããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°
- ã¯ã©ã¹ã¿æ§æ
- Graphiteéçºç¶æ³
- åè
- ã¾ã¨ã
èæ¯
MuninãZabbixãGrowthforecastãªã©ã«ä»£è¡¨ããããµã¼ãã¢ãã¿ãªã³ã°ãã¼ã«ãç¹ã«ã°ã©ãã«ããã¡ããªãã¯å¯è¦åæ©è½ããã¤ãããªãã¼ã«ãéç¨ããå ´åãæç³»åãã¼ã¿ã®æ±ããéè¦ã«ãªã£ã¦ãã¾ãããµã¼ãã®ã¡ããªãã¯ã¯CPUå©ç¨çãã¡ã¢ãªä½¿ç¨éãªã©ã®OSã®ã¡ããªãã¯ã«å ãã¦ãJVMãMySQLãªã©ã®ããã«ã¦ã§ã¢ã®ã¡ããªãã¯ãå ããã¨ã 1ãã¹ããããã®ã¡ããªãã¯æ°ã¯100ã軽ãè¶ ãã¾ããä»®æ³åãããã®ãå«ãã¦ãããã¯ã¼ã¯ã«ã¼ãããããã¯ããã¤ã¹ãè¤æ°ããå ´åã¯ãããã¤ã¹ãã¨ã«ã¡ããªãã¯ãåéããã®ã§ãããã«å¤ãã®ã¡ããªãã¯ãåéãããã¨ã«ãªãã¾ãã
ä»®ã«ã¡ããªãã¯åå¾ééã1åã¨ãã¦ã1ãã¹ããããã®ã¡ããªãã¯æ°ã100ããã¹ãæ°ã1,000å°ã¨ããã¨ã1åãããæä½ã§ã100,000以ä¸ã®ã¡ããªãã¯ã®æ¸ãè¾¼ã¿ã«èããå¿ è¦ãããã¾ãã èªç¤¾ãµã¼ãã®ã¿ãã¢ãã¿ãªã³ã°ããã®ã§ããã°ãã¹ãæ°ã1,000以ä¸ã«ãªããããªç°å¢ã¯ããã»ã©å¤ãã¯ãªãã¨æãã¾ãããMackerelã®ããã«SaaSã¨ãã¦ã·ã¹ãã ãä¸è¬æä¾ããå ´åã10,000å°è¦æ¨¡ã§ã¹ã±ã¼ã©ããªãã£ãèããå¿ è¦ãããã¾ãã
æç³»åãã¼ã¿ãæ ¼ç´ããããã«ããã¯ã¨ã³ãã¨ãã¦ãMySQLã®ãããªRDBMSã使ãå ´åãããã°ãRRDtoolã®ãããªæç³»åãã¼ã¿ã«ç¹åãããã¼ã¿ãã¼ã¹ãç¨ããå ´åãããã¾ãã å¾è ã«ã¤ãã¦ã¯æè¿ã§ã¯ãGoã§æ¸ãããInfluxDBãHBaseãããã¯ã¨ã³ãã¨ããOpenTSDBãªã©ãé¸æè¢ã«å ¥ãã¾ãã
RDBMSãç¨ããä¾ã¨ãã¦ãNew Relic Architecture - Collecting 20+ Billion Metrics a Day - High Scalability - ãããã¾ãã2011å¹´ã®æ å ±ãªã®ã§ä»ã¯ã©ããªã£ã¦ããããããã¾ããããNewRelicã§ã¯MySQLã®ãã¼ãã«ãã¢ã«ã¦ã³ããã¨ãã¤1æéæ¯ã«åå²ãã¦ããããã§ãã
RRDtoolã«ã¤ãã¦ã¯ä»ã®Mackerelãéçºãã以åã«æ°å¹´åããèªç¤¾éçºãã¦ãã社å Mackerelã®æç³»åDBã¨ãã¦ç¨ãã¦ãããã¨ãããã¾ããããã«ã¤ãã¦ã¯ä»¥åYAPCã§ãã¼ã¯ãããã¨ãããã®ã§ãã¡ãã®è³æãåç §ãã¦ãã ãããRRDtoolã§æ¶èãã¦ããæ§åããããã¾ããYAPC::Asia 2013ではてなのサーバ管理ツールの話のはなしをしました - ゆううきブログ
ãã®ããã«æ§ã ãªé¸æè¢ãããä¸ã§Graphiteãé¸ãã ã®ã¯ãç¥è¦ãæºãã¦ããRRDtoolã¸ã®ä¸æºããã¾ã解æ¶ãã¦ããã¨ããã®ã¨ãRRDtoolã¨åããããªãã¼ã¿æ§é ãæ¡ç¨ãã¦ãããã¨ãããBetter RRDtoolã¨ãã¦ä½¿ãããã¨ãæå¾ ããããã§ãã
ä¸æ¹ã§ãåè¿°ã®InfluxDBãOpenTSDBãKairosãªã©ã®æ¡ç¨ãèãã¾ããããããããInfluxDBã¯å½æãã¼ã¸ã§ã³0.3ã§ã¾ã ã¾ã ããããã®ãããã¯ãã ã£ãã¨ãããã¨ãããããããã«ãããã¯ã·ã§ã³ã§ä½¿ããã®ã§ã¯ãªãã£ãã¨æãã¾ããä»ãã¾ã ãã¼ã¸ã§ã³0.8ã§ãããã¯ã¯ã·ã§ã³ã§ä½¿ãããã¯ãããã¾ããã OpenTSDBã¨Kairosã¯ããããHBaseã¨Cassandraãããã¯ã¨ã³ãã¨ãã¦ç¨ãã¦ãããçå±ä¸ã¯ã¹ã±ã¼ã©ããªãã£ã«åªãã¦ãããã«ã¯è¦ãã¾ãããæ £ã親ããã ãã¹ã¿ã¼ã»ã¹ã¬ã¼ãå以å¤ã®åæ£DBãéç¨ããããã®ãã¨ããåé¡ãããã¾ããã
Graphiteã¯è³¢ãã·ã£ã¼ãã£ã³ã°ãåé·åã®ä»çµã¿ããã¤ããã§ã¯ããã¾ããããåã ã®ã³ã³ãã¼ãã³ãã®ä»çµã¿ã¯ã·ã³ãã«ã§ãã ä»çµã¿ãã·ã³ãã«ã§ãããããããªãã°ãããã¨ãªãã°ã³ã¼ããèªãã§è©³ç´°ãªæåãææ¡ãããã¨ããããããã¦ããã¨ããããããã®ã§ããããªããªãã¨ãéç¨ããããã ããã¨èãã¾ããã æ¡ç¨äºä¾ããããªãã«è±å¯ã§ããç¹ã«Evernoteã®äºä¾ãã¿ãã®ãæåã«Graphiteãç¥ã£ããã£ããã§ãããEvernote Blog
Graphiteã·ã¹ãã æ¦è¦³
Graphiteã¯ãã¿ã¤ã ã¹ã¿ã³ããã¡ããªãã¯åãã¡ããªãã¯å¤ããããã®å¤ã®çµãé£ç¶çã«åãåããã°ã©ãåããã¨ããã·ã³ãã«ãªæ©è½ããããã¯ã¼ã¯ãµã¼ãã¹ã¨ãã¦æä¾ãã¦ãã¾ãããããã¯ã¼ã¯ãµã¼ãã¹ã¨ããã®ãéè¦ã§ãRRDtoolã®å ´åãããåä½ã§ã¯ãããã¯ã¼ã¯çµç±ã§ãã¼ã¿ã®åºãå ¥ããé£ããããã¾ãããGrowthForecastã§ã¯ãHTTPã¤ã³ã¿ãã§ã¼ã¹ãæä¾ããããã«ãRRDtoolãããã¯ã¨ã³ãã¨ããWebã¢ããªã±ã¼ã·ã§ã³ã¨ããå½¢å¼ãã¨ã£ã¦ãã¾ãã
Graphiteã§ã¯ãã¼ã¿ã®æ¸ãè¾¼ã¿ã¨èªã¿è¾¼ã¿ã§ãããã³ã«ãç°ãªããTCPãã¼ã¹ã®ç¬èªã®ããã¹ããããã³ã«ã§æç³»åãã¼ã¿ãæ¸ãè¾¼ã¿ãæ¸ãè¾¼ãã æç³»åãã¼ã¿ãHTTPã§åå¾ãã¾ãã æç³»åãã¼ã¿ã¯ãã°ã©ãç»åãããã¯JSONå½¢å¼ã§åå¾ã§ãã¾ããåã«åå¾ã§ããã ãã§ãªããæéç¯å²æå®ãã¢ã°ãªã²ã¼ã·ã§ã³ãªã©ã®æ©è½ãåãã¦ãã¾ããï¼è©³ç´°ã¯å ¬å¼ããã¥ã¡ã³ã http://graphite.readthedocs.org/en/latest/render_api.html , http://graphite.readthedocs.org/en/latest/functions.html ï¼ Mackerelã®ããã«ã°ã©ãã®æç»ã¯ã¯ã©ã¤ã¢ã³ããµã¤ãJavaScriptã§è¡ãå ´åãJSONå½¢å¼ã§åå¾ãã¾ãã
Graphiteã¯ä¸»ã«ä»¥ä¸ã®3ã¤ã®ã³ã³ãã¼ãã³ãã§æ§æããã¦ãã¾ãã
whisper
: ã©ã¦ã³ãããã³ãã¼ã¿ãã¼ã¹ãã¡ã¤ã«ãä½æã»æ´æ°ããããã®ã©ã¤ãã©ãªcarbon
: æ¸ãè¾¼ã¿è¦æ±ãåãä»ããããã®ãã¼ã¢ã³ãå³å¯ã«ã¯carbon-cacheãgraphite-web
: èªã¿è¾¼ã¿è¦æ±ãåãä»ããããã®Webã¢ããªã±ã¼ã·ã§ã³
ã¾ããwhisperã¯ã©ã¦ã³ãããã³ãã¼ã¿ãã¼ã¹ã¨ãã¦RRDtoolã¨ä¼¼ããããªãã¼ã¿æ§é ã§æç³»åã®æ°å¤ãã¼ã¿ã®ã¿ãæ ¼ç´ãã¾ããï¼The Whisper Database — Graphite 1.1.5 documentation ï¼ whisperã¯ããµã¼ãã¨ãã¦åä½ãã¯ã©ã¤ã¢ã³ãã¨ã½ã±ããéä¿¡ãããããªã¤ã³ã¿ãã§ã¼ã¹ã¯ãããããã ã®Pythonã®ã©ã¤ãã©ãªã¨ãã¦whisperå°ç¨ã®ãã©ã¼ãããã®ãã¡ã¤ã«ã«ä¿åããããã¼ã¿ãæ±ãã¾ããåºæ¬æä½ã¨ãã¦whisperå½¢å¼ã®ãã¼ã¿ãã¡ã¤ã«ãä½æããcreateãwhisperå½¢å¼ã®ãã¡ã¤ã«ã«å¯¾ãã¦æç³»åãã¼ã¿ãã¤ã³ããæ´æ°ããupdateãæç³»åãã¼ã¿ãã¤ã³ãåãåå¾ããfetchãªã©ãããã¾ãã
次ã«ãcarbonã¯ãããã¯ã¼ã¯ããã®æ¸ãè¾¼ã¿è¦æ±ãåãã¦ãwhisperã©ã¤ãã©ãªã使ã£ã¦ãã¼ã¿ãã¡ã¤ã«ã®ä½æã¨æ´æ°ããã¾ããï¼ The Carbon Daemons — Graphite 1.1.5 documentation ï¼
carbonã«å¯¾ããæ¸ãè¾¼ã¿è¦æ±ãå¤ããªããã¡ãªãããããã©ã¼ãã³ã¹ãèæ
®ãã¦ããããã®ãã¼ã¹ãªã©ã®ãªã¼ããããã®å¤§ããHTTPã§ã¯ãªãç¬èªã®ããã¹ããã¼ã¹ã®åç´ãªãããã³ã«ã使ãã¾ããå
·ä½çã«ã¯ã<metric path> <metric value> <metric timestamp>
ã§è¡¨ç¾ãããå½¢å¼ã®æååãTCPã§éä¿¡ããã°ããã ãã§ãã
ä¾ãã°ã以ä¸ã®ãããªã³ãã³ããå©ãã°ãã¼ã¿ãæ¸ãè¾¼ãã¾ããï¼ Feeding In Your Data — Graphite 1.1.5 documentation ï¼
PORT=2003 SERVER=graphite.your.org echo "local.random.diceroll 4 `date +%s`" | nc -q0 ${SERVER} ${PORT}
ããã¹ãå½¢å¼ã ãã§ãªããPythonã®pickleå½¢å¼ã§ã·ãªã¢ã©ã¤ãºãããã¨ãã§ãã¾ããpickleã®æ¹ãcarbon
ãã¼ã¢ã³ã«ããã¹ããã¼ã¹å¦çãä¸è¦ã«ãªããããCPUå¹çããããªãã¯ãã§ãã
ã¯ã©ã¤ã¢ã³ãããã¿ã¦éåææ¸ãè¾¼ã¿ã¨ãªã£ã¦ããç¹ã«æ³¨æãå¿
è¦ã§ãã
RDBMSã®Write Ahead Log(WAL)ã®ãããªä»çµã¿ããªãããã絶対ã«ãã¼ã¿ããã¹ããã¦ã¯ãããªããããªã·ã¹ãã ã«ã¯åãã¦ãã¾ããã
æå¾ã«ãgraphite-webã¯Djangoã§æ¸ãããWebã¢ããªã±ã¼ã·ã§ã³ã§ãã ã¯ã©ã¤ã¢ã³ãããã®ãªã¯ã¨ã¹ãã«å¿ãã¦ãwhisperã©ã¤ãã©ãªãéãã¦è©²å½ãã¡ã¤ã«ã®ãã¼ã¿ãèªã¿åºããã°ã©ããã¬ã³ããªã³ã°ãã¾ãã Webãµã¼ãã¨ãã¦gunicornãuwsgiã使ããããã¨ãå¤ãããã§ãã
ãã¼ã¿æ§é ã¨ã¢ã¼ããã¯ãã£
ããã©ã¼ãã³ã¹ç¹æ§ãæããã«ããã«ã¯ãã¼ã¿æ§é ã¨ã¢ã¼ããã¯ãã£ã«ã¤ãã¦ç¥ãå¿ è¦ãããã¾ãã
whisperã®ãã¼ã¿æ§é
æç³»åãã¼ã¿ãä¿åããä¸ã§éè¦ãªã®ã¯ãã£ã¹ã¯ãµã¤ãºãã©ãã ãç¯ç´ã§ãããã§ããç´ æ´ã«èããã¨ã1åããã«ãã£ã¦ãããã¼ã¿ãã¤ã³ããå¹´åä½ã§ä¿åããã¨ãªãã¨ç¸å½ãªãã£ã¹ã¯ä½¿ç¨éã«ãªã£ã¦ãã¾ãã¾ãã
ããã§ãå¤ããã¼ã¿ã«ã¤ãã¦ã¯ä¸å®æéã§å¹³ååãããªãæ大å¤ãæ®ããªããã¦ä¸¸ãã¦ãã¾ã£ã¦ãã£ã¹ã¯ä½¿ç¨éãç¯ç´ããã¨ããã®ãã©ã¦ã³ãããã³ãã¼ã¿ãã¼ã¹ã®èãæ¹ã§ãã ä¾ãã°ã1å精度ã®ãã¼ã¿ã¯1æ¥åã ãã§ãããã5å精度ã®ãã¼ã¿ã¯1é±éæ®ãã¨ãããããªã¤ã¡ã¼ã¸ã§ãã
precision(精度)ã¨retention(ãã¼ã¿ä¿ææé)ã®çµãarchiveã¨å¼ã³ã¾ãããwhisperã®ã©ã¦ã³ãããã³ãã¼ã¿ãã¼ã¹ã¯archiveãè¤æ°å®ç¾©ããããprecisionã®retentionãéããã次ç¹ã®precisionã«ä¸¸ãã¦(Rollup Aggregation)ãæãèãprecisionã®retentionãéããããã以åã®ãã¼ã¿ãã¤ã³ããå®å ¨ã«åé¤ããã¨ãããããªä»çµã¿ã§ãã (http://graphite.readthedocs.org/en/latest/whisper.html#archives-retention-and-precision) ã ãã¼ã¿ãåå¾ããã¨ãã¯ãæå®ããæéç¯å²ã«å¿ãã¦é©åãªarchiveãé¸æããã¾ãã
whisperãã¡ã¤ã«ã®æ§é ã¯ä»¥ä¸ã®å³ã®ããã«ãªã£ã¦ãããå é ã«Metadataã¨Archiveã¸ã®ãªãã»ãããæ ¼ç´ããHeaderé åããããå¾ç¶ã«è¤æ°ã®Archiveé åã並ã³ã¾ãã
(The Architecture of Open Source Applications - Graphite http://www.aosabook.org/en/graphite.html)
ãã詳細ãªæ å ±ã¯whisperã®ã³ã¼ãã«æ¸ãã¦ããã¾ããæç³»åãã¼ã¿ãã®ãã®ã¯Archiveé åã«ä¿åããã¦ãããã¨ããããã°ååã§ãã
# https://github.com/graphite-project/whisper/blob/0.9.12/whisper.py#L19-25 File = Header,Data Header = Metadata,ArchiveInfo+ Metadata = aggregationType,maxRetention,xFilesFactor,archiveCount ArchiveInfo = Offset,SecondsPerPoint,Points Data = Archive+ Archive = Point+ Point = timestamp,value
ãã¼ã¿æ¸ãè¾¼ã¿æã¯ãHeaderãåç §ãã¦æãé«ãprecisionããã¤Archiveã¸ã®ãªãã»ãããåå¾ãã¦ã該å½Archiveã®æ«å°¾ã¸seekãã¦æ¸ãè¾¼ã¿ã¾ãã ãã ããRollup Aggregationããå¿ è¦ãããããã次ç¹ä»¥ä¸ã®precisionããã¤Archiveãå¿ è¦ãããã°ä¸¸ãã¦æ´æ°ãã¾ãã
carbon-cacheã®ã¢ã¼ããã¯ãã£
å ã«è¿°ã¹ãããã«ãcarbon-cacheã«ãããã¡ã¤ã«ã·ã¹ãã ä¸ã«ã¡ããªãã¯ãã¨ã®whisperãã¡ã¤ã«ãä½æããã¾ãã ã¡ããªãã¯æ°ãè¨å¤§ã«ãªãããã大éã®whisperãã¡ã¤ã«ã«å¯¾ãã¦1åãã¨ã«ãã¼ã¿ãã¤ã³ããæ¸ãè¾¼ããã¨ã«ãªãã¾ãã
å®è£ ã«ã¯Pythonã®ã¤ãã³ãé§åãã¬ã¼ã ã¯ã¼ã¯ã®Twistedã使ããã¦ãããæ¸ãè¾¼ã¿è¦æ±ãlistenããã¹ã¬ããã¨whisperã使ã£ã¦ãã¼ã¿ãæ¸ãè¾¼ãã¹ã¬ãããããããç¬ç«ãã¦åä½ãã¾ããæ¸ãè¾¼ã¿è¦æ±ã¯listenã¹ã¬ããã«ãããããã¡ãªã³ã°ããã¦ãwriterã¹ã¬ããããããã¡ãããã¼ã¿ãã¤ã³ããåãåºãã¦ããã£ã¹ã¯ã«æ¸ãè¾¼ãã¨ããä»çµã¿ã§ãã
ãã£ã¹ã¯ã®I/Oæ§è½ä½ä¸ãªã©ã«ãããåãã¡ããªãã¯ã ãtimestampã®ç°ãªããã¼ã¿ãã¤ã³ãããããã¡ã«è²¯ã¾ã£ã¦ããwhisperã®update_many
ã§ã¾ã¨ãã¦æ¸ãè¾¼ãã§ãããã¾ãã
(https://github.com/graphite-project/carbon/blob/0.9.12/lib/carbon/writer.py#L128)
ãã ããã®ã¨ããwhisperãã¡ã¤ã«ã¸ã®åæ ã¯å½ç¶é
ããã®ã§ãgraphite-webã«ã¯èªã¿åºãæã«carbon-cacheã®ã¡ã¢ãªä¸ã®ãã¼ã¿ãåå¾ãã¦ãwhisperãã¡ã¤ã«ã®ãã¼ã¿ã¨ãã¼ã¸ããã¨ããæ©è½(CARBON_LINK
)ãããã¾ãã
ããã©ã¼ãã³ã¹ç¹æ§
以ä¸ã®ã¢ã¼ããã¯ãã£ããããã£ã¹ã¯I/OãCPUå¹çãªã©ã®è¦³ç¹ããããã©ã¼ãã³ã¹ç¹æ§ã«ã¤ãã¦èå¯ãã¾ãã
ã¾ãããã£ã¹ã¯I/Oã§ãããcarbon-cacheã¬ãã«ã§ã¿ãã¨å¤§éã®ãã¡ã¤ã«ã«å°ããªæ¸ãè¾¼ã¿ãé »ç¹ã«æ¸ãè¾¼ããã¨ã«ãªãã¾ãã ããã«ãwhisperã¬ãã«ã§ã¿ãã¨1ã¤ã®ãã¡ã¤ã«ã«å¯¾ãã¦ãArchiveãµã¤ãºåé¢ããä½ç½®ã§è¤æ°ã®write I/Oãçºçããã¨ãããã¨ãè¨ãã¾ãã carbon-cacheã¬ãã«ã§ã¿ã¦ãwhisperã¬ãã«ã§ã¿ã¦ãããã¡ã¤ã«ã·ã¹ãã ä¸ã®ç°ãªããããã¯ã«å¯¾ãã¦åæã«æ¸ãè¾¼ããããI/Oã¹ã±ã¸ã¥ã¼ã©ã«ããwrite mergeãå¹ãã¥ããããã«æãã¾ããHDDã®ãããªä½éãªãã£ã¹ã¯ã®å ´åã§ã¯è´å½çããããã¾ããã Graphiteã®ã¢ã¼ããã¯ãã£ä¸é¿ããããªãåé¡ãªã®ã§ãSSDãªããioDriveã®ãããªãã©ãã·ã¥ã¹ãã¬ã¼ã¸ã使ã£ã¦ãé«IOPSãæããããã«ãããªã©ã®åæãå¿ è¦ã ã¨æãã¾ãã
ä¸æ¹ãCPUå©ç¨çã¨ãã観ç¹ã§ã¿ãã¨ãcarbon-cacheã¨carbon-relayã¯2ã¹ã¬ããã§ããåä½ããªããããã«ãã³ã¢ã¹ã±ã¼ã«ãã¾ããã carbon-relayã®å ´åã¯ããã¼ããã©ã³ãµã«ã¶ãä¸ãã¦æ¨ªã«ä¸¦ã¹ãã°åç´ã«ã¹ã±ã¼ã«ãã¾ãããcarbon-cacheã¯ãã¼ã«ã«ã®ãã£ã¹ã¯ã«æ¸ãè¾¼ããããåããã¹ãä¸ã«è¤æ°ã®carbon-cacheããã»ã¹ãåããå¿ è¦ãããã¾ãã
以ä¸ã¯æ¸ãè¾¼ã¿æã®ããã©ã¼ãã³ã¹ç¹æ§ã§ããããµã¼ãã¹ã®æ§è³ªä¸äººéãã°ã©ããã¿ãã¨ãã ãèªã¿è¾¼ã¿ãçºçãããããããã»ã©ã¹ã±ã¼ã«ãæ°ã«ããå¿ è¦ã¯ãªãã¨æãã¾ããcarbon-cacheã®å ¨æ¹ä½æ¸ãè¾¼ã¿ã®ãããã§ã大åã®ãã¼ã¿ãOSã®ãã¼ã¸ãã£ãã·ã¥ã«è¼ã£ã¦ãããããread I/Oãå°ãªãã¨ãããã¨ãããã¾ãã
ããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°
Graphiteã®ããã©ã¼ãã³ã¹ç¹æ§ãè¸ã¾ãã¦ãããã«ã¦ã§ã¢ã¬ã¤ã¤ã¨ã«ã¼ãã«ã¬ã¤ã¤ã§ã®ãã¥ã¼ãã³ã°æ¹æ³ãæ¸ãã¾ãã
ããã«ã¦ã§ã¢ã¬ã¤ã¤
ããã«ã¦ã§ã¢ã¬ã¤ã¤ã¨ãã£ã¦ãã主ã«carbon-cacheã®ãã¥ã¼ãã³ã°ã§ããããã©ã¡ã¼ã¿ã®èª¬æã¯carbon.conf
ã®exampleã«ããã¾ãã
https://github.com/graphite-project/carbon/blob/0.9.12/conf/carbon.conf.example
ãã®ä¸ã§ããã©ã¼ãã³ã¹ã«å½±é¿ããã®ã¯ä»¥ä¸ã®ãã©ã¡ã¼ã¿ã§ãã ããã©ã¼ãã³ã¹ç¹æ§ã§ã¿ãããã«ãCPUããªãã¹ã使ããªãããã«ããã¨ãããã¨ã¨ãã£ã¹ã¯ã¯é«éãªãã®ã使ãã¨ããæ¹éã§ãã©ã¡ã¼ã¿ã決å®ãã¾ãã
- MAX_CACHE_SIZE
- MAX_UPDATES_PER_SECOND
- MAX_CREATES_PER_MINUTE
- CACHE_WRITE_STRATEGY
- WHISPER_AUTOFLUSH
- WHISPER_FALLOCATE_CREATE
ã¾ããMAX_CACHE_SIZE
ã¯carbon-cacheä¸ã®ãããã¡ãµã¤ãº(ãã£ãã·ã¥ãµã¤ãº)ã®ä¸éã§ãããããã¡ãµã¤ãºã大ããã¨ããã®åã½ã¼ããªã©ã«ããCPUã³ã¹ããé«ããªãã¾ãã
æå®ããæ¹ãããããã«ã¿ãã¾ãããMAX_CACHE_SIZEãæå®ãã¦ãã¾ãã¨ã¹ã¬ããéã§ãªã½ã¼ã¹ç«¶åãèµ·ããã¦ãCPU使ç¨çãè·³ãä¸ãããã°ï¼ãããã®ã§ããã»ã©ã¡ã¢ãªãå°ãªãç°å¢ã§ãªãå ´åã¯inf
ãæå®ãã¾ãã
ãã¼ã¸ã§ã³0.9.13(æªãªãªã¼ã¹)ã ã¨æ¢ã«ç´ã£ã¦ããããããã¾ãããhttps://github.com/graphite-project/carbon/issues/167
次ã«ãMAX_UPDATES_PER_SECOND
ã¯whisperã¸ã®æ¸ãè¾¼ã¿ã¬ã¼ããå¶éãã¾ãã
æ¸ãè¾¼ã¿ã¬ã¼ããå¶éãããã¨ã«ãããç´°ã
ã¨ãã£ã¹ã¯ã«æ¸ãè¾¼ã¾ãã«ãããã¡ã«ãã¼ã¿ãã¤ã³ããããã¦ãã¾ã¨ãã¦æ¸ãè¾¼ãããã«ãªãã¾ãã
ãã£ã¹ã¯I/Oå¹çããããªãã¾ãããé«éãªãã£ã¹ã¯ã使ç¨ãã¦ããã®ã§ãä»ã®ã¨ããç¹ã«å¶éä¸è¦ãªã®ã§inf
ã«ãã¦ãã¾ãã
ãããã¡ã«æºãè¾¼ã¿ãããã¨carbon-cacheãè½ã¡ãã¨ãã®ãã¼ã¿ãã¹ãã大ãããªãã®ã§ããªãã¹ã使ããªãããã«ãã¦ãI/Oã§è©°ã¾ã£ãã試ãããããããã¨æãã¾ãã
MAX_CREATES_PER_MINUTE
ã¯whisperãã¡ã¤ã«ã®æ°è¦ä½æã®ã¬ã¼ããå¶éãã¾ãããã©ã¡ã¼ã¿ã®æå³ã¯MAX_UPDATES_PER_SECOND
ã¨åãã§ãã¡ã¤ã«ä½ææã®I/Oãæããã¨ãããã®ã§ããwhisperã¯æå®ãããprecisionã¨retentionã«ãããã£ã¦ãæªæ¥ã®ãã¼ã¿é åãæåã«ä½æããã®ã§ãI/Oã¤ã³ãã¯ãã大ããã§ãã
ãã ãããããé«éãªãã£ã¹ã¯ã使ç¨ãã¦ããã®ã§ãä»ã®ã¨ããinf
ã«ãã¦ãã¾ãã
CACHE_WRITE_STRATEGY
ã¯writerã¹ã¬ããããã¼ã¿ãã¤ã³ãåããã£ã¹ã¯ã«ãã©ãã·ã¥ããã¨ãã®ãªã¼ãã¼ã決å®ããæ¹éãæå®ãã¾ãã
sorted
ãmax
ãnaive
ã®3ã¤ãé¸æã§ãã¾ãããSSDãã¤CPUå©ç¨çãç¯ç´ãããã¨ãã¯naive
ãé¸ã³ã¾ãã
WHISPER_AUTOFLUSH
ã¯write(2)å¾ã«fsync(2)ãããã©ãããæå®ãã¾ããã¯ã©ã¤ã¢ã³ãããã¿ãã°ã©ã®ã¿ã¡éåææ¸ãè¾¼ã¿ã§ããã¨ããã®ã¨ãCPUå©ç¨çãç¯ç´ãããã®ã§ãiowaitãå¢ããããªãªãã·ã§ã³ã¯åã£ãã»ããããã¨æãã¾ãã
WHISPER_FALLOCATE_CREATE
ã¯fallocate(2)ã使ããã¨ã«ããwhisperã®ãã¡ã¤ã«ä½æãé«éåããã¾ããfallocateã使ç¨å¯è½ãªãã¡ã¤ã«ã·ã¹ãã ããã°ä½¿ã£ãã»ããããã§ããããé«éãªçç±ã¯ã空ã®archiveé åã確ä¿ããã®ã«ãwriteã·ã¹ãã ã³ã¼ã«ã§ã¼ããã£ã«ãããããäºåã«é£ç¶é åãOSã«äºç´ãã¦ããã¼ããã£ã«ãã¦ããããã®ããã§ãã(https://github.com/graphite-project/whisper/blob/0.9.12/whisper.py#L384-397)
å種ãã©ã¡ã¼ã¿ã«ã¤ãã¦è©¦è¡é¯èª¤ããçµæãå ¨ä½ã¨ãã¦ã¯carbon-cacheã«ä½ããããªããããªãã¥ã¼ãã³ã°ã«ãªã£ã¦ãã¾ãã ioDriveã®ãããªé«æ§è½ãªãã£ã¹ã¯ã使ãå ´åã¯ãI/Oã¹ã±ã¸ã¥ã¼ã©ãnoopãé¸ãã§ä½ããããªãããã«ãããã¨ãå¤ããããcarbon-cacheãåæ§ã«ä¸æã«I/Oæ§è½ã®ç®¡çããããããã¯ãä½ããããªãã»ããããããã§ãã
ã«ã¼ãã«ã¬ã¤ã¤
ã«ã¼ãã«ã¬ã¤ã¤ã§ã¯ã¡ã¢ãªç®¡çã¾ããã¨ãã¡ã¤ã«ã·ã¹ãã ã¾ããã§ãã¥ã¼ãã³ã°ã試ãã¾ããã
ã¡ã¢ãªç®¡ç
ã¾ãã¡ã¢ãªç®¡çã¾ããã§ã¯ãã¹ã¯ããããããã§ããªãã®ã«ããã¼ã¸ã¤ã³ã¨ãã¼ã¸ã¢ã¦ããé »ç¹ã«çºç(ã¹ã©ãã·ã³ã°)ããread I/Oãå¢ããã¨ããåé¡ãããã¾ããã ããã¯ãcarbon-cacheããã¡ã¤ã«ã·ã¹ãã ä¸ã®å ¨æ¹ä½ã«å®æçã«æ¸ãè¾¼ã¿ãããããããwhisperãã¡ã¤ã«ã®æ´æ°æã®ãã¼ã¸ãã£ãã·ã¥ã«ããã¡ã¢ãªãå§è¿«ããããã§ãã whisperãã¡ã¤ã«ã¸ã®æ´æ°ã¯writeã ããªãMetadataã®åç §ãªã©ã§readãå®è¡ãããã®ã§ããããããã£ãã·ã¥ãã追ãåºããããã¼ã¸ã«å¯¾ãã¦read I/Oãèµ°ã£ã¦ãããã®ã¨èãã¦ãã¾ãã
ã¹ã©ãã·ã³ã°ãé²ãæ段ã3ã¤èãã¾ããã
ã¾ãåç
§ãããã¨ã®ãªãç¡é§ãªãã¼ã¸ãã£ãã·ã¥ã大éã«ããã¨ãããã¨ã«çç®ãã¦ãposix_fadvise
ã«ããwriteãããã¼ã¸ã®ãã£ãã·ã¥ãè½ã¨ãã¦ããã¨ããæ¹æ³ãããã¾ããposix_fadvise
ã¯writeãããã¼ã¸ã«å¯¾ãã¦ãPOSIX_FADV_DONTNEEDã«ãã該å½ãã¼ã¸ã¸ã¯å°æ¥ã¢ã¯ã»ã¹ãããªããã¨ãOSã«ä¼ããã¨ããä»çµã¿ã§ãã
ããã¯RRDtoolã§ã¯ãã¡ã¤ã«ä½ææã®ã¿ä½¿ããã¦ãã¾ããæ´æ°æã¯ãªããã³ã¡ã³ãã¢ã¦ãããã¦ãã¾ãããhttps://github.com/oetiker/rrdtool-1.x/blob/72147e099cb655c1db5aca9b3c450aedbc0825ee/src/rrd_update.c#L952
whisperã«ãããããã¦ã¦è©¦ãã¦ããã®ã§ãããwriteãããã¼ã¸ã ãã¨ããå¤å®ãé£ãããread対象ã®ãã¼ã¸ã®ãã£ãã·ã¥ãè½ã¨ãã¦ãã¾ã£ããããã®ã§ããã¾ãããã¾ããã§ããã https://github.com/yuuki1/whisper/commit/42a662dbfeae9849e0824f4ecdd154446f32a176
次ã«ãMySQLã§ã使ããã¦ããI/Oãã¤ã¬ã¯ãã«ããããããæ¸ãè¾¼ã¿æã«ã¯ãã¼ã¸ãã£ãã·ã¥ããªãã¨ããæ¹æ³ã§ãã
I/Oãã¤ã¬ã¯ãã¯open(2)ã«O_DIRECT
ãã©ã°ã渡ãã°ããã®ã§ãããåºåãããã¡ã512ãã¤ãåä½ã§ã¢ã©ã¤ã¡ã³ããã¦ããå¿
è¦ãããã¨ããå¶éãããã¾ãã
æCã§SIMDæ¼ç®ãã£ã¦ãã¨ãã¯alignedã¢ããªãã¥ã¼ãã§ã¢ã©ã¤ã¡ã³ãã¨ã£ãããã¦ãã¾ããããPythonã ã¨posix_memalign
ã使ãã°è¯ãããã«æã£ããã®ã®ãããã§è«¦ãã¾ããã
çµå±ãã¡ã¢ãªå¢ããã°ããã ããªã®ã§ãæ°åGBãããã®ã¡ã¢ãªãç©ãã§éã§è§£æ±ºãã¾ããã
ã追è¨ã Mackerelにおける時系列データベースの性能改善 / Performance Improvement of TSDB in Mackerel - Speaker Deck ã«ã¦ãposix_fadviseãå©ç¨ããããããæãã¦ãã¹ã©ãã·ã³ã°ã解決ãã話ãç´¹ä»ãã¦ãã¾ãã
ãã¡ã¤ã«ã·ã¹ãã
ãã¡ã¤ã«ã·ã¹ãã ã¾ããã§ã¯ããã¡ã¤ã«ã·ã¹ãã ãext4ãxfsã®ã©ã¡ãã使ããã¨ãã話ãããã¾ãã 大éã®ãã¡ã¤ã«ãæ¢ç´¢ããã¨ããè¦æ±ã¨ã大éã®ãã¡ã¤ã«ã«åæã«æ¸ãè¾¼ãã¨ããè¦æ±ãããã®ã§ããã£ã¬ã¯ããªããªã¼ãB+treeã§æ¢ç´¢ã§ãã¦ã並åI/Oæ§è½ã®åªããxfsãæå©ã ã¨æãã¾ããã 念ã®ãããåããµã¼ãã¹ããã¯(ioDrive)ã§noatime, nobarrierã§ãã¦ã³ããã¦ãããã¯ãµã¤ãºã¯4KBãioDriveãªã®ã§I/Oã¹ã±ã¸ã¥ã¼ã©ãnoopã«ãã2ã¤ã®ãã¼ãã«carbon-cacheããã¦ã¦ãåãéã®æ¸ãè¾¼ã¿ããããã¨ãããxfsã®ã»ããCPUå¹çã1.07åã»ã©ãããI/O timeã1.2åã»ã©å¤§ããã¨ããçµæã«ãªãã¾ããã IOPSã¯ãªããext4ã®ã»ãã大ããããã¾ãèå¯ãã§ãã¦ããªãã¨ããç¶æ ã§ãã æã£ã以ä¸ã«å·®ãã§ãªãã£ãã®ã¯whisperãã¡ã¤ã«æ°ãã¾ã å·®ãåºãã»ã©ã®æ°ã§ã¯ãªãã£ãã¨ããã®ã¨ãcarbon-cacheã¯åä¸ãã¡ã¤ã«ã«å¯¾ãã¦1ã¹ã¬ããããæ¸ãè¾¼ã¾ãªããããext4ã§ãããã»ã©ä¸¦åæ§ãæªããªãã£ãã®ã§ã¯ãªããã¨äºæ³ãã¦ãã¾ãã
ä»ã«ã¯ãwhisperãã¡ã¤ã«ãåºå®é·ã§ããã¨ããç¹å¾´ãå©ç¨ãã¦ããããã¯ãµã¤ãºãwhisperãã¡ã¤ã«ã®åºå®é·ã«åãããã¨I/Oå¹çããããªããããããªããªã©ãã¾ã 試ãã¦ããªããã¨ãããã¾ãã
ã¯ã©ã¹ã¿æ§æ
Graphiteã¯carbon-relayã¨ããä»çµã¿ã使ã£ã¦ãåé·åã¾ãã¯è² è·åæ£ã®ããã«ã¯ã©ã¹ã¿ãæ§ç¯ã§ããããã«ãªã£ã¦ãã¾ãã ãã¡ããããã¼ããã©ã³ãµãDRBDãçµã¿åããã¦ãã¯ã©ã¹ã¿ãçµããã¨ãããã¾ãã ã¯ã©ã¹ã¿ã¨ãã£ã¦ãããã¤ããªãã°ã使ã£ããã¹ã¿ã¼ã»ã¹ã¬ã¼ãåã§ãRaftã®ãããªåæ£ã¢ã«ã´ãªãºã ã使ã£ããã®ã§ããªããé常ã«ç´ æ´ã§ãã
carbon-relayã®ä»çµã¿
The Carbon Daemons — Graphite 1.1.5 documentation
carbon-relayã¯carbon-cacheã®å段ã§æ¸ãè¾¼ã¿è¦æ±ãè¤æ°ã®carbon-cacheã¤ã³ã¹ã¿ã³ã¹ã«ã·ã£ã¼ãã£ã³ã°ãããã¯ã¬ããªã±ã¼ã·ã§ã³ãã¾ãã carbon-relayèªä½ã¯carbon-cacheã¨ã¯å¥ã®ã¤ã³ã¹ã¿ã³ã¹ã§åä½ããcarbon-cacheã¨åããTwistedã使ã£ã¦å®è£ ããããã¼ã¢ã³ã§ãã carbon-relayã®ã·ã£ã¼ãã£ã³ã°æ¹å¼ã¯consistent-hashingã¨rulesã®2ã¤ãããã¾ãã ã·ã£ã¼ãã£ã³ã°ã«ããå¥ã ã®ãã¼ãã«ãã¼ã¿ãåæ£ä¿åã§ãããããcarbon-cacheã®CPUå©ç¨çãIOPSããã£ã¹ã¯å®¹éãªã©ãåæ£ã§ãã¾ãã
ã¾ããconsistent-hashingæ¹å¼ã¯ã¡ããªãã¯åããã¼ã¨ããconsistent-hashingã§è¤æ°ã®carbon-cacheã«æ¸ãè¾¼ã¿è¦æ±ãã·ã£ã¼ãã£ã³ã°ãã¾ãã ä¸æ¹ãrulesæ¹å¼ã¯ã¡ããªãã¯åã«å¯¾ãã¦ãæ£è¦è¡¨ç¾ãããã³ã°ã§åæ£å ã®ãã¼ããé¸æã§ãã¾ãã ããã«ãããå é ä¸æåãaãªããã¼ã1ãbãªããã¼ã2ã¨ãã£ãåæ£ã«ã¼ã«ãæ¸ããã¨ãã§ãã¾ãã
consistent-hashingæ¹å¼ã使ãã°ä½ãã«ã¼ã«ã決ããªãã¦ãåçã«åæ£ãããä¸æ¹ã§ãåæ£å ã®ãã¼ããå¢ãããã¨ãã«ã·ã£ã¼ããrebalanceãããªããã°ãªãã¾ããã ããã§ããã·ã£ã¼ãã®rebalanceã¨ã¯ããã¼ããå¢ããããã¨ã«ããåããã¼åã§ãã£ã¦ãåæ£å ãå¤æ´ãããããã«ãåããã¼åã«ç´ã¥ãæ¢åã®ãã¼ã¿ãæ°ããåæ£å ã«ç§»åããããã¨ã§ãã consistent-hashingã¯ãã¼ãã®å¢æ¸æã«åæ£å ã®ãã¼ãããªãã¹ãå¤ãããªããããªã¢ã«ã´ãªãºã ã§ãããããã§ãåããã¼åã«å¯¾ãã¦å¥ã®ãã¼ãã«åæ£ãããã¨ã¯ããã¾ãã ãã®ä»çµã¿ã¯ãã£ãã·ã¥ãã¼ã¿ãæ ¼ç´ããMemcachedãªã©ã«å¯¾ãã¦ã¯ä½¿ããããã§ãããã¼ãã®å¢æ¸æã«ãªãã¹ããã£ãã·ã¥ãã¹ä»®ã«ãã£ãã·ã¥ãã¹ããã¨ãã¦ãããªãªã¸ã³ãã¼ã¿ãå¼ãã¦åãç´ãã°ããã ãã§ãã ããconsistent-hashingã使ããªããcarbonã¯ã·ã£ã¼ãã®rebalanceããµãã¼ããããããªä»çµã¿ã¯ãªãã®ã§ãèªåã§ä»çµã¿ãä½ãå¿ è¦ãããã¾ãã
carbon-relayã®ããã²ã¨ã¤ã®æ©è½ã§ããã¬ããªã±ã¼ã·ã§ã³ã¯carbon-cacheã¤ã³ã¹ã¿ã³ã¹ãåé·åããããã®ä»çµã¿ã§ãã ã¬ããªã±ã¼ã·ã§ã³ã¨ãã£ã¦ããMySQLã®ãããªãã¤ããªãã°ãç¨ãããã®ã§ã¯ãªããåç´ã«carbon-relayãè¤æ°ã®ã¬ããªã±ã¼ã·ã§ã³å ã®carbon-cacheã«ããããæ¸ãè¾¼ã¿è¦æ±ãæããã ãã§ãã çµæ§ç´ æ´ãªä»çµã¿ãªã®ã§ãcarbon-relayã¤ã³ã¹ã¿ã³ã¹ãè½ã¡ãã¨ãã«å ¨ã¦ã®ã¬ããªã±ã¼ã·ã§ã³å ã§ãã¼ã¿ã®ä¸è²«æ§ã¯ä¿è¨¼ããã¾ãããããããcarbon-relayã®ãããã¡ä¸ã®ãã¼ã¿ããã¹ãããå¯è½æ§ãããã¾ãã ç´ æ´ãªä»çµã¿ã ããã¨ãã£ã¦ã使ããªããã¨ããã°ããã§ããªããcarbon-relayã¤ã³ã¹ã¿ã³ã¹ããããªã«é »ç¹ã«è½ã¡ããã¨ã¯ãªãããµã¼ãã®ã¡ããªãã¯ãã¼ã¿ã¯çµ¶å¯¾ã«æ¬ ãã¦ã¯ãããªãæ§è³ªã®ãã®ã§ã¯ãªãããã¨ãæ¬ ããã¨ãã¦ãwhisperã®Rollup Aggregationã«ããéå»ã®ãã¼ã¿ã¯ä¸¸ããããããæéçµéã«ãããã¼ã¿ãã¹ããæ°ã«ãªããªããªããã¨ãã3ç¹ãèæ ®ãã¦ä½¿ã£ã¦ãããã¨èãã¦ãã¾ãã
ã¯ã©ã¹ã¿è¨å®
ã¯ã©ã¹ã¿ã®è¨å®æ¹æ³ã«ã¤ãã¦ã¯Clustering Graphite - bitprophet.org ã The Architecture of Clustering Graphite ãåèã«ãªãã¾ãã
Mackerelã«ãããæ§æ
åè¿°ã®Graphiteã«ãããã¯ã©ã¹ã¿æ§æãè¸ã¾ãã¦ãMackerelã«ãããæ§æãç´¹ä»ãã¾ãã Mackerelã§æ§æãçµãã¨ãã«ãWebä¸ã«å ¬éããã¦ããæ§ã ãªæ§æã«ç®ãéãã¦ç 究ãã¾ããã
åææ§æ
æåæã®æ§æã¯æ¬å½ã«åç´ã§1å°ã®ãã¹ãã«carbon-cacheã¨graphite-webãç«ã¦ã¦ããã ãã§ããã ãã¡ãããããã§ã¯1å°è½ã¡ããçµãããªã®ã§åé·åãèãã¾ãã
carbon-relayã«ããåé·å
carbon-cacheã®è¼ã£ãã¤ã³ã¹ã¿ã³ã¹ãtsdb-masterã¨å¼ãã§ãã¾ãããtsdb-masterã2å°ç¨æããcarbon-relayããã®å段ã«ããã¾ãã carbon-relayã¯replicationã¢ã¼ãã§åä½ãã¦ãããæ¸ãè¾¼ã¿è¦æ±ã2å°ã®tsdb-masterã«è¤è£½ãã¾ãã
ããã«ãcarbon-relayãSPOFã«ããªãããã«ããã¼ããã©ã³ãµä»¥ä¸ã«carbon-relayãè¤æ°å°ä¸¦ã¹ã¾ãã ãã¼ããã©ã³ãµã¯keepalivedã§åé·åããLVSã使ã£ã¦ã¾ãããELBãHAProxyã§ãããã§ãããã
graphite-webã¯carbon-cacheãæ¸ãè¾¼ã¿å ãã¡ã¤ã«ã·ã¹ãã ã¨åããã¡ã¤ã«ã·ã¹ãã ãåç §ããå¿ è¦ããããããåããã¼ãã§ä¸¡æ¹åãã¦ãã¾ãã graphite-webãLVSè¶ãã«åç §ããã¾ãã å ã«è¿°ã¹ãããã«tsdb-masteréã®ãã¼ã¿ã®ä¸è²«æ§ãä¿è¨¼ãããªããã¨ãèããã¨ãtsdb-masterãVIPã§åç §ãã¹ããªãããªæ°ã¯ãã¾ããä»ã®ã¨ããã¯carbon-relayããã¦ã³ããã¨ãã«ã2ã¤ã®tsdb-masterããããã«ã©ã³ãã ã«ã°ã©ãã大éã«æç»ããã¦ããã¼ã¿ãã¹ããç®è¦ã§ç¢ºèªãã¦ãã¹ããã¦ãæ¹ãLVSããå¤ãã¨ãããã¨ã§ããã¨ãã¦ãã¾ãã
ããã¯ã¢ãã
åç §ã¯ãããªããã®ã®ã2å°ã§ã¯ä¸å®ãªã®ã§ããã¯ã¢ããç¨ã®tsdb-masterãä½ã£ã¦ãã¾ããcarbon-relayã«ã¶ãä¸ããã ããªã®ã§æ§ç¯ã¯ç°¡åã§ãã
ãã«ãcarbon-cache
ç§éæ¸ãè¾¼ã¿ãã¼ã¿ãã¤ã³ãæ°ãå¢ãã¦ããã¨carbon-cacheã®CPUã1ã³ã¢ä½¿ãåãããã«ãªãã¾ããã ããã§ããªãã¹ããã«ãã³ã¢ã¹ã±ã¼ã«ãããããã«ãtsdb-masterã¸ã®æ¸ãè¾¼ã¿ãcarbon-relayã§åãã¦ããããconsitent-hashingã§è¤æ°ã®carbon-cacheã«åæ£ããã¾ããã carbon-relayãæãã®ã§ã¯ãªãL4ãã¼ããã©ã³ãµã§ãè¯ãã£ãã®ã§ãããconsistent-hashingã使ããã¨ã«ããåãã¡ããªãã¯ã¯åãcarbon-cacheã¤ã³ã¹ã¿ã³ã¹ã«åæ£ããããã¨ã§ãupdate_manyã«ããã¾ã¨ãæ¸ãè¾¼ã¿ãæå¾ ã§ãã¾ãã
tsdb-relay-lbå°å ¥
ããã«ç§éæ¸ãè¾¼ã¿ãã¼ã¿ãã¤ã³ãæ°ãå¢ããã¨ãtsdb-masterä¸ã®carbon-relayã®CPUå©ç¨çã§ãããã®ã§ãcarbon-relayãå¤ã«åºããã¨ãèãã¾ããã å¤ã«åºããcarbon-relayãã¹ã±ã¼ã«ãããããã«ãLVSã«ã¶ãä¸ãã¾ãã
1ã¤ã®carbon-relayã§replicationããã¤ã¤ãconsistent-hashingããã¨ãã£ããã¨ãã§ããªãã®ã§ãcarbon-relayã2æ®µå¿ è¦ã«ãªã£ã¦ãã¾ãã®ãé£ç¹ã§ããã å¤æ®µã«ãªãã°ãªãã»ã©å ¨ä½ã¨ãã¦ã®å¯ç¨æ§ãã¡ã³ããã³ã¹æ§ã¯è½ã¡ãã®ã§ã1段ã§å®çµãããæ¹æ³ãèãã¦ã¯ãã¾ãã ä¾ãã°ãå段ã®carbon-relayãç¡ããã¦ã¢ããªã±ã¼ã·ã§ã³ã«è¤è£½ããããã試ãããã¨ã¯ãªããã®ã®carbon-cacheã¯AMQPãããã³ã«ãããã¹ããã¨ãã§ããã®ã§ãcarbon-relayã®ä»£ããã«RabbitMQã使ããã¨ãèãããã¾ãã
ããªãè¤éã§ããã大éæã«ã¿ãã¨åé·ãã¢ã2å°1çµæ§ç¯ãã¦ããã ãã§ãã
ã»ã¨ãã©è½ã¡ããã¨ã¯ãªãã®ã§ãããtsdb-masterãã¼ããè½ã¡ããã¨ã®å¾©æ§ã¯ã復æ§å´ã«carbon-cacheã®æ¸ãè¾¼ã¿ãããã¤ã¤ãrsyncã§çèºãããã¡ã¤ã«åæãã¾ãã ä¸ã®ä¸çã«ãã»ã¨ãã©rsyncã使ã£ã¦ããããã§ãã ä¸æ¦ã©ããã®ã¬ã¤ã¤ã§æ¸ãè¾¼ã¿è¦æ±ã貯ãããã§ãã®éã«ãã¼ã¿åæããã¨ãããã¨ãã§ããªãã¨ä¸è²«æ§ã®ãããã¼ã¿åæã¯ããªãé£ããã§ãã
ãã¡ããDRBDã使ã£ã¦åæããã¨ããæ¹æ³ã¯ããã¾ãã試ãããã®ã®ãDRBDã¯æ´æ°ã®ãã£ããããã¯ãåæããä»çµã¿ãªã®ã§ãcarbon-cacheã®ãããªå ¨æ¹ä½æ¸ãè¾¼ã¿ãããã¨ã大éã®ãããã¯ãåæãããã¨ããããããããã¯ã¼ã¯å¸¯åã§ãããã¨ãããã¨ãããã¾ããã
Graphiteéçºç¶æ³
https://github.com/graphite-project/
Graphiteã¯2006å¹´ããéçºãå§ã¾ã£ããããã¯ãã§ãã æè¿ã§ã¯å¤§ããªãªãªã¼ã¹ã¯ãªããã®ã®ãéçºã¯ããããã«é²ãã§ããããã«ãªã¯ã¨ã¹ããããããæ´»çºã¨ãããããªç¶æ³ã§ãã ãã ãä¸ã®äººã®ã¡ã³ããã³ã¹ã追ãã¤ãã¦ãªãã¨ããããçµæ§æ¾ç½®ããããã«ãªã¯ã¨ã¹ããå¤ãã§ããã ãã¾ã«issueãã¾ã¨ãã¦å¤§écloseãããããã¦ãã¾ãã whisper以å¤ãã¹ãã³ã¼ãããªãç¶æ ãªã®ã§ããããããããã¼ã¸ã§ããç¶æ ãããªãã®ããããã¾ããã
ç¾å¨ã®stableãã¼ã¸ã§ã³ã¯0.9.12ã§Mackerelã§ããã®ãã¼ã¸ã§ã³ã使ã£ã¦ãã¾ãã
ä¸æ¹ã§ã次ä¸ä»£ã®Carbonã¨Whisperã®å®è£ ã¨ãã¦ãMegacarbonã¨Ceresã¨ãããã®ãããã¾ãã ä»ã²ã¨ã¤éçºç¶æ³ãã¤ããã¦ããªãã§ãããYahoo!ã§å¤§è¦æ¨¡ã«ä½¿ããã¦ããäºä¾ãããã¾ãã
- Sensu と Graphite による大規模インフラの監視 - Yahoo! JAPAN Tech Blog
- notes from the fields: Graphite+Megacarbon+Ceres. Multi-node cluster setup
åè
- The Architecture of Open Source Applications: Graphite
- GitHub - sonots/growthforecast-tuning: GrowthForecast/RRDtool チューニング秘伝の書
- Sensu + Graphite を1年運⽤してみて #sensucasual
- Tuning Graphite for 3M points/minute with a single backend machine (a story)
- What is the recommended backup method?
- DESTINATIONS vs CARBONLINK_HOSTS in a cluster
- Adding a new carbon-cache server with consistent-hashing
- Metric creation has slowed to a crawl
- carbon-cache.py at its limit?
ã¾ã¨ã
SQLããªã«ã¨ããã£ã¦ãªãã§RRDtoolããªã«ããã
— yuuki (@y_uuk1) 2013, 5æ 30
ä»åã¯ã¯ã¦ãªã«ã¢ã«ãã¤ãã«ãã¦åãã¦RRDtoolã触ã£ã¦ããã®2å¹´åã«ããã£ã¦èç©ããæç³»åDBãç¹ã«Graphiteã«é¢ããç¥è¦ãç´¹ä»ãã¾ããã ä»ã®æ§æã«è½ã¡çããã®ã¯1å¹´ã»ã©åã§ãããæ¹åããä½å°ã¯å¤ã ãããã®ã®æ£å¼ãªãªã¼ã¹ä»¥éãããã»ã©å¤§ãããã©ãã«ããªãå®å®ãã¦åä½ãã¦ãã¾ãã
ã¨ã¯ãããç¾ç¶å®å®ãã¦ããã·ã¹ãã ã§ãããµã¼ãã¹ã®æé·ã«ãããã¦ã¹ã±ã¼ã«ããã¦ããå¿ è¦ãããã¾ãã ç¹ã«ãã©ããã¯ã®æ¡ã1ã¤2ã¤ä¸ã®ã¹ã±ã¼ã©ããªãã£ãéæããããã«ã¯ã·ã¹ãã ã®ã¢ã¼ããã¯ãã£ã大ããå¤ãããã¨ãããã§ãããã
Monitoring with Graphite: Tracking Dynamic Host and Application Metrics at Scale
- ä½è : Jason Dixon
- åºç社/ã¡ã¼ã«ã¼: O'Reilly Media
- çºå£²æ¥: 2017/03/31
- ã¡ãã£ã¢: ãã¼ãã¼ããã¯
- ãã®ååãå«ãããã°ãè¦ã