»ùÓÚSwooleµÄ¸ßÐÔÄÜÊÓƵºÏ³ÉÆ÷µÄÉè¼ÆÓëʵÏÖ
Ëæ×ÅÒƶ¯»¥ÁªÍøºÍ5gÊÖÒÕµÄÆÕ¼°£¬ÊÓƵÒѾ³ÉΪÁËÈËÃÇÉúÑÄÖÐÖ÷ÒªµÄÒ»²¿·Ö¡£¶øÊÓƵºÏ³ÉÆ÷×÷ΪÊÓƵ±à¼Àú³ÌÖеÄÖ÷Òª¹¤¾ß£¬Ò²Í¬ÑùÊܵ½ÁËÔ½À´Ô½¶àµÄ¹Ø×¢¡£±¾ÎĽ«ÏÈÈÝ»ùÓÚswooleµÄ¸ßÐÔÄÜÊÓƵºÏ³ÉÆ÷µÄÉè¼ÆÓëʵÏÖ¡£
Ò»¡¢¸ÅÊö
Ëæ×Å´ó×ÚÊÓƵÖÆ×÷ÐèÇóµÄÔöÌí£¬ÊÓƵºÏ³ÉÊÖÒÕ±äµÃÔ½À´Ô½Ö÷Òª¡£¹Å°åµÄÊÓƵºÏ³ÉÆ÷ͨ³£½ÓÄÉCPU¾ÙÐд¦Àí£¬¿ÉÊÇÓÉÓÚÊÓƵÊý¾ÝÁ¿½Ï´ó£¬µ¼ÖºϳÉËÙÂʺÜÂý£¬ÎÞ·¨Öª×ãÓû§ÐèÇó¡£Ò»Ð©¹«Ë¾Í¨¹ýʹÓò¢Ðл¯µÄCPU¾ÙÐмÓËÙ£¬»òÕßʹÓÃGPU¾ÙÐмÓËÙÀ´Ìá¸ßÊÓƵºÏ³ÉËÙÂÊ¡£¿ÉÊÇÕâЩ¼Æ»®¶¼ÐèÒªÖØ´óµÄÓ²¼þ×°±¸Ö§³Ö£¬Ð§Âʺͱ¾Ç®²»¾¡ÈçÈËÒâ¡£
»ùÓÚ´Ë£¬ÎÒÃÇ˼Á¿½ÓÄÉSwoole¿ò¼ÜÀ´¾ÙÐÐÊÓƵºÏ³É¡£SwooleÊÇÒ»¸ö¸ßÐÔÄܵÄPHPÀ©Õ¹£¬Äܹ»½«PHP´úÂëת»¯ÎªC++µÄ´úÂ룬ʹÓÃC++µÄ¶àÏ̺߳ÍÒì²½IOÊÖÒÕ£¬ÊµÏָ߲¢·¢¡¢¸ßÐÔÄܵÄÍøÂçÓ¦Óá£ÎÒÃÇ¿ÉÒÔʹÓÃSwooleµÄ²¢·¢´¦ÀíÄÜÁ¦À´ÌáÉýÊÓƵºÏ³ÉµÄËÙÂÊ¡£
¶þ¡¢Éè¼ÆÓëʵÏÖ
ÊÓƵºÏ³ÉÆ÷µÄÉè¼Æ°üÀ¨Á½²¿·Ö£ºÊý¾Ý´¦ÀíºÍÊý¾ÝÊä³ö¡£Êý¾Ý´¦Àí°üÀ¨ÒôƵºÍÊÓƵµÄ½âÂë¡¢Ñùʽ±à¼ºÍ¶¯»ÌØЧÌí¼ÓµÈ¡£Êý¾ÝÊä³ö°üÀ¨ÊÓƵѹËõ¡¢äÖȾºÍ´æ´¢µÈ¡£
1.Êý¾Ý´¦Àí
Êý¾Ý´¦Àí²¿·ÖÊÇÕû¸öÊÓƵºÏ³ÉÆ÷µÄ½¹µã¡£ËüÖ÷Òª°üÀ¨ÒÔϼ¸¸ö°ì·¨£º
£¨1£©ÒôƵºÍÊÓƵ½âÂ룺ÊÓƵºÏ³ÉÆ÷ÐèÒª¶ÔÉÏ´«µÄÊÓƵºÍÒôƵ¾ÙÐнâÂë¡£½âÂëºóÎÒÃÇ¿ÉÒÔ»ñÈ¡µ½ÊÓƵµÄÿһ֡ºÍÒôƵµÄÿһ֡Êý¾Ý¡£
£¨2£©Ñùʽ±à¼£º¹ØÓÚ²î±ðµÄÊÓƵ£¬ÎÒÃÇ»áƾ֤ÐèÇóÌí¼ÓÑùʽ¡¢Åä¾°ºÍÎÄ×ÖµÈÐÅÏ¢¡£ÕâЩÐÅÏ¢ºÍÊÓƵ×Ô¼º¿ÉÒÔ×éºÏÆðÀ´£¬ÐγÉÒ»¸öȫеÄÊÓƵ¡£
£¨3£©¶¯»ÌØЧÌí¼Ó£ºÎÒÃÇ¿ÉÒÔͨ¹ýÌí¼ÓһЩÌØЧ£¬Èç½¥±ä¡¢ÐýתºÍËõ·ÅµÈ£¬À´¸»ºñÊÓƵµÄ¶¯Ì¬Ð§¹û¡£ÕâЩÌØЧͬÑùÐèÒª¾ÙÐд¦Àí£¬²¢ÓëÔʼÊÓƵÎļþ¾ÙÐÐ×éºÏ¡£ÌØЧµÄ´¦ÀíÐèҪʹÓÃGPU¼ÓËÙ£¬¶øGPU²¿·ÖµÄ´úÂëÐèҪʹÓÃCUDA¾ÙÐÐʵÏÖ¡£
ÒÔÉÏ°ì·¨ÊÇ´®ÐÐÖ´Ðеģ¬Ïà¹ØÓÚCPUµÄ´¦ÀíÄÜÁ¦¶øÑÔ£¬Ì«ÂýÁË¡£Òò´ËÎÒÃÇ˼Á¿½ÓÄÉSwooleÀ´ÊµÏÖ²¢Ðл¯µÄ´¦ÀíÀú³Ì¡£ÎÒÃÇ¿ÉÒÔʹÓÃSwooleµÄг̺ÍÒì²½IOÊÖÒÕ£¬»®·Ö¶ÔÒôƵºÍÊÓƵµÄ½âÂë¡¢Ñùʽ±à¼ºÍ¶¯»ÌØЧÌí¼Ó¾ÙÐд¦Àí¡£ÕâÑù¾Í¿ÉÒÔʵÏָ߲¢·¢µÄÊý¾Ý´¦Àí¡£Í¬Ê±£¬ÎÒÃÇ»¹¿ÉÒÔ½ÓÄÉÐÂÎÅÐÐÁÐÀ´´¦ÀíÊäÈëºÍÊä³öµÄÊý¾Ý¡£
2.Êý¾ÝÊä³ö
Êý¾ÝÊä³ö²¿·ÖÊǽ«´¦ÀíºóµÄÊÓƵÎļþƾ֤һÃüÃûÌÃÊä³öµ½¿Í»§¶Ë¡£Õâ¸öÀú³ÌÐèÒª¾ÙÐÐäÖȾ¡¢±àÂëºÍ´æ´¢µÈ´¦Àí¡£ÆäÖд洢ÐèҪʹÓÃSwooleÌṩµÄгÌMySQL¿Í»§¶Ë¿â£¬À´½«ÊÓƵÎļþ´æ´¢µ½Êý¾Ý¿âÖС£¶ø±àÂëÐèҪʹÓÃSwooleÌṩµÄÒì²½IOÊÖÒÕÀ´¾ÙÐС£
Èý¡¢×ܽá
±¾ÎÄÏÈÈÝÁË»ùÓÚSwooleµÄ¸ßÐÔÄÜÊÓƵºÏ³ÉÆ÷µÄÉè¼ÆÓëʵÏÖ£¬Ö÷Òª°üÀ¨Êý¾Ý´¦ÀíºÍÊý¾ÝÊä³öÁ½¸ö²¿·Ö¡£ÔÚÊý¾Ý´¦Àí²¿·Ö£¬ÎÒÃǽÓÄÉÁËSwooleµÄг̺ÍÒì²½IOÊÖÒÕÀ´ÊµÏָ߲¢·¢µÄÊý¾Ý´¦Àí¡£ÔÚÊý¾ÝÊä³ö²¿·Ö£¬ÎÒÃǽÓÄÉÁËSwooleÌṩµÄгÌMySQL¿Í»§¶Ë¿âºÍÒì²½IOÊÖÒÕ£¬À´ÊµÏÖÊÓƵµÄ´æ´¢ºÍ±àÂ롣ͨ¹ýÕâЩÊÖÒÕµÄÓ¦Óã¬ÎÒÃÇʵÏÖÁ˸ßЧ¡¢¸ßÐÔÄܵÄÊÓƵºÏ³ÉÆ÷¡£
ÒÔÉϾÍÊÇ»ùÓÚSwooleµÄ¸ßÐÔÄÜÊÓƵºÏ³ÉÆ÷µÄÉè¼ÆÓëʵÏÖµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡