ã¯ããã«
æ¬ç¨¿ã¯ãµã¼ãã¼ã¯ã¼ã¯ã¹ã¢ããã³ãã«ã¬ã³ãã¼7æ¥ç®ã®æ稿ã§ã
Amazon OpenSearch Serviceã¨ã¯
Amazon OpenSearch Serviceï¼ä»¥ä¸AOSã¨ç¥ãã¾ãï¼ã¯ãOSSã®æ¤ç´¢ã»åæã¨ã³ã¸ã³ã§ããOpenSearchã®ããã¼ã¸ããµã¼ãã¹ã§ãã
å¤å½©ãªæ©è½ãããããã¤ä»ã®AWSãµã¼ãã¹ã¨ã®ã¤ã³ãã°ã¬ã¼ã·ã§ã³ãã¿ã¼ã³ãè±å¯ã§å¤é¨ããã®ãã¼ã¿ã®åãè¾¼ã¿ãé常ã«ã¹ã ã¼ãºã«å®ç¾ã§ããç¹å¾´ããã£ã¦ãããä¸æ¦ä½¿ãããªããããã«ãªãã¨ä½ãã¨éå®ãããµã¼ãã¹ã§ãã
æ¬é£è¼ã®ç®çã»å 容
ä¸æ¹ã§ãOpenSearchèªä½ã®å¦ç¿ã³ã¹ããæ¯è¼çé«ããå¦ç¿ã³ã³ãã³ããããéããã¦ãããã¨ããããã®è¾ºãã®ã¨ã£ã¤ãã¥ãããå°å ¥ã®ãã¼ãã«ã¨ãªã£ã¦ããã±ã¼ã¹ãå°ãªãããè¦åãããã¾ãã
ç¹ã«éµã¨ãªããããã¯ã®1ã¤ããindexï¼RDBã§ããã¨ããã®ãã¼ãã«ï¼ã®åãæ±ããã§ãçè ãå¦ã³ã¯ããã®æã«èªåãªãã®è¦åãå³ãã¤ããã®ã«è¦å´ããè¨æ¶ãããã¾ãã
ããã§æ¬é£è¼ã§ã¯ãindexã«é¢ããè¨è¨æ¥åã»éç¨æ¥åã«ç¦ç¹ãããã¦ã主è¦ãªæ¦å¿µãé¢é£æ©è½ç¾¤ãç¶²ç¾ çã«ç´¹ä»ãããã¨ã§ãçããã®å¦ç¿ã³ã¹ããä¸ãã¦åæ»ã«å°å ¥ã»éç¨ãé²ãã¦ããã ããã¨ã»AOSå©ç¨ã®è£¾éãå°ãã§ãåºãããã¨ãç®çã¨ãããã¨æãã¾ãã
è£è¶³
ãªãããã®indexã®éç¨ã«ã¤ãã¦ãé常ã®AOSããããã«éç¨ä¸ã®æéãåæ¸ãããã¨ãã§ããAmazon OpenSearch Serverlessã¨ãããµã¼ãã¹ãä»æ¥ã§ã¯åå¨ãã¾ãã
ãã¡ãã«ã¤ãã¦ããã²ç´¹ä»ãããã¨æãã®ã§ãããé常ã®AOSã®éç¨ãå¤å°ç解ãã¦ããã ãã¦ããã§ãªã㨠ãã®ç価ãã¤ãã¿ã¥ãããµã¼ãã¹ã§ãã®ã§ã便å®ä¸é£è¼ã®çµç¤ã«è§¦ãããã¨ã«ãããã¨æãã¾ãã
indexã«é¢ããåºç¤ç¥è
ã¾ãã¯å°å ¥ã¨ãã¦indexã«é¢ããç¨èªã»æ©è½ã«ã¤ãã¦å¿ è¦æå°é触ãã¦ããããã¨æãã¾ãã
indexã»shardã»document
OpenSearchã§ã¯jsonæ§é ã®ãã¼ã¿ = documentã大éã«ç®¡çãããã¨ã«ãªãã¾ãã ãããã®document群ã®è¦ããä¸ã®æ ¼ç´å ´æãindexã¨å¼ã³ã¾ãã
ãè¦ããä¸ãã¨è¿°ã¹ã¾ããããindexã§ç®¡çããã¦ããdocument群ã¯å®éã®ã¨ããã¯shardã¨ããåä½ã§åå²ããã¦ä¿æããã¦ãã¾ãã
shardãé©åãªæ°éã«è¨å®ãã¦ãããã¨ã§ã1ã¤ã®ãã·ã³ãã¼ãã§ã¯ãªãè¤æ°ã®ãã·ã³ãã¼ãã§åæ ãã¦document群ã管çãããã¨ãã§ãã¾ãã
è¤æ°ã®ãã·ã³ãã¼ãã§document群ã管çãããã¨ã«ãã£ã¦ãå¯ç¨æ§ãåä¸ããã ãã§ã¯ãªããæ¸ãè¾¼ã¿å¦çã»æ¤ç´¢å¦çãåæ ãã¦æ ãä½å°ãçã¾ãã¾ãã
ãµã¼ãã¼ãå¢ããããã«å¿ãã¦shardãå¢ããã°å¢ããã»ã©æ¸ãè¾¼ã¿ã»æ¤ç´¢æ§è½ã«ã¤ãã¦ãã¹ã±ã¼ã«ã¢ã¦ãããããã¨ãã§ããã¨ããããã§ãã
AOSã§ã¯ãã¡ã¤ã³ï¼ã¯ã©ã¹ã¿ï¼ä½ææã«å½è©²ãã¡ã¤ã³åºæã®ã¨ã³ããã¤ã³ããæãåºããã¾ãã®ã§ãå½è©²ã¨ã³ããã¤ã³ãã«å¯¾ãã¦ç¹å®indexã¸ã®documentæå ¥ããªã¯ã¨ã¹ããããã¨ã§åshardã¸ã®ä¿åå¦çãå®æ½ããã¾ãã
shardã®ç¨®é¡
shardã«ã¤ãã¦ã¯primary shardã¨replica shardã®2種é¡ãããã¾ããæåéãprimary shardã大å ã®shardã§ãreplica shardããã®è¤è£½ã¨ãããã¨ã«ãªãã¾ããprimary shardã¯æä½ã§1ã»replica shardã¯æä½ã§0ã¨ãªãã¾ãã
æ¸ãè¾¼ã¿æã®æåã¨ãã¦ã¯ä»¥ä¸ã®æµãã«ãªãã¾ã
- ã¾ãprimary shardã«æ¸ãè¾¼ã¿ãè¡ããã
- ã¤ãã§ï¼replica shardè¨å®ã1以ä¸ã®å ´åã§ããã¤å¿ è¦æ°åã®ãã¼ããå®éã«ããå ´åã«ã¯ï¼replica shardã«ãã¼ã¿è¤è£½ãå®æ½ããã
ä¸è¨ã®ããã¼ã示åããéããå¤éã®documentãä¸åº¦ã«æå ¥ãããã¨ãèããå ´åã«æ¸ãè¾¼ã¿æ§è½ãåä¸ããã«å½ãã£ã¦ã¯replica shardã®å¢å ã¯å¹æããªãprimary shardã®å¢å ãå¿ è¦ã§ã
ãããreplica shardãå¤ãã¨è¤æ°ã®ãã¼ãã¸ã®è¤è£½/æ¸ãè¾¼ã¿ãå¿ è¦ã«ãªãè² è·ãçãã¾ããããåææ§ç¯çã®ã¿ã¤ãã³ã°ã§ãã¼ã¿ã大éã«æå ¥ããéã«ã¯ä¸æçã«replicaãåæ¸ããå¦ç½®ãã¨ãå ´åãããã¾ã
ä¸æ¹ã§ãæ¤ç´¢å¦çã«ã¤ãã¦ã¯primary shardãreplica shardãåæ§ã«æ ããã¨ãã§ãã¾ãã
ã®ã¡ã®åã®blogã§è©³è¿°ããæ©ä¼ãããã¨æãã¾ãããprimary shardã®å¢æ¸ãããreplica shardã®å¢æ¸ãå³ãæ¹ãã¯ããã«ãªãã¬ã¼ã·ã§ã³ä¸ã®ãã¼ãã«ãä½ãããæ¤ç´¢æ§è½ã®åä¸ãèããå ´åãæ®éã¯replica shardã®å¢å ã«ãã調æ´ãè¡ãã¾ãã
éç¨ä¸ã®ä¸»è¦ãªæ³¨æç¹
shardã®ç®¡ç
OpenSearchã®éç¨ã§ç¹ã«æ³¨æãããªããã°ãããªãç¹ãããã¾ããããã¯ãé©æ£ãªããã©ã¼ãã³ã¹ãä¿ã¤ããã«ã¯ã1shardãããã§ç®¡çãããã¼ã¿å®¹éããªãããã¯ã©ã¹ã¿å ã®shardæ°ããé©æ£ã«ä¿ã¤å¿ è¦ãããã¨ãããã¨ã§ãã
主ã«æ°ãé ãå¿ è¦ãããã®ã¯åè ã§ãå¾è ã®shardæ°ã«ã¤ãã¦ã¯ããã®é£è¼ã§è§¦ãã¦ãããããªé©åãªè¨è¨ã»éç¨ããã¦ããã°å¤ãã®å ´åæ®æ®µæ°ã«ãããå¿ è¦ã¯ãªãã®ã§ãããä¸å¿ã©ã¡ãã«ã触ãã¦ãããã¨ã«ãã¾ãããã
1shardãããã§ç®¡çãããã¼ã¿å®¹é
ã¾ããå1shardã§ç®¡çãããã¼ã¿å®¹éã¯ãæ¤ç´¢ã¬ã¤ãã³ã·ãéè¦ããã¯ã¼ã¯ãã¼ãã§ã¯10~30GiBç¨åº¦ãããã§ãªãå ´åã§ã30~50GiBç¨åº¦ã«åãããã¨ãé©å½ã¨ããã¦ãã¾ãã
å®ã¯shardã¯åãªãå ¥ãç©ã¨ããããã§ã¯ãªããããèªä½ã§èªèº«ã®ä¿ç®¡ãããã¼ã¿ã«é¢ããæ¤ç´¢ã¹ã¬ãããèµ°ãããããã£ãã·ã¥ãæã£ããããçãå®ã¯æ¤ç´¢å¦çæ©æ§ã®ä¸ç¿¼ãæ ã£ã¦ãã¾ãã
ãã®ããåshardã®ç¶æã«ã¯ä¸å®ã®CPUã»ã¡ã¢ãªãªã½ã¼ã¹ãå¿ è¦ã¨ãªãã®ã§ãã1shardã§ç®¡çãããã¼ã¿å®¹éãå¤ãããå ´åã¯æ¤ç´¢å¹çã®å£åã«ã¤ãªããã°ãããé害æã®å¾©æ§é度çã«ãå½±é¿ãçãã¾ãã
対ãã¦ã1shardã§ç®¡çãããã¼ã¿å®¹éãå°ãªãããå ´åã«ã¤ãã¦ã¯åè ã»ã©ã®åé¡ã¯çãã¾ãããå ã«è¿°ã¹ãäºæ ï¼åshardã®ç¶æã«ã¯ä¸å®ã®CPUã»ã¡ã¢ãªãªã½ã¼ã¹ãå¿ è¦ï¼ãããã·ã³ãªã½ã¼ã¹ãéå¹çã«ä½¿ç¨ãã¦ããç¶æ ã¨ã¯ããã¾ãã
ã¯ã©ã¹ã¿å ã®shardæ°
ã¾ãããã¼ããããã®shardæ°ãå¢ãéããªãããã«ãããã¨ãéè¦ã§ããOpenSearchã¯Javaã§åä½ãã¦ãã¾ãããJavaãã¼ã1GiBãããã®shardæ°ã25以ä¸ã§åãããã¨ãæ¨å¥¨ããã¾ããããã§ããshardæ°ã¯primary shardã ãã§ã¯ãªãreplica shardã®åæ°ãå«ãã¾ãã
OpenSearch Service ã¯ãã¤ã³ã¹ã¿ã³ã¹ã® RAM ã®ååã Java ãã¼ãï¼æ大 32 GiBï¼ã¨ãã¦å²ãå½ã¦ãä»æ§ã¨ãªã£ã¦ãã¾ããããä¾ãã°16GiBã®RAMãæã¤r6gd.large.searchã¿ã¤ãã®ã¤ã³ã¹ã¿ã³ã¹ã§ããã°1ãã¼ããããå¤ãã¨ã200åã¾ã§ã«ä¿ç®¡shardãåããå¿ è¦ãããã¨ãããã¨ã«ãªãã¾ãã
ãã®çå±ã§ããã¨r6gd.16xlarge.searchã®ãããªæ¥µãã¦å¼·åãªã¹ããã¯ã®ã¤ã³ã¹ã¿ã³ã¹ãè¤æ°å°å±éãããããªã¯ã©ã¹ã¿ã¼ã§ããã°shardæ°ã¯ãã¾ãæ°ã«ããªãã¦ãããã®ã§ããããããããããã¨ã§ãããã¾ããã
ããã©ã«ãã§1ãã¡ã¤ã³(OpenSearch Serviceã®1ã¯ã©ã¹ã¿ã®åä½ï¼ã«ã¤ã1000ããshardã¯å±éã§ããªãä»æ§ã¨ãªã£ã¦ãã¾ãããã®ä¸éã¯å¼ãä¸ããããã®ã§ãããAWSã®æ¨å¥¨ç£è¦è¨å®ã¨ãã¦30000ãé¾å¤ã¨ãã¦ç£è¦ãããã¨ãæ¨å¥¨ããã¦ãã¾ãããã®30000ã¨ããæ°åãä¸ã¤ã®ä¸éã¨ãã¦èãã¦ããã®ãããã§ãããã
ã¹ãã¬ã¼ã¸ã®å®¹é
ã¹ãã¬ã¼ã¸å®¹éã®ç®¡çã«ã注æãå¿ è¦ã§ããå ã»ã©æ¤ç´¢æ§è½ãå¢å¼·ããã«ã¯replica shardãå¢å¼·ãããã¨ãå¤ãã»ã»ã»ã¨æ¸ãã¾ããã
ã§ã¯ãæ¤ç´¢æ§è½ãä¸ããããã«ç¡è¨ç»ã«replica shardãå¢ããã¦ãåé¡ã¯çããªããã®ã§ãããããçãã¯Noã§ãã
ã¾ããreplica shardã¯å¢ããã°å¢ããã»ã©ããã®indexã§ä¿ç®¡ãããã¼ã¿éãå¢ãã¦ãããã¨ã«æ³¨æãè¦ãã¾ãã
æ¬ç¨¿ã®æç¹ã§ã¯ããã¼ã¿ã®ä¿ææéãå¯è½ãªãããé·ãããããã¨ããè¦æã¨ãæ¤ç´¢æ§è½ãé«ãä¿ã¡ãããã¨ããè¦æã¨ã¯ãªããªãç¸å®¹ãã¥ããå¾®å¦ãªé¢ä¿ã«ããã»ã»ã»ã¨ææããã«ã¨ã©ãã¦ããã¾ã
ï¼éç¨äºç®ã潤沢ã«ããå ´åã¯ä¸¡ç«å¯è½ã§ãããã®ãããªå ´åã¯ãã¾ãå¤ãã¯ããã¾ããã»ã»ã»ããããããã¤ãã諸ã ã®ãã¯ããã¯ã«ã¤ãã¦ã¯å¾ç¶ã®é£è¼ã§è©³è¿°ãããã¨æãã¾ãï¼
ã¾ããããããreplica shardãå¢ãããã¨ããã§ãããå®éã«å²ãå½ã¦ããããã¼ãæ°ãååã«ç¢ºä¿ãã¦ããªãã¨å¹åãçºæ®ã§ããªããã¨ã«ãçæããå¿ è¦ãããã¾ãã
ãã¼ããå¢ããã°æ§è½ãä¸ããã¾ããããã¯ãè²»ç¨ã¯ä¸ãã£ã¦ãã¾ãã¨ããã¨ããã§ããã®è¾ºãã®è¨è¨ã¯ã財å¸ã¨ç¸è«ãã¤ã¤æ¤è¨ããå¿ è¦ãããã¾ãã
ãããã«
ãããã ã£ãã§ãããããååãããAOSããªããããã©ããããã ãªããã¨ããå°è±¡ãæ±ããã¦ãã¾ã£ãããããã¾ããã
ãã ãé©æ£ãªshard容éã»ã¹ãã¬ã¼ã¸å®¹éãç¶æããããã®éç¨ä½æ¥ã¯å®ã¯ããªãã®ç¨åº¦èªååã§ãã¾ãã次å以éã¯ããã®ãé©æ£ã¹ããã¯ãç¶æããããã®éç¨ä½æ¥ã®ç¨®å¥ãããèªååãã®ä»çµã¿ã«ã¤ãã¦ä½åãã®è¨äºã«åãã¦ãã©ã¼ã«ã¹ãã¦ããããã¨æãã¾ãã
ç°æ çå¾ (è¨äºä¸è¦§)
ã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¹é¨
2016å¹´æ°åå ¥ç¤¾ãçç¡ç²¾ã§å ¥ç¤¾ä»¥éä¸åããã°ãæ¸ãã¦ããªãã£ãã®ã§ãããè²ã ããããç¨ã«æ¸ããã¨ã«ãã¾ããï¼ç¾¤é¦¬ããçå¿ãããã¦ãå±ããã¾ãï¼