å€ãã®å ŽåãGearmanã¯ãã³ãã«ã®ãªã颚å€ãããªããŒââã«ã®ããã§ããããã¯é¢çœããŠçŸããã§ããããªããããå¿ èŠãªã®ãæ確ã§ã¯ãªãã䜿çšããã®ãèŠçã§ãã
ãã®ç¶æ³ããæãåºãå¿ èŠããããã®ã¢ãã³ã¯æ¬åœã«è¯ãã§ãã
èŠãŠã¿ãŸãããïŒ
- ãæã§ãã®ã¢ãã³
- Gearmanã䜿çšããå®äžçã®äŸ
- Gearmanãã¥ãŒãµãŒããŒã§ã®ãªã¢ã«ã¿ã€ã ç£èŠãšããã»ã¹å¶åŸ¡ã®ããã®Webã¢ããªã±ãŒã·ã§ã³ãšã¯ã©ã¹
é¢çœãïŒ ç«ããé¡ãããŸãã
Gearmanããæã§ãæ©èœããä»çµã¿ã説æã§ããŸããïŒ
ã§ããŸãã
åŽåè ãšã¯äœã§ããïŒ
ããã¯åãªãã³ã³ãœãŒã«ã¹ã¯ãªããã§ãããããã°ã©ãã³ã°èšèªã¯é¢ä¿ãããŸããã ã¹ã¯ãªããã¯åžžã«å®è¡ãããŠãããããŒã¢ã³ã§ãã
èµ·åããããšãã¯ãŒã«ãŒããŒã¢ã³ã¯ãµãŒããŒã«æååãéä¿¡ããŸãâå®è¡å¯èœãªé¢æ°ã®ååããµãŒããŒãžã®ãœã±ãããéããåŸ æ©ããŸãã
ã¯ãŒã«ãŒã¯ã©ã®ããŒã¿ãåãåããŸããïŒ
vorkerã«ã¯2è¡ããããŸãã1è¡ç®ã¯å®è¡ãããã¡ã€ã«ã®ååã2è¡ç®ã¯åŒæ°ã§ãã ç§ãã¡ã¯åŒ·èª¿ããŸãïŒããã€ãã®åŒæ°ãã¯ãŒã«ãŒãé åããªããžã§ã¯ãã«æž¡ãããšã¯äžå¯èœã§ã-æååã®ã¿ãä»ã®ãã¹ãŠã®ã¿ã€ãã®ããŒã¿ãæååã«ãã£ã¹ãããå¿ èŠããããŸã-ã·ãªã¢ã«åãŸãã¯JSONã
å®éãé©ãã¹ãããšã¯ãHTTPãªã©ã®ãããã³ã«ãä»ããããŒã¿ã®éä¿¡å šäœã§ããããã¯æååã®ã¿ã®éä¿¡ã§ããããŸãã
è¡ã¯ã©ãããæ¥ãã®ã-ã¯ãŒã«ãŒã®ã¿ã¹ã¯
ãµãŒããŒã«ã¿ã¹ã¯ãéä¿¡ããGearmanã¯ã©ã€ã¢ã³ãã¯ãå®è¡ããé¢æ°ã®ååãšåŒæ°ãæååãšããŠ2è¡ã ããæž¡ããŸãã ãã®å Žåããã¥ãŒå ã®ã¿ã¹ã¯ã¯é²è¡äžãšããŠããŒã¯ãããŸãã
ããã§ã¯ã次ã¯äœã§ããïŒ
ã¿ã¹ã¯ãããã¯ã°ã©ãŠã³ãã®å Žåãã¯ãŒã«ãŒã¯æ©èœãå®è¡ããå®è¡ä¿¡å·fã®ã¿ããµãŒããŒã«éä¿¡ããŸãã ã¿ã¹ã¯ãããã¯ã°ã©ãŠã³ãã§ãªãå Žåãã¯ãŒã«ãŒã¯Gearmanã«è¡ãéä¿¡ããŸã-fã®å®è¡çµæãšå®è¡ä¿¡å·ã
é²è¡ä¿¡å·ãåä¿¡ãããšãGearmanã¯ã¿ã¹ã¯ãå®äºæžã¿ãšããŠããŒã¯ãããã¥ãŒããåé€ããŸãã
ãããŠãæ©èœãå®è¡ããéçšã§ã¯ãŒã«ãŒãç°åžžã«ã¯ã©ãã·ã¥ããããç·æ¥äºæ ãçºçãããããå Žå-ã€ãŸããæºããããªãã®ã§ããïŒ
ãã®å Žåã®ã®ã¢ãã³ã¯æ£åžžçµäºä¿¡å·ãåä¿¡ãããã¿ã¹ã¯ã¯ãã¥ãŒã«æ®ããŸã
顧客ãšã¯äœã§ããïŒ
Gearmanã®ãã¯ã©ã€ã¢ã³ãããšããå¥ã®ã³ã³ã»ãããéžã³åºãããšã¯å°é£ã§ãã PLããGearmanã«é£çµ¡ããŠãããŒã¿ãéåä¿¡ã§ããŸããããã¯ã°ã©ãŠã³ãã§éåä¿¡ã§ããŸãã ãããããŸã ç°¡åã§ãã
ãåä¿¡ãããéä¿¡ãããæ¥ãã-ãµãŒããŒãšã®ããŒã¿äº€æã¯ã©ã®ããã«è¡ãããŸããïŒ PLã«äœã¬ãã«ã®ã¢ããªã³ãå¿ èŠã§ããïŒ
Gearmanãšã®éä¿¡ã¯ãœã±ãããä»ããŠè¡ãããŸãã éåžžãGearmanã䜿çšããããã«PLã«è¿œå ããããšã¯ã§ããŸãããããœã±ãããšTelnetã§å¯Ÿå¿ã§ããŸãã ããšãã°ãPHPã§ã¯ã PECLã¢ããªã³ãèšèªã«ã€ã³ã¹ããŒã«ããããšã§Gearmanãæäœããããè€æ°ã®ã¯ã©ã¹ã®ãã¡ã€ã«ãåçŽã«æ¥ç¶ããŠPearã©ã€ãã©ãªã䜿çšãããã§ããŸãã
ã¯ã©ã€ã¢ã³ãããµãŒããŒã«ã¿ã¹ã¯ãéä¿¡ãããããã®é¢æ°ã®ã¯ãŒã«ãŒããªãå Žåãããã¯ç¡æã§ããããããšããŸã£ãããããŸãããïŒ
ã¿ã¹ã¯ã¯ãã¯ãŒã«ãŒãèŠè¶ããŠããã³ã°ãããŸãã åãæ©èœã«å¯ŸããŠããã«ã¿ã¹ã¯ãæ¥ããšããã¥ãŒã圢æãããŸã-Gearmanãã¥ãŒãµãŒããŒã¯ãã¹ãŠåãã§ãã
åãæ©èœã®ãã¥ãŒãµãŒããŒäžã®2ã€ã®ã¿ã¹ã¯ãåºå¥ããããšã¯å¯èœã§ããïŒ
ãã è°è«ã§ã¯ãããŸããã
ã¿ã¹ã¯ãéä¿¡ããããã¥ãŒãèŠã€ããããšã¯å¯èœã§ããïŒ
åãfçªç®ã®ã¿ã¹ã¯ã¯èŠåããã€ããªãã®ã§ããããã
ãã¥ãŒã«ããã¿ã¹ã¯ã®æ°ã確èªã§ããŸããïŒ
ã¯ã ãŸãããã®ã¿ã¹ã¯ãåŠçã§ããã¯ãŒã«ãŒã®æ°ãšããããã®ã¯ãŒã«ãŒïŒIPïŒãã©ãããæ¥ããã調ã¹ãããšãã§ããŸãã
1ã€ã®ã¿ã¹ã¯ãå°çããè€æ°ã®ã¯ãŒã«ãŒããããå®è¡ã§ãããšæ³åããŠãã ããã 誰ãã¿ã¹ã¯ãååŸããŸããïŒ
ã¿ã¹ã¯ã¯åºå¥ã§ããŸããããåŽåè ãåºå¥ã§ããŸããã ã©ã®Gearmanãäœæ¥è ã«ã¿ã¹ã¯ãäžãããã¯ãçããªãã»ã©åçŽã§ãã ã¯ãŒã«ãŒã®ãã¥ãŒã¯ãããŸããã
ãã¥ãŒãµãŒããŒã«ã¯ã©ã®ãããªçš®é¡ã®ã¿ã¹ã¯ããããŸããïŒ
ã¿ã¹ã¯ã¯ã1ïŒåªå 床ã§ã2ïŒããã¯ã°ã©ãŠã³ãã¿ã¹ã¯ã§ãããã©ããã§åããããŸãã
1ïŒ3ã€ã®åªå 床-éåžžãäœ-éåžžããäœãåªå 床ãããã³é«-éåžžããé«ãåªå 床ã åªå 床ã¯ãã¥ãŒã§èæ ®ãããããã©ã«ãã§ã¯éåžžã®åªå 床ã§ãã
2ïŒããã¯ã°ã©ãŠã³ãã¿ã¹ã¯ã¯ãã¥ãŒãµãŒããŒã«äœãæäŸãããã¯ã©ã€ã¢ã³ãã¯ããŒã¿ãåä¿¡ããŸããã éåžžã®ã¿ã¹ã¯ã¯æååãè¿ãå¿ èŠããããGearmanã¯ã¿ã¹ã¯ã®çµæãšããŠãã®æååãã¯ã©ã€ã¢ã³ãã«è¿ããŸãã
åæã«ããã€ã®ã¯ãŒã«ãŒãå®è¡ã§ããŸããïŒ
ããã§æ確ã«ããå¿ èŠããããŸã-èµ·åããéã§ã¯ãªããã¿ã¹ã¯ãåŠçããããã«Gearmanã«åæã«æ¥ç¶ã§ããã¯ãŒã«ãŒã®æ°ã
çè«çã«ã¯-奜ããªã ãã å®éã«ã¯ãã¯ãŒã«ãŒã®æ倧æ°ã¯ãå€éšãªãœãŒã¹ãžã®åæã¹ã¬ããã®æ倧æ°ãããŒã¿ããŒã¹ãžã®åææ¥ç¶ã®æ°ãããã³Gearmanã«äŸåããªãä»ã®æ¡ä»¶ã«ãã£ãŠå¶éãããŸãã ãããã®è¡ã®äœæè ã¯1å°ã®ãµãŒããŒã§çŽ1000ãå®è¡ããããšãã§ãããã®åŸMySQLãèªãå§ããŸããã
Windowsã§Gearmanã䜿çšããŠPHPã§äœæ¥ã§ããŸããïŒ
質åã¯2ã€ã«åãããŠããŸãã1ïŒWindowsã§Gearmanãã¥ãŒãµãŒããŒèªäœãèµ·åã§ãããã©ããã2ïŒæ¢ã«å€éšãã¹ãã«ãããã¥ãŒãµãŒããŒã§äœæ¥ã§ãããã©ããã
1ïŒ cygwinã䜿çšããŠWindowsã«Gearmanãã€ã³ã¹ããŒã«ãããªãã·ã§ã³ããããŸã
2ïŒå¿«é©ãªäœæ¥ã®ããããã©ãŒã ã®äœ¿ãæ £ããæ§é ã®ã³ãŒãã§äœ¿çšãããã
$worker = new GearmanWorker(); $worker->addServer()
åæ§ã®èšèªã®è¿œå ãå¿ èŠã§ãã ããã¯ããã«å¶éã課ããŸãïŒWindowsã§ãããè¡ãããšãã§ããã ãã§ãªããããã±ãŒãžãã€ã³ã¹ããŒã«ããããšãèš±å¯ãããµãŒããŒãžã®ã¢ã¯ã»ã¹æš©ããªãå Žåããã¹ãã£ã³ã°ã§ãããè¡ãããšã¯ã§ããŸããã
DenwerãšOpenServerã«ã¯ãGearmanãæäœããããã®ã¢ããªã³ãå«ãŸããŠããŸããã
ã ãããåºå£ããªããGearman-* nixã·ã¹ãã ã®ã¿ïŒ
ãããããã¡ããã§ãã 解決ç-Pear Net_Gearmanã©ã€ãã©ãªããããžã§ã¯ãã«æ¥ç¶ãã
ä»ã®ã¯ã©ã¹åãšãããã«ç°ãªãããžãã¯ããããŸããããããçã延ã³ãGearmanã§äœæ¥ããããšã§å®å šã«ã§ããŸãã
Gearmanã䜿çšããå®éã®ã¿ã¹ã¯
1ïŒåºå代çåºã¯ãAdWordsãšYandex.Directã«ä»å±ããŠãããäžèŠæš¡ããã³å€§èŠæš¡ã®ãªã³ã©ã€ã³ã¹ãã¢åãã®åºåãã£ã³ããŒã³ãè¡ã£ãŠããŸãã 補åã«é¢ããæ å ±ã¯çµ¶ããå€åããŠããŸããäŸ¡æ Œã¯å€åããŠããŸãïŒãã«çºæ¿ã¬ãŒããªã©ïŒãæ°ãã補åãç»å Žããäžéšã®è£œåã¯åšåº«ããããäžéšã¯è²©å£²ãçµäºããŠããŸãã ååºèã«ã¯æ°åããæ°äžã®è£œåããããŸãã
ç®çïŒAdWordsãšYandex.Directã®åºåã®æ å ±ãé©åã§ããããšã確èªããïŒäŸ¡æ Œã®å€æŽãæ°è£œåã®åºå/ã°ã«ãŒã/ãã£ã³ããŒã³ã®è¿œå ãåšåº«åãã«ãªã£ãã¢ã€ãã ã®åºåã®åæ¢ã販売ãããªããªã£ãã¢ã€ãã ã®åºåã®åé€ãå¿ èŠã§ãã
ã¿ã¹ã¯ã¯Gearmanã䜿çšããŠç°¡åã«è§£æ±ºã§ããŸããããŒã¿ããŒã¹ããã¿ã¹ã¯ãäœæããŸã-äŸ¡æ Œã®å€æŽãè¿œå ãåæ¢ãåé€ã 次ã«ãã¿ã¹ã¯ããã¥ãŒãµãŒããŒã«ã¹ããŒãããããã§éãã«ããã€ãã®ã¹ã¬ããã«åŠçãããŸããã¯ãŒã«ãŒã¯AdWords APIãŸãã¯Yandex.Direct APIã«ã¢ã¯ã»ã¹ããå¿ èŠãªæäœãå®è¡ããŸãã
次ã®ããã«ãªããŸããã
ããã§Gearmanã¯ãããã»ã¹ã®äžŠåå®è¡ïŒ1åïŒãšå€éšãªãœãŒã¹ãžã®ã¢ã¯ã»ã¹ã®èŠå¶ãšãã2ã€ã®åé¡ã解決ããŸãã
AdWords APIãYandex.Direct APIãããããŒãªã©ã®100ã®æäœãå®è¡ããããšã¯ã§ããŸãã-1ç§ãããã®ãªã¯ãšã¹ãæ°ã«ã¯å¶éããããŸãã ç§ã®å ŽåãAdWords APIã«ã¯æ倧4ã€ã®ã¹ã¬ããããYandex.Direct APIã«ã¯æ倧8ã€ã®ã¹ã¬ãããå²ãåœãŠãŸããã
ã©ã³ã¿ã€ã ã«ã€ããŠã 10,000åã®è£œåã®åæããŒãã«ã¯æ倧æ°æéããããæ°åäžä»¶ã®çºè¡šãæ°çŸä»¶ã®ãã£ã³ããŒã³ãªã©ãäœæãããŸãã
2ïŒã¿ã¹ã¯ã®ç¶ç¶1.ã»ãšãã©ãã¹ãŠã®ã¹ãã¢ã¯ãããŒã¿ãXMLãã¡ã€ã«ãšããŠéä¿¡ããŸãã ãã ãã.xlsãã¡ã€ã«ãéä¿¡ãã人ãããŸãã .xlsãã¡ã€ã«ããããŒã¿ãååŸããã®ã«åé¡ã¯ãããŸãã; PHPExcelããããŸãã ãã ããPHPExcelã«ã¯ãã¥ã¢ã³ã¹ããããŸãã倧ããªãã¡ã€ã«ãåŠçããå ŽåãåŠçé床ã¯å€§å¹ ã«äœäžããŸãããæãéèŠãªããšã¯ãphp.iniã®1024 MB以äžã®å¶éãè¶ ããã¡ã¢ãªãæ¶è²»ããããšã§ãã
PHPExcelã䜿çšããŠXLSãã¡ã€ã«ãåŠçããããã»ã¹ã¯ã䞊ååããããšãã§ããŸãïŒã¢ã€ãã¢ã¯ãã®åºçç©ããåéãããŸãã ã MParshinã«æè¬ããŸã ïŒã ã¯ãŒã«ãŒã¯ãã¡ã€ã«ã1è¡ãã€èªã¿åããåã¯ãŒã«ãŒã¯ãã®è¡ãèªã¿åããããããã»ã¹ã¯äžŠååãããŸãã
ããã§Gearmanã¯2ã€ã®åé¡ã解決ããŸãã1ïŒäžŠååŠçãš2ïŒ1ã€ã®PHPã¹ã¯ãªããã®ã¡ã¢ãªå¶éã®å¶éã®ãã€ãã¹ã
ãã¡ããããã®å Žåããããšãã°1,000人ã®ã¯ãŒã«ãŒãå®è¡ããããšã¯ã§ããŸããããµãŒããŒã®ã¡ã¢ãªãç¡éã§ã¯ãããŸããã ç§ã®å Žåã20ã¹ã¬ããã§XLSãã¡ã€ã«ãåŠçããããšãå€æããŸããã
3ïŒå€§æãã³ããŒ-æ©åšã¡ãŒã«ãŒ-ã¯ããã®æ©åšãå®éã«ååŒãããŠããäŸ¡æ Œãç¥ããããšèããŠããŸãã ã«ã¿ãã°ããããŒã¿ãååŸã§ããŸããããµã€ãããã®ã¿ååŸã§ããŸãã ããã»ã¹ã¯æšæºã§ããããŒãµãŒãè€æ°ã®ã¹ããªãŒã ã®ã¯ãŒã«ãŒãã«ã¿ãã°ãµã€ãããããŒã¿ãåä¿¡ããŸãã
éçºãããGearman Monitor && Controlã·ã¹ãã ã«APIãååšãããããã¯ã©ã€ã¢ã³ãïŒãã³ããŒïŒããªã¢ã«ã¿ã€ã ã§ããŒã¿ãåä¿¡ããããšãå®èšŒã§ããŸãã
ããã§ãGearmanã¯2ã€ã®åé¡ã解決ããŸããããŒã¿ã®äžŠåååŸãšåŠçãããã³ããã»ã¹ã®ãªã¢ã«ã¿ã€ã 衚瀺ã§ãã
ã·ã¹ãã ã®ã¯ã©ã€ã¢ã³ãã€ã³ã¿ãŒãã§ã€ã¹ã¯æ¬¡ã®ãšããã§ãã
4ïŒããã«ã®ãµãŒãã¹ãããã€ããŒãããŒã¿ãæäŸããŸãã ã¿ã¹ã¯ïŒå°å³ã«ããã«ã衚瀺ããŸãã ããŒã¿ã¯åº§æšãšãšãã«æäŸããããããã¿ã¹ã¯ã¯éåžžã«åçŽãªããã§ãã ãã ããæ®å¿µãªãããæäŸããã座æšã®å€ãã¯ééã£ãŠããã顧客ã«è¡šç€ºããããšã¯ã§ããŸãããäœæã¯1ãæã§ãããã«ããŒã«ãŒã¯å¥ã®å Žæã«ãããŸãã ããã«ã®äœæã䜿çšããŠGoogleã®ãžãªã³ãŒããŒã䜿çšããŠããŒã¿ãåå¥ã«åä¿¡ããããšã決å®ãããŸããã ãã ããjavascriptã§ãžãªã³ãŒããŒãåçŽã«åŒã³åºããšãå€ãã®ããŒã«ãŒã衚瀺ãããŸãããjavascriptã¯ãã¹ãŠã®ããã«ã®äœæãåæã«ååŸããããšããŸãããžãªã³ãŒããŒã¯ã1ç§ãããã®ãããæ°ã®å¶éãè¶ ããŠã»ãšãã©ã®ãªã¯ãšã¹ãããããã¯ããŸãã
解決çïŒjavascriptããã®ãã¹ãŠã®ãžãªã³ãŒããŒãªã¯ãšã¹ãã¯ãããã·ã«éä¿¡ããããããã·ã¯ã¿ã¹ã¯ããã¥ãŒãµãŒããŒã«è»¢éããŸãã
ããã§ãGearmanã¯ãå€éšãªãœãŒã¹ïŒGoogleãžãªã³ãŒããŒAPIïŒãžã®ã¢ã¯ã»ã¹ãèŠå¶ããã³å¶éããåé¡ã解決ããŸãã
5ïŒæåŸã®äŸã¯ããã¥ãŒãµãŒããŒã®çµ±å䜿çšã§ãã ãã®ãµã€ãã§ã¯ãæ°åã®ãªããžã§ã¯ãã«é¢ããç¹å®ã®æ å ±ãæäŸããŠããŸãã ã¿ã¹ã¯ïŒãã®æ å ±ãååŸããŠç¿»èš³ããŸãã 解決çïŒæ å ±çšã®ã¯ãŒã«ãŒãšç¿»èš³çšã®ã¯ãŒã«ãŒãç«ã¡äžããŸãã è€æ°ã®ã¹ããªãŒã ã®æåã®ã¯ãŒã«ãŒã¯æ å ±ãåãåããŸããã¯ãŒã«ãŒã¯å¿ èŠãªããã¹ããåä¿¡ãããšããã«ãã¿ã¹ã¯ãåã³ãã¥ãŒãµãŒããŒã«èšå®ããŸããããã¯ç¿»èš³ã¯ãŒã«ãŒã®ã¿ã¹ã¯ã§ãã äœæ¥è ã®ç¿»èš³è ãããã翻蚳ããå®æããè³æãããŒã¿ããŒã¹ã«å ¥ããŸãã
ããã§ã¯GearmanãæšæºãšããŠäœ¿çšãããŸããè€æ°ã®ã¹ããªãŒã ã§æ å ±ãåä¿¡ããã³åŠçããŸãããå¯äžã®åŸ®åŠãªéãã¯ãã¯ãŒã«ãŒèªèº«ãä»ã®ã¯ãŒã«ãŒã®ã¿ã¹ã¯ãèšå®ããããšã§ãã
å®éã®ã¿ã¹ã¯ã«åºã¥ããŠãGearmanå¶åŸ¡ã·ã¹ãã ã®èŠä»¶ãç»å ŽããŸãã
ãã¥ãŒãµãŒããŒã䜿çšããŠãããšæ³åããŠãã ããã 1人ã®ã¯ãŒã«ãŒãå®è¡ããæ¹æ³ã¯ïŒ ã³ã³ãœãŒã«ã«
php worker.php
䞊ååŠçã®ããã«20人ã®ã¯ãŒã«ãŒãå®è¡ããå¿ èŠããããŸãã 20å°ã®ã³ã³ãœãŒã«ãéããŸããïŒ ãªãã·ã§ã³ã§ã¯ãããŸããã ãŸãã¯ãããã€ãã®ç°ãªãã¯ãŒã«ãŒãå®è¡ããå¿ èŠããããŸã-åãåé¡ã§ãã ãã®ãããWebã€ã³ã¿ãŒãã§ã€ã¹ã§ã®ã¯ã©ã¹ã¡ãœãããšå®è£ ãå¿ èŠã§ãã
-åŽåè ã®ç«ã¡äžãããã®éžæãšæ°ã瀺ã
OKãç§ãã¡ã¯ããã«éçºãé²ããŠãããã¯ãŒã«ãŒãç«ã¡äžããŸããã 圌ãæ¢ããæ¹æ³ã¯ïŒ 絶察ã«å¿ èŠ
-åŽåè ãæ¢ãã
ç¶æ³ïŒéçºããã»ã¹äžã«ããã€ãã®ç°ãªãã¯ãŒã«ãŒãèµ·åããŸããã-ããããããŠããã¹ãŠãæ»ã£ãŠããŸããããã©ã¡ãŒã¿ãŒã¯åãã§ã¯ãããŸããïŒ ç§ãã¡ã¯æäŒããŸãïŒ
-1ã€ã®ã¢ã¯ã·ã§ã³ã§ãã¹ãŠã®ã¯ãŒã«ãŒãåæ¢ãã
ããããåŽåè ã¯å°ããªåäŸã®ãããªãã®ã§ãã圌ã¯äœããããäžæçãªããšã¯ç£ç£ãå¿ èŠã§ãã ããã«ã¯ä»¥äžãå¿ èŠã§ãã
-ã¯ãŒã«ãŒã®äœæ¥ã®ãã°
ããã§ããå°ãã åŽåè ãäœãããŠããã®ããèŠãŠãåµé ã楜ããã®ã¯éåžžã«çŽ æŽãããããšã§ãã ããããããã«ç¶æ³ããããŸãïŒåŒ·æ-ãšåŽåè ãé£ã³åºããŸããã ãŸãã¯ããã«è¯ã-ããã¯ãŸã£ããéå§ãããŸããã ãããŠãã©ããªééãïŒ ã³ãŒãã«èª€ããããã®ãââãäŸå€ãåŠçãããŠããªãã®ããå€éšãµãŒãã¹ãããšã©ãŒãçºçããã®ãïŒ ãããã£ãŠïŒ
-èŽåœçãšã©ãŒãå«ãã¯ãŒã«ãŒãšã©ãŒã®ãã°èšé²
ãã°ã¯å€§ãããªãå¯èœæ§ããããããã衚瀺ããã®ã¯é¢åã§ãããå€ãã®å Žåããªã¥ãŒã ã®ããã«äžå¯èœã§ãã å¿ èŠãª
-ä»»æã®ããã¹ãããã°ã§æ€çŽ¢
ç§ãã¡ã¯åŽåè ã«å¯ŸåŠããŸããã圌ãã¯ç§ãã¡ã®å¯Ÿè±¡ã§ãã ãããŠã¿ãŒã³ïŒ
åã³ãåŽåè -å°ããªåäŸã®ããã«ãæã䞊ã¹æ¿ããŸããããã®æã«ã¯äœããããŸããïŒ ãããã£ãŠïŒ
-ãã¥ãŒãµãŒããŒã«ç»é²ãããŠãããã¹ãŠã®æ©èœã®åºå
-åæ©èœã®ã¿ã¹ã¯ãã¥ãŒã®åºå
ããããã¯ã©ã€ã¢ã³ãã¯ãµãŒããŒã«ã¿ã¹ã¯ãã¥ãŒãã¹ããŒãã1,000åãäžåºŠã«1ã€ãã€èç©ããŸããããã¯ãŒã«ãŒã¯ãããåŠçã§ããªãã£ãããã¯ãŒã«ãŒããŸã£ããååšãããäºæãããŠããŸããã ãŸãã¯å®ç掻ã«è¿ãïŒã¯ãŒã«ãŒãã¢ã¯ã»ã¹ããå€éšãµãŒãã¹ãå©çšã§ããªãããããã¥ãŒããªã»ããããå¿ èŠããããŸãã ã«ãªãæ¹æ³ å¿ é ã§ã
-åæ©èœã®ãã¥ãŒããªã»ãã/ã¯ãªã¢
ããããããã§ã¯ååãªGearmanããã¬ã€ããŸãããåæããå¿ èŠããããŸãã ãŸãã¯ãäœãééã£ãããšãããŠãã¥ãŒãµãŒããŒã«éä¿¡ãããã¹ãŠãåæ¢ããå¿ èŠããããŸãã å©ããŸã
-ãã«ãªã»ããïŒãã¹ãŠã®ãã¥ãŒãã¯ãªã¢ãããã¹ãŠã®ã¯ãŒã«ãŒãåæ¢ããŸãã
çºçãããã¹ãŠã®ãã®ããããŒãžãæŽæ°ããã«ãªã¢ã«ã¿ã€ã ã§è¡šç€ºããå¿ èŠãããããšãè¿œå ããŸã ã
äžèšã®ã¿ã¹ã¯ã¯ãã¹ãŠãGearman_Monitorã¯ã©ã¹ãšããã®ã¯ã©ã¹ã®ã¡ãœãããå®è£ ããGearman Monitor && Control Webã¢ããªã±ãŒã·ã§ã³ã«ãã£ãŠè§£æ±ºãããŸãã
Githubã®Gearman Monitor && Controlãããžã§ã¯ã
ããããªWebã¢ããªã±ãŒã·ã§ã³ã®ã¹ã¯ãªãŒã³ã·ã§ãã
詳现ãªèª¬æãšåãã¹ã¯ãªãŒã³ã·ã§ãã
ãããWebã¢ããªã±ãŒã·ã§ã³ã®ãããªã§ã
éçºã§äœ¿çšããã«ã¯ãGearman_Monitorããã³Gmonitor_Settingsã¯ã©ã¹ãå¿ èŠã§ãïŒphpãã¡ã€ã«åã¯ã¯ã©ã¹åãšåãã§ãïŒã
ã¯ã©ã¹ã®ããããã£ãšã¡ãœããã¯ããã¡ã€ã«èªäœã«è©³çŽ°ã«ææžåãããŠããŸãã ããã ãã説æããŸãããã
public static $func_name_synonyms = array( 'summ' => 'Sum', 'muliply' => ' ', 'subtract' => 'Substract Function', 'divide' => 'åèœ', );
ããã«
é åããŒ-ãã¥ãŒãµãŒããŒã®ã¯ãŒã«ãŒã«ãã£ãŠç»é²ãããé¢æ°å
å€-ããŒãã«ã«è¡šç€ºããããã®ïŒä»»æã®åœ¢åŒïŒã ããã¯ããªãã¬ãŒã¿ãŒã®å©äŸ¿æ§ã®ããã§ã-äžåºŠãããã³å¥ã®ã¢ããªã±ãŒã·ã§ã³ã åäžã®ãã¥ãŒãµãŒããŒã§è€æ°ã®ãããžã§ã¯ããã¹ãã³ããŠãããšæ³åããŠãã ããã ãã¡ãããããŒãäžã®ãã¹ãŠã§ã¯ãªããèªåã®ãããžã§ã¯ãã ããèŠããã§ãã ãããè¡ãã«ã¯ãå矩èªãæå®ãïŒæå®ããªãå Žåã¯é¢æ°åã䜿çšãããŸãïŒãå€ãèšå®ããŸã
public static $synonyms_only_view = true;
ãã®å Žåãå矩èªãååšãããã®ã®ã¿ãé¢æ°ããŒãã«ã«è¡šç€ºãããŸãã
å¥ã®ãã€ã³ãã Webã¢ããªã±ãŒã·ã§ã³ã«ã¯ããã¬ãŒãšPHPãšã©ãŒãã³ãã©ãå«ãŸããŠããŸãã gearman_includes.phpãã¡ã€ã«ãã¯ãŒã«ãŒã«æ¥ç¶ãããšãã¯ãŒã«ãŒãã衚瀺ããããã°ã«æžã蟌ãããšãã§ããã¯ãŒã«ãŒã®ãšã©ãŒãèšé²ãããŠãã°ã«è¡šç€ºãããŸãã
/ workersãã£ã¬ã¯ããªã«ã¯2ã€ã®ã¯ãŒã«ãŒããããŸãã fake_worker.phpã¯ã¢ããªã±ãŒã·ã§ã³ãåäœããããã«å¿ èŠã§ãã2çªç®ã®ã¯ãŒã«ãŒã¯åäœäžã®ãããžã§ã¯ãããã®ãã®ã§ãããäŸãšããŠèããããšãã§ããŸãã
Webã¢ããªã±ãŒã·ã§ã³ã䜿çšããã«ã¯ã次ã®ãã®ãå¿ èŠã§ãã
-ããŒã¿ããŒã¹ã«ãã°ããŒãã«ãäœæããïŒlog_create.sqlãã¡ã€ã«ãåç §ïŒ
-Gearman_Db.phpãã¡ã€ã«ã§ããŒã¿ããŒã¹æ¥ç¶ãã©ã¡ãŒã¿ãŒãæå®ããŸã
-ãã¥ãŒ/ Smarty / smarty_dirså ã®ãã¹ãŠã®ãã£ã¬ã¯ããªã«æžã蟌ã¿æš©éãèšå®ããŸãïŒäž»ã«ãã£ã¬ã¯ããªãã¥ãŒ/ Smarty / smarty_dirs / templates_cã«é¢ä¿ããŸãïŒ
-Gearman_Monitor.phpãã¡ã€ã«ã§GearmanãµãŒããŒãã¹ããæå®ããŸã
çããã«å¹žéãïŒ
PS Webã¢ããªã±ãŒã·ã§ã³ã¯åäœäžã®ãããžã§ã¯ãããåŒãè£ãããŠããŸããå°ããªççŸããããããããŸãããäºåã«è¬çœªããŸãã
å¥ã®ç¬éã Webã¢ããªã±ãŒã·ã§ã³ã®æžãçŽããç¹°ãè¿ãè©Šã¿ãŸãã-ã³ãŒããã€ã³ã¿ãŒãã§ãŒã¹ãæ¹è¯ããããã«ãGearmanã䜿çšããŠã¿ã¹ã¯ã絶ããçŸããæåã®ããŒãžã§ã³ã¯ããã«å®æããŸããã ãã®çµæãç¹°ãè¿ããã¹ããããä¿¡é Œæ§ãé«ããå®å®ããŠããŠäŸ¿å©ãªãã®ãšããŠå ¬éãããŸããã