ä»æ¥ãå€ãã®äŒæ¥ã¯ãæ°ãããããžã§ã¯ããéå§ããããæ¢åã®ã·ã¹ãã ãæ¹åãããããŠãã©ã®éçºãªãã·ã§ã³ãããæ£åœåãããã®ãçåã«æã£ãŠããŸãããã¯ã©ã·ãã¯ã3å±€ã¢ãããŒãã䜿çšããããççµåã³ã³ããŒãã³ãã®ã»ãããšããŠã·ã¹ãã ãèšèšããŸããïŒ
æåã®ã±ãŒã¹ã§ã¯ãèç©ããããã¹ãŠã®çµéšãšæ¢åã®ã€ã³ãã©ã¹ãã©ã¯ãã£ãæé©ã«äœ¿çšã§ããŸãããèšç»ãšãªãªãŒã¹ã®é·ããµã€ã¯ã«ããã¹ãã®å°é£æ§ãäžæã®ãªãéçšã®ç¢ºä¿ã«èããå¿ èŠããããŸãã 2çªç®ã®ã±ãŒã¹ã§ã¯ãã€ã³ãã©ã¹ãã©ã¯ãã£ãšåæ£ã¢ããªã±ãŒã·ã§ã³èªäœã®ç®¡çã«ãªã¹ã¯ãçããŸãã
ãã®èšäºã§ã¯ã2GISã§æ°ããã·ã¹ãã ãæ§ç¯ããããã®2çªç®ã®ãªãã·ã§ã³ãéžæããæ¹æ³ãšçç±ãçºçããåé¡ã解決ããæ¹æ³ãããã³ããããåŸãããã¡ãªããã説æããŸãã Amazon S3ãApache KafkaãReactive ExtensionsïŒRxïŒãæçµçãªæŽåæ§ãšGitHubãå³ããçŽæã1ã€ã®æè¡ã¹ã¿ãã¯ã䜿çšãããšã³ãžãã¢ããå¿ èŠãªèŠæš¡ã®ããŒã ãç·šæã§ããªãããšã«ã€ããŠã
åºå管çã·ã¹ãã ãšã¯äœã§ããããªãåºåãå¿ èŠãªã®ã§ããïŒ
2GISã¯ã2GIS補åã®ãŠãŒã¶ãŒã«ããèŠããããããäŒæ¥ã«åºåæ©äŒã販売ããããšã§å©çãäžããŸãã åºå販売ã«ã¯2ã€ã®èŠçŽ ããããŸããããã¯è²©å£²ããã»ã¹ãã®ãã®ãšåºåã³ã³ãã³ã管çã§ãã ãã®èšäºã§ã¯ã2çªç®ã®ã³ã³ããŒãã³ãã«çŠç¹ãåœãŠãAdvertising Management SystemïŒAMSïŒãšåŒã°ããã·ã¹ãã ã®è©³çŽ°ã®äžéšãæ€èšããŸããããã¯ã2GISã§åºåè³æã管çããããã®ã¢ããªã±ãŒã·ã§ã³ã§ãã
2011幎ã«2GISã§è²©å£²ã·ã¹ãã ãéå§ãããåºå販売ã®éãšå¹æãé«ããããã®æ°ããæ©äŒãéãããŸããã åœæãåºåã³ã³ãã³ãã®çš®é¡ã¯ããã»ã©å€ããªãã£ããããåºåè³æ管çã¢ãžã¥ãŒã«ã¯è²©å£²ã·ã¹ãã ã®äžéšã§ããã æéãçµã€ã«ã€ããŠãã¢ãžã¥ãŒã«ã®èŠä»¶ãå¢å ããŸãããæ°ããã¿ã€ãã®ã³ã³ãã³ããç»å Žããã¢ãã¬ãŒã·ã§ã³ããã»ã¹ãéå§ãããå€æŽã®ããéæãªç£æ»ãå¿ èŠã«ãªããŸããã
ããã«ããã2016幎æ«ã«ãåºåã³ã³ãã³ã管çã¢ãžã¥ãŒã«ãåå¥ã®ã·ã¹ãã ã§ããAMSã«åé¢ããããã®æ°ãããããžã§ã¯ããéå§ãããŸãããAMSã§ã¯ãçŸåšã®ãã¹ãŠã®ããŒãºãæåã«è§£æ±ºããéçºã«å¿ èŠãªåºç€ãæ§ç¯ã§ããŸãã
AMSã®äž»ãªç®çã¯ã2GIS補åã§åºåãäœæãã¢ãã¬ãŒããããã³ãªãªãŒã¹ããããã»ã¹ã®èªååãæäŸããããšã§ãã ã·ã¹ãã ã®ãŠãŒã¶ãŒã¯ã2GISã»ãŒã«ã¹ãããŒãžã£ãŒãåºåäž»èªèº«ãããã³2GISã¢ãã¬ãŒã¿ãŒã§ãã AMSã¯ã2GISãååšãããã¹ãŠã®åœã§æ©èœããããã€ãã®èšèªã«ããŒã«ã©ã€ãºãããŠããŸããäž»ãªèšèªã¯ãã·ã¢èªãšè±èªã§ãã AMSãã©ã®ããã«æ©èœããããç解ããããã«ã販ä¿è³æãæ±ãéã®äž»ãªæé ãèŠãŠã¿ãŸãããã
ããäŒç€Ÿã泚ææ°ãå¢ããããšã«ãããšæ³åããŠãã ããã ããšãã°ãæ€çŽ¢çµæã«äŒç€Ÿã®ããŽãšçãã³ã¡ã³ããé 眮ããäŒç€Ÿã®èæ¯è²ãéžæããŠãã«ãŒãã«è¡åãä¿ããã¿ã³ãè¿œå ããããšã«ããããŠãŒã¶ãŒã®æ³šæãåŒãããšãã§ããŸãã ããã¯ãã¹ãŠãåºåäž»ãŸãã¯åœŒã«å²ââãåœãŠãããã»ãŒã«ã¹ãããŒãžã£ãŒã«ãã£ãŠè¡ãããŸãã ããã«ãåºåè³æã¯ã¢ãã¬ãŒãã®ããã«éä¿¡ãããã¢ãã¬ãŒã¿ãŒã確èªããåŸããã¹ãŠã®2GIS補åã«é ä¿¡ãããŸãã
ã·ã¹ãã ã®äž»ãªç¹åŸŽã¯ãã·ã¹ãã å ã®ãã¹ãŠã®ããŒã¿ãããŒãžã§ã³ç®¡çãããŠããããšã§ãã ããã¯ãããã¹ããŸãã¯ãã€ããªããŒã¿ã«é¢ä¿ãªããåºåã³ã³ãã³ãã®å€æŽã¯ãåºåçŽ æã®æ°ããããŒãžã§ã³ã以åã®ããŒãžã§ã³ã®ãé£ã«ãäœæããããšããäºå®ã«ã€ãªããããšãæå³ããŸãã ããã«ããã誰ãããã€ãã©ã®ãããªå€æŽãå ããããªã©ãåžžã«å®å šãªæ å ±ãåŸãããšãã§ããŸãã ããã¯æ³åŸã®èŠ³ç¹ããéåžžã«éèŠã§ãã ãã®åé¡ã解決ããããã«ãåºåçŽ æãæ§æããããŒã¿ããããã«ããŒãžã§ã³ç®¡çã§ããAmazon S3äºæã¹ãã¬ãŒãžã«ä¿åããããšã«ããŸããã
ããã§ããã·ã¹ãã ãå¹æçã«èšèšããããã«ã¯ãç¹å®ã®ãµããžã§ã¯ãé åã®èŠ³ç¹ããæ©èœãããããŒã¿ã¹ãã¬ãŒãžã¬ã€ã€ãŒã®æ確ã§ç解å¯èœãªAPIãå¿ èŠã§ãã ããã¯ãã¹ãã¬ãŒãžAPIã®CRUD S3ã¹ãã¬ãŒãžAPIãåºåçŽ æãã€ãŸãå³å¯ã«å®çŸ©ãããæ§é ã®ãªããžã§ã¯ãã«é©åããããå éšã¹ãã¬ãŒãžAPIã®ç»å Žã§ãã ãã®ã¹ãã¬ãŒãžAPIã«ã¯ç¬èªã®åå-VStoreïŒVersioned StorageïŒãããããã®éçºã¯GitHubã§å ¬ç¶ãšè¡ãããŠããŸã ã
åœåãVStoreã¯éåžžã«ã·ã³ãã«ãªRESTãµãŒãã¹ãšããŠèããããŠããŸããããéçºããã»ã¹äžã«ããã®ã¬ãã«ã§ä»ã®ã¿ã¹ã¯ã解決ããå¿ èŠãããããšãæããã«ãªããŸããã ããšãã°ããã€ããªã³ã³ãã³ãã®ãã©ã³ã¹ã³ãŒãã£ã³ã°ãšé åžããŸãã¯æªäœ¿çšããŒã¿ã®åé€ïŒããŽãåŠçãïŒã ããããããã«ã€ããŠã¯åŸã§ã
S3ã§ã¯ããŒã¿ãå®å šã«ä¿åã§ããŸãããå¹æçãªæ€çŽ¢ã¯ãšãªãå®è¡ããããšã¯ã§ããŸããã ãã®ããããã®ãããžã§ã¯ãã§ã¯ãæ€çŽ¢ã¹ã¯ãªããã®åºåè³æã«é¢ããã¡ã¿ããŒã¿ãšãæ¬æ Œçãªããžãã¹ã±ãŒã¹ã®å®è£ ã«å¿ èŠãªããŒã¿ãå«ãã䜿ãæ £ããSQLããŒã¿ããŒã¹ãå°å ¥ããŸããã
ãããžã§ã¯ãã®éå§æã«ã¯ãå¥ã®åé¡ã解決ããå¿ èŠããããŸããããã®æç¹ã§ã¯ã1ã€ã®æè¡ã¹ã¿ãã¯ã䜿çšããŠãšã³ãžãã¢ããå¿ èŠãªèŠæš¡ã®ããŒã ãç·šæããæ©äŒããããŸããã§ããã ãããŠãç· ãåãã¯ãã€ãã®ããã«éåžžã«å³ããã£ãã
ãããã£ãŠãããŒã ãããŸããŸãªãäžçãããéããã·ã¹ãã ã¯ããŸããŸãªããã°ã©ãã³ã°èšèªã䜿çšããŠèšè¿°ã§ããDockerã³ã³ããã§å®è¡ã§ããåé¢ã¢ãžã¥ãŒã«ã®ã»ãããšããŠèšèšãããŸããã Kubernetesã2GISã§ç©æ¥µçã«éçšããå§ããã®ã¯éåžžã«å¹žéã§ããã ããã§ããã€ã¯ããµãŒãã¹ã®éã«çæããŸããã
AMSã€ã³ãã©ã¹ãã©ã¯ãã£
çŸåšãAMSã¯4ã€ã®å€§ããªã¢ãžã¥ãŒã«ã§æ§æãããŠããŸãã
- VStoreã¯ãå³å¯ã«å®çŸ©ãããæ§é ã®ãªããžã§ã¯ãã®ããŒãžã§ã³ä»ãã¹ãã¬ãŒãžã®åé¡ã解決ããS3ã¹ãã¬ãŒãžãå®å šã«æœè±¡åããŠãå¯èœãªéãå¹ççã«çžäºäœçšããŸãã ãã®ã¬ãã«ã§ã¯ãæ§æãããã«ãŒã«ïŒããã¹ãå ã®æåæ°ãããããããç»åã®ãµã€ãºãšåœ¢åŒããã¯ã¿ãŒã°ã©ãã£ãã¯ã¹ã®æ€èšŒãªã©ïŒã®éµå®ã«ã€ããŠãåºåçŽ æã®ã³ã³ãã³ããç£èŠãããŸãã ã³ã³ãã³ãã®é ä¿¡ã¯ãã¹ãŠVStoreã®è²¬ä»»ã§ãã
- AMS APIã¯åºæ¬çã«ã·ã¹ãã å šäœã®ããã¯ãšã³ãã§ãã AMS APIã¯ãVStoreã䜿çšããŠãããã¢ãŒã·ã§ã³ããŒã¿ã®äœæãŸãã¯ç·šéãå¿ èŠãšããã±ãŒã¹ãå®è¡ããŸãïŒãã€ããªããŒã¿ã®æäœãå«ãïŒã AMS APIã¯ãåºåè³æã«é¢ãããã¹ãŠã®ã¡ã¿æ å ±ããªã¬ãŒã·ã§ãã«ããŒã¿ããŒã¹ã«ä¿åããŸãã ããã³ããšã³ãAMSã¯ãäŒç€Ÿã®ä»ã®ã·ã¹ãã ãšåæ§ã«ãAMS APIãšå¯Ÿè©±ããŸãã
- ããã³ããšã³ãAMSã¯ãããã¢ãŒã·ã§ã³è³æã䜿çšããŠãã¹ãŠã®ãŠãŒã¶ãŒã±ãŒã¹ãå®è¡ããããã®UIã¢ããªã±ãŒã·ã§ã³ã§ãã 2GISã»ãŒã«ã¹ãããŒãžã£ãŒãšåºåäž»ãä»äºã§äœ¿çšããã®ã¯ãã®ã¢ããªã±ãŒã·ã§ã³ã§ãã
- AMS管çããã«ã¯ãåºçç©ã®çš®é¡ãšèšèªã«å¿ããŠãåºåè³æã®ã³ã³ãã³ãã«é¢ããã«ãŒã«ãšå¶éãèšå®ããããã«å¿ èŠã§ãã ãããã®ã«ãŒã«ã¯ãåºåã衚瀺ããã2GIS補åã«ãã£ãŠæ±ºãŸããŸãã
ãããã®ã¢ãžã¥ãŒã«ã¯ãç¬ç«ãããªããžããªã®ç°ãªãèšèªã§ç¬ç«ããŠå®è£ ãããŸãã ãã¹ãŠã®å¯Ÿè©±å¥çŽã¯æ éã«åæãããŠãããããéçºã¯äžŠè¡ããŠå¹ççã«è¡ãããŸãã ãããã®åã¢ãžã¥ãŒã«ã¯ãKubernetesã«ãã£ãŠçæããã1ã€ä»¥äžã®Dockerã³ã³ãããŒãšããŠå®è¡ãããŸãã
äžè¬ã«ãKubernetesã¯äžè¬çãª2GISãã©ãããã©ãŒã ã®äžéšã®1ã€ã§ãããå瀟ã®ãµãŒãã¹ã®å€ããéçšãããŠããŸãã ãã®ãã©ãããã©ãŒã ã«ã¯ãELKã§æ§ç¯ãããçµ±åãã°ã€ã³ãã©ã¹ãã©ã¯ãã£ãšãPrometheusã䜿çšããç£èŠãµãŒãã¹ã®ãã¹ãŠã®æ©èœãå«ãŸããŠããŸãã ã·ã³ãã«ã§äŸ¿å©ãªã¢ããªã±ãŒã·ã§ã³ã®æ§ç¯ãšå±éã®ããã«ãäŒç€Ÿã¯ç¹å¥ã«æ§æãããå éšGitLabã䜿çšããŠããŸãã ãã®ãã¹ãŠãäœæãããçç±ãšæ¹æ³ã«ã€ããŠã¯ã ãã®èšäºããèªã¿ãã ãã ã
ãã¹ãŠã®AMSã³ã³ããŒãã³ãã®ã¢ã»ã³ããªããã»ã¹ãšããã¹ãŠã®2GISããŒã¿ã»ã³ã¿ãŒãžã®å±éãèªååãããŠããŸãã ã¢ãžã¥ãŒã«ã«ã¯ãä»ã®ã³ã³ããŒãã³ãã®ããŒãžã§ã³ãšäžè²«æ§ã®ããç¬èªã®ãªãªãŒã¹ãµã€ã¯ã«ãšããŒãžã§ã³ããããŸãã ããã«ãããæ°åã§éé¢ããããã¹ããã³ããäžããŠãã·ã¹ãã ã®ä»»æã®éšåã®å€æŽã確èªããããã¹ããŒãžã³ã°ãå®çšŒåã§ã¢ããªã±ãŒã·ã§ã³ãå±éãããã§ããŸãã DevDayã®ã¬ããŒãèšé²ãèŠããšããããã©ã®ããã«é 眮ãããŠãããã«ã€ããŠè©³ããç¥ãããšãã§ããŸãã
èŠç¹ãã€ãã
ãã¡ããããã€ã¯ããµãŒãã¹ãšæ¥ç¶æ§ã®äœãã¯åªããŠããŸããåé¢ãè€æ°ã®èšèªã§ã®äžŠè¡éçºãå€æŽç®¡çã®å®¹æãã§ãã ãã ãããã®ã¢ããªã±ãŒã·ã§ã³ã®æ§ææ¹æ³ã§ã¯ãå€ãã®ã¢ãŒããã¯ãã£äžã®åé¡ã解決ããå¿ èŠããããŸãã ãããŠãæåã®ãã®ã¯ã³ã³ããŒãã³ãéã®éä¿¡ã§ãã
ããŒã¿ã転éããã«ã¯ãåæçãšéåæçã®2ã€ã®æ¹æ³ããããŸãã æåã®ã±ãŒã¹ã§ã¯ãç¹å®ã®ãšã³ããã€ã³ãã«ãªã¯ãšã¹ããéä¿¡ããŸãã èŠæ±ã¯ãå¿çãå°çããããåŸ æ©æéãçµéãããŸã§ãããã¯ãããŸãã ãã®ã¡ãœããã䜿çšãããšãã¢ã¯ã·ã§ã³ã®ç¢ºèªãšæäœã®çµæãå¿ èŠãªã±ãŒã¹ãå®è£ ã§ããŸãã 2çªç®ã®æ¹æ³ã¯ãã¡ãã»ãŒãžã®éåä¿¡ãã€ãŸããããã¥ãŒãµãŒ/ã³ã³ã·ã¥ãŒããŒãã¿ãŒã³ã®å®è£ ã§ãã
å®éã«ã¯ããããã®æ¹æ³ã®äž¡æ¹ãäžç·ã«äœ¿çšããå¿ èŠããããŸãã ãã®ãããåæã®å Žåã«ã¯HTTPãããã³ã«ãšRESTãµãŒãã¹ã䜿çšããã¡ãã»ãŒãžã³ã°å šäœãApache Kafkaã§æ§ç¯ãããŸãã
AMSã®åºæ¬çãªã±ãŒã¹-ããã¢ãŒã·ã§ã³è³æã®äœæãæ€èšããŠãã ããã åºåçŽ æã¯äžé£ã®ç°ãªãèŠçŽ ã§æ§æããããã®å 容ã¯ããã¹ããŸãã¯ãã€ããªã®ããããã§ããããšã«æ³šæããŠãã ããã ãããã£ãŠã販ä¿è³æãäœæããã«ã¯ã次ã®ãã®ãå¿ èŠã§ãã
- èŠçŽ ã®ã¿ã€ããšæ°ã決å®ããŸãã
- ãã€ããªã³ã³ãã³ããæã€èŠçŽ ãããå Žåã¯ããã€ããªãã¡ã€ã«ãããŠã³ããŒãããããã®æéå¶éã®ããã»ãã·ã§ã³ãäœæããå¿ èŠããããŸãã
- åºåçŽ æã®ãããã¿ã€ããã¯ã©ã€ã¢ã³ãåŽã«è»¢éããŠãUIãæç»ããŸãã
- ãã€ããªã³ã³ãã³ããããŠã³ããŒããããšãã¯ãããã確èªããŠïŒç»åã®ã¿ã€ããšãµã€ãºãã¢ã«ãã¡ãã£ãã«ã®ååšïŒãã¯ã©ã€ã¢ã³ãã«ãªã³ã¯ãè¿ãå¿ èŠããããŸãã æ€èšŒã倱æããå ŽåãããŠã³ããŒããããã¡ã€ã«ãåé€ããŸãã
- å¿ èŠãªãã¹ãŠã®å€ãå ¥åãããæ°ããåºåçŽ æããµãŒããŒã«éä¿¡ãããå Žåããã¹ãŠã®ããã¹ãå€ïŒãã€ããŒããã¹ãããã¹ãŠã®åèªããã³ååèªã®æåæ°ãåèªæ°ãªã©ïŒã確èªããå¿ èŠããããŸãã
- ãã¹ãŠã®ãã§ãã¯ã«åæ ŒããããVStoreã䜿çšããŠããŒãžã§ã³ç®¡çããããªããžããªã«åºåè³æãäœæãããªã¬ãŒã·ã§ãã«ããŒã¿ããŒã¹ã«ã¡ã¿æ å ±ïŒååãäŒç€Ÿãžã®ãªã³ã¯ãã¢ãã¬ãŒã·ã§ã³ã¹ããŒã¿ã¹ïŒãä¿åããå¿ èŠããããŸãã
ããã§äœãããŸããããªãã®ã§ããããïŒ åæ£ã¢ããªã±ãŒã·ã§ã³ã®å Žå-ããããã
ã±ãŒã¹èªäœã®åæãåå ã§RESTãµãŒãã¹ã®ããããã䜿çšã§ããªãå Žåãåºåè³æã¯äœæãããŸããã ãããããŸã 埮åŠãªéãããããŸãã
AMS APIãPOSTãªã¯ãšã¹ããéä¿¡ããŠVStoreãä»ããŠãªããžã§ã¯ããäœæããç¶æ³ãæ³åããŠãã ããã VStoreã¯ãå¿çãéä¿¡ããããšã§æ£åžžã«åŠçããŸãã ãã¹ãŠã®æåã«ãããããããããšãã°ãããã¯ãŒã¯ã®ãç¹æ» ããåå ã§ããã®åçãAMS APIã«å±ããªãå¯èœæ§ããããŸãã ããã§äœïŒ 次ã«ãAMS APIã¯ãªããžã§ã¯ããäœæãããŠããªãããšãèæ ®ãããŠãŒã¶ãŒã«ãã®ããšãéç¥ããŸãïŒç°¡åã«ããããã«ãåè©Šè¡ãµã€ã¯ã«ã¯ãªããšä»®å®ããŸãïŒã ãã ãããã®ãªããžã§ã¯ããå床äœæããããšãããšãããã«ãäœæãããïŒæ°ããèå¥åãçæããå ŽåïŒããªããžã§ã¯ããæ¢ã«ååšãããããäœæãå®äºã§ããŸããã ã©ã¡ãã®å Žåãããªããžããªã®äžäžèŽãçºçããŸãã
å¥ã®ããªãããŒãªã±ãŒã¹
ãœãªã¥ãŒã·ã§ã³ã®èª¬æã«é²ãåã«ãå¥ã®ãã€ã³ããèŠãŠãã ããã
ããã¢ãŒã·ã§ã³è³æãäœæãããšããŸãããã ãã€ããªã³ã³ãã³ããããŠã³ããŒãããããã®ã»ãã·ã§ã³ãæºåãããŠãŒã¶ãŒãåçãã¢ããããŒãã§ããããã«ããŸããã äºåã«ãã¹ãŠã確èªããåŸããªããžããªã«ããŒãããç¹å®ã®ããŒïŒãªã³ã¯ïŒãè¿ããŸãã
ãããããŠãŒã¶ãŒãããŠã³ããŒãããç»åãã©ã®ããã«èŠãããæ°ã«å ¥ãããå¥ã®ïŒãŸãã¯3çªç®ã4çªç®ïŒãã¢ããããŒãããå Žåã¯ã©ããªããŸããïŒ å®éãæåŸã«ã¢ããããŒããããç»åã®ã¿ãåºåçŽ æã®äžéšã«ãªããæ®ãã¯ãã¹ãŠäœ¿çšãããŸããã
ãããããŠãŒã¶ãŒããã¹ãŠã®æäœãè¡ã£ãåŸãåºåçŽ æããŸã£ããäœæããªãããšã決ããŠããããå»ã£ãå Žåã¯ã©ãã§ããããïŒ ããŠã³ããŒããããã¹ãŠã®ãã€ããªã³ã³ãã³ãã¯ãåé€ãããŽãã«ãªããŸããã
ä¿èšŒãããå¹ççãªæ¹æ³
éã®åŒŸäžž
ãã®èšäºã§ã¯ãããã€ã¯ããµãŒãã¹ããšããçšèªãæ°å䜿çšããŸãããããã«ãããã¢ããã¥ã¢ã®éã§çšèªã«ã€ããŠè°è«ããåççãªdigããçããå¯èœæ§ããããŸãã å®éããã€ã¯ããµãŒãã¹ã¯å€ãã®å Žåãå®å šã«ç¬ç«ããå°ããªã¢ããªã±ãŒã·ã§ã³ã®ã»ãããšåŒã°ãããããããçžäºäœçšã®ããã®ç¬èªã®å¥çŽããµããžã§ã¯ãé åã®ã¢ãã«ãããã³ç¬èªã®ããŒã¿ãŠã§ã¢ããŠã¹ãæã£ãŠããŸãã ãã®å Žåããã¹ãŠã®ããã¯ãšã³ããµãŒãã¹ã¯å ±æãªããžããªã䜿çšããŸãã
äœããã®åœ¢ã§ããã®å Žåã«ãããã€ã¯ããµãŒãã¹ããšããçšèªã䜿çšã§ãã1ã€ã®ãã¡ã€ã³ã¢ãã«ãååšãããšè«ççã«å ±æãªããžããªã䜿çšããããšèããŠããŸãã ãã®ããã1ã€ã®ã³ã¢ãã¡ã€ã³ã¢ãã«ãããã°ããããããŸããŸãªã³ã³ããŒãã³ãã§åå©çšã§ãããããããŒã¿ã®ä¿åãšèªã¿åãã®ããžãã¯ãåå©çšã§ããŸãã åºæ¬ãã¡ã€ã³ã¢ãã«ã®å€æŽã¯ãã¢ããªã±ãŒã·ã§ã³ã®ãã¹ãŠã®éšåã®ããžãã¹ããžãã¯ã«å¿ ç¶çã«åœ±é¿ãããããããã¯éåžžã«åççã§ãã ããã§ã®äž»ãªããšã¯ãã¢ããªã±ãŒã·ã§ã³ã®å¢çãšè²¬ä»»ãæ£ãã決å®ããã³ã¢ãã¡ã€ã³ã¢ãã«ãæ£ããéžæããããšã§ãã
ããããããŒãžã§ã³ç®¡çãããã¹ãã¬ãŒãžïŒS3ïŒãšã¡ãã»ãŒãžã³ã°ã€ã³ãã©ã¹ãã©ã¯ãã£ïŒApache KafkaïŒã®2ã€ã®ããŒã«ã«åºã¥ããŠãããŒã¿ã®èª¿åã®åé¡ã®ã»ãšãã©ã解決ããæ¹æ³ãèŠãŠã¿ãŸãããã
å°ãåºãèŠããšãããŒã¿ã®ããŒãžã§ã³ç®¡çãäžå€ããããã£ã®å®è£ ã®1ã€ã§ããããšãããããŸãã ãã®ããããã£ãæã¡ãããŒãžã§ã³/ã¡ãã»ãŒãžã®é åºãä¿èšŒããããšã§ããã€ã§ãããŒã¿ãæçµçã«åæãããã·ã¹ãã ãæ§ç¯ã§ããŸãïŒ çµææŽåæ§ ïŒã
åºåçŽ æãäœæããã±ãŒã¹ã®å®è£ ãå°ãå€æŽããŠãããã€ãã®å¯äœçšãè¿œå ããŸãïŒå€æŽã¯å€ªåã§åŒ·èª¿è¡šç€ºãããŠããŸãïŒã
- èŠçŽ ã®ã¿ã€ããšæ°ã決å®ããŸãã
- ãã€ããªã³ã³ãã³ããæã€èŠçŽ ãããå Žåã¯ãã»ãã·ã§ã³ãäœæãããã€ããªãã¡ã€ã«ãããŠã³ããŒãããããã®æéå¶éã®ããã»ãã·ã§ã³ãäœæããããšããè©Šã¿ã«ã€ããŠã¡ãã»ãŒãžãéä¿¡ããå¿ èŠããããŸãã
- åºåçŽ æã®ãããã¿ã€ããã¯ã©ã€ã¢ã³ãåŽã«è»¢éããŠãUIãæç»ããŸãã
- ãã€ããªã³ã³ãã³ããããŠã³ããŒããããšãã¯ãããã確èªãïŒç»åã®ã¿ã€ããšãµã€ãºãã¢ã«ãã¡ãã£ãã«ã®ååšãªã©ïŒã ç¹å®ã®ããŒãæã€ãã¡ã€ã«ãããŠã³ããŒãããããšããã¡ãã»ãŒãžãéä¿¡ããã¯ã©ã€ã¢ã³ãã«ãªã³ã¯ãè¿ãå¿ èŠããããŸãã ãã§ãã¯ã«åæ Œããå Žåã¯ãããŠã³ããŒããããã¡ã€ã«ãåé€ããã¡ãã»ãŒãžãéä¿¡ããªãã§ãã ãã ã
- å¿ èŠãªãã¹ãŠã®å€ãå ¥åãããæ°ããåºåçŽ æããµãŒããŒã«éä¿¡ãããå Žåããã¹ãŠã®ããã¹ãå€ïŒãã€ããŒããã¹ãããã¹ãŠã®åèªããã³ååèªã®æåæ°ãåèªæ°ãªã©ïŒã確èªããå¿ èŠããããŸãã
- ãã¹ãŠã®ãã§ãã¯ã«åæ Œããããç¹å®ã®ããŒã䜿çšããŠãªããžã§ã¯ããäœæããè©Šã¿ã«é¢ããã¡ãã»ãŒãžãéä¿¡ãã VStoreã䜿çšããŠããŒãžã§ã³ç®¡çããããªããžããªã«åºåçŽ æãäœæããã¡ã¿æ å ±ïŒååãäŒç€Ÿãžã®ãªã³ã¯ãã¢ãã¬ãŒã·ã§ã³ã¹ããŒã¿ã¹ïŒããªã¬ãŒã·ã§ãã«ããŒã¿ããŒã¹ã«ä¿åããå¿ èŠããããŸãã
ãããã£ãŠãããŒã¿ã®å€æŽãšãšãã«ãã€ãã³ããçºçããé åºã§ã€ãã³ããéä¿¡ããŸãã ããã§ãèšå€§ãªæ°ã®ã·ããªãªãå®è£ ããããšãã§ããŸãã ããã«ãåå¥ã®ããã¯ã°ã©ãŠã³ãããã»ã¹ãšããŠå®è¡ãããåããã€ã¯ããµãŒãã¹ã®å©ããåããŠããããã®å®è£ ãäºãã«å®å šã«ç¬ç«ãããããšãã§ããŸãã
ããã§ããªããžããªå ã®ããŒã¿ã®äžè²«æ§ã®åé¡ã¯æ¯èŒçç°¡åã«è§£æ±ºãããŸããããã¯ã°ã©ãŠã³ãããã»ã¹ã¯ããªããžã§ã¯ããäœæããããšããã€ãã³ããåãåãããªããžã§ã¯ããäœæããããã©ããã確èªããSQLãªããžããªã«ååšãããã©ããã確èªããŸãã äžèšã®åæã®ã±ãŒã¹ãäŸç¶ãšããŠå€±æããå Žåãéåæã«ä¿®æ£ãããŸãã ã·ã¹ãã ã®äžè²«æ§ã倱ãããæéééã¯çãã»ã©ãApache Kafkaã§å¹ççã«äœæ¥ã§ããŸãã ãããŠãããã§äºåŸå¯Ÿå¿çãªã¢ãããŒãã圹ç«ã¡ãŸãã
Kafkaã§åãã¡ãã»ãŒãžã䜿çšããŠãæªäœ¿çšã®ãã€ããªãã¡ã€ã«ãå¹æçã«ã¯ãªãŒã³ã¢ããããæ¹æ³ãèŠãŠã¿ãŸãããã ãã¹ãŠãã·ã³ãã«ã§ãã
å¥ã®ããã¯ã°ã©ãŠã³ããã€ã¯ããµãŒãã¹ãäœæããããã»ãã·ã§ã³äœæã®äºå®ã«é¢ããã¡ãã»ãŒãžãé çªã«ç§»åã§ããŸãã ã»ãã·ã§ã³ãçµäºãããšããã«æ°ãããã¡ã€ã«ãã¢ããããŒãã§ããªãããããã®ã»ãã·ã§ã³ã®ãã¡ã€ã«ãåç §ãããªããžã§ã¯ããã»ãã·ã§ã³ã¢ã¯ãã£ããã£äžã«äœæãŸãã¯å€æŽããããã©ããã確èªããå¿ èŠããããŸãã Kafkaã¯æéééãæäœããããã®APIãæäŸããŸãïŒKafkaã®ãã¹ãŠã®ã¡ãã»ãŒãžã«ã¯ã¿ã€ã ã¹ã¿ã³ããããããïŒãããã¯ç°¡åã§ãã ã©ã®ãã¡ã€ã«ãåç §ãããŠããªãããšãããã£ãå Žåããã¹ãŠã®ãã¡ã€ã«ãå«ãã»ãã·ã§ã³å šäœãåé€ã§ããŸãã ãã以å€ã®å Žåã¯ãæªäœ¿çšã®ãã¡ã€ã«ã®ã¿ãåé€ããŸãã
ã¢ããªã±ãŒã·ã§ã³ã¢ãŒããã¯ãã£ãèšè¿°ãããŠããããããŠãŒã¶ãŒãžã®éç¥ã®éä¿¡ããã·ã¹ãã å ã®ã€ãã³ãã«åºã¥ãè€éãªåæã¢ãã«ã®æ§ç¯ãŸã§ããŸã£ããç°ãªãã·ããªãªãå®è£ ããã®ã¯éåžžã«ç°¡åã§ãã å¿ èŠãªã®ã¯ãå¥ã®ããã¯ã°ã©ãŠã³ãããã»ã¹ãéå§ããããšã ãã§ãã ãŸãã¯ãäžèŠãªå Žåã¯ç¡å¹ã«ããŸãã
察åŠçã¢ãããŒã
ããã¯äœã§ããããã®ãã©ãã€ã ã¯ãApache Kafkaãšå¹æçã«é£æºããã®ã«ã©ã®ããã«åœ¹ç«ã¡ãŸããïŒ æ£ããããŸãããã äž»ãªã¢ã€ãã¢ãç解ããããã«ã ãªã¢ã¯ãã£ããããã§ã¹ã ïŒ ç¿»èš³ ïŒããåŒçšããŸãã
ããªã¢ã¯ãã£ãã·ã¹ãã ãšããŠæ§ç¯ãããã·ã¹ãã ã¯ãããæè»ã§ççµåã§ã¹ã±ãŒã©ãã«ã§ãã ããã«ãããéçºã容æã«ãªããå€æŽãåãå ¥ãããããªããŸãã ãããã¯é害ã«å¯ŸããŠéåžžã«å¯å®¹ã§ããã é害ãçºçããŠããçœå®³ã§ã¯ãªãåªé ã«å¯Ÿå¿ããŸãã ãªã¢ã¯ãã£ãã·ã¹ãã ã¯å¿çæ§ãé«ãã ãŠãŒã¶ãŒã«å¹æçãªã€ã³ã¿ã©ã¯ãã£ããã£ãŒãããã¯ãæäŸããŸãã
ç§ãã¡ã®åã®èª²é¡ã®æèã§ã¯ããé«å¿çæ§ãããã³ãå¹æçãªã€ã³ã¿ã©ã¯ãã£ããã£ãŒãããã¯ããšããèšèã«ç¹ã«éç¹ã眮ãå¿ èŠããããŸãã äž»ãªãã€ã³ãã¯ãäºåŸå¯Ÿå¿ã¢ãããŒãã䜿çšãããšãå³åº§ã«å¿çããã¡ãã»ãŒãžã®åä¿¡ãšåŠçã®é 延ãæå°éã«æãããããªæ¹æ³ã§ã·ã¹ãã ãæ§ç¯ã§ããããšã§ãã
åå¿äž»çŸ©ã䜿çšããã·ã¹ãã ã®å®è£ ãæ¯æŽããããŒã«ãããã€ããããŸãã .NETã®å®è£ ã§ã¯ã Reactive Extensionsã䜿çšããŸããã ãã®ã©ã€ãã©ãªã®äžå¿ã«ããã®ã¯ã芳å¯å¯èœãªã·ãŒã±ã³ã¹ã®æŠå¿µãã€ãŸãããµãã¹ã¯ã©ã€ããŒã«æ°ããèŠçŽ ã®åºçŸãéç¥ããã³ã¬ã¯ã·ã§ã³ã§ãã ãã®ãããªã³ã¬ã¯ã·ã§ã³ãæã€Rx.NETã䜿çšãããšãããããçš®é¡ã®æäœã䜿çšããŠã¡ãã»ãŒãžåŠçãã€ãã©ã€ã³ãæ§ç¯ã§ããŸããæãåçŽãªæäœã¯ããã£ã«ã¿ãªã³ã°ãæ圱ãã°ã«ãŒãåããããã¡ãªã³ã°ãªã©ã§ãã
ã«ãã«ãšRxãåéã«ããæ¹æ³ã¯ïŒ ãšãŠãç°¡åã§ãã Kafkaã䜿çšããããã®ã¯ã©ã€ã¢ã³ãã©ã€ãã©ãªAPIã§ã¯ãæ°ããã¡ãã»ãŒãžã衚瀺ããããšãã«åŒã³åºãããé¢æ°ïŒ.NETã§ã¯ãããã€ãã³ãã®ãµãã¹ã¯ãªãã·ã§ã³ã§ãïŒãšã Poll
ã¡ãœããã®åšæçãªåŒã³åºããã¯ã©ã€ã¢ã³ããæå®ããå¿
èŠããããŸãã Rx.NETã«ã¯ããã®ã¿ã€ãã®APIããObservable
移è¡ããããã®ç¹å¥Observable.FromEventPattern
ã¡ãœããããããŸãã ããã§ã¯ãå®éã®è£œåã³ãŒããèŠãããšãã§ããŸãã
ãããã£ãŠãRx.NETã䜿çšãããšãApache Kafkaãšã¢ããªã±ãŒã·ã§ã³ãéåžžã«ã·ãŒã ã¬ã¹ã«çµ±åããªãããé«æ§èœãäœã¬ã€ãã³ã·ã éåžžã«ã·ã³ãã«ã§èªã¿ãããã³ãŒããååŸã§ããŸã ã
ãããã«
åæ£ã¢ããªã±ãŒã·ã§ã³ã¯ç°¡åã§ã¯ãããŸããã AMSããã«ãã³ã³ããŒãã³ãã«ããçç±ããªããã°ããããããå€å žçãªãã¢ãŒããã¯ãã£ã®éããã©ãã§ãããã
å¿ èŠãªãœãªã¥ãŒã·ã§ã³ãæ§ç¯ããã«ã¯ã次ã®ããšãæãåºãããŠãã ããã
- ããŒã¿ã®å¹ççãªããŒãžã§ã³ç®¡çããµããŒãããŸãã
- ããŸããŸãªæè¡ã¹ã¿ãã¯ã§éçºããªãŒããããšåæã«ãããŒã å ã§çžäºç解ãæ·±ããã
- ãªãªãŒã¹ãµã€ã¯ã«ãéåžžã«çãã1æ¥æ°åãéçšç°å¢ã§å€æŽãå±éããŸãã
- åã ã®ãµãŒãã¹ãæ¯èŒçåçŽã§åé¢ãããŠããããããã¹ãã®åçŽããä¿èšŒããŸãã
- ãã©ãŒã«ããã¬ã©ã³ã¹ãšã¹ã±ãŒãªã³ã°ã®å®¹æããæäŸããããã«ã¢ããªã±ãŒã·ã§ã³ãèšèšããŸãã
ããã«ããããžã§ã¯ãã®éå§æã«ã次ã®ããšãè¡ããŸããã
- Kubernetesã«åºã¥ããäœæ¥ã¢ããªã±ãŒã·ã§ã³çšã®ãã©ãããã©ãŒã ã
- é©åã«æ§æããããµããŒããããŠããApache Kafkaã¯ã©ã¹ã¿ãŒã
- ããã¯ãšã³ãã®éçºã«ãããè±å¯ãªçµéšã«ãããæè¡çãªã¹ã¯ã®ç®¡çãå¯èœã«ãªããŸããã
çŸåšã1ç§ããã50ã70ã®httpèŠæ±ïŒRPSïŒãããã1ç§ãããã®Kafkaãä»ããŠéä¿¡ãããã¡ãã»ãŒãžã®æ°ã¯æ°çŸåäœã§ãã ãã®è² è·ã¯ãäž»ã«å éšãŠãŒã¶ãŒïŒ2GISåŸæ¥å¡ïŒã«ãã£ãŠæäŸãããŸãã ãããããã®ããã«èšèšãããã¢ããªã±ãŒã·ã§ã³ã¯ãåºåäž»ã®å人ã¢ã«ãŠã³ããéããŠå£²ãäžããå¢ããã2GISãååšãããã¹ãŠã®åœã§å£²ãäžãã䌞ã°ãæºåãããæ©äŒãäžããŠãããŸãã ãã€ã¯ããµãŒãã¹ã¢ãããŒãã®ãããã§ãæ°ããæ©èœãæ¯èŒçç°¡åã«å®è£ ããã¢ããªã±ãŒã·ã§ã³ã®å®å®æ§ã管çã§ããŸãã
VStoreã®æè¡çãªè©³çŽ°ã¯ãtechno.2gis.ruã®ã¬ããŒãã®ãããªé²ç»ã«ãããŸãã
VStoreã³ãŒãã¯ãªãŒãã³ã§ã GitHubã§ç©æ¥µçã«éçºãããŠããŸã ã èŠèŽãã³ã¡ã³ãã質åã