{"id":2998,"date":"2021-09-30T17:15:00","date_gmt":"2021-10-01T00:15:00","guid":{"rendered":"https:\/\/www.xh86.me\/?p=2998"},"modified":"2021-10-16T17:02:46","modified_gmt":"2021-10-17T00:02:46","slug":"12306%e6%8a%a2%e7%a5%a8%ef%bc%9a%e6%9e%81%e9%99%90%e5%b9%b6%e5%8f%91%e5%b8%a6%e6%9d%a5%e7%9a%84%e6%80%9d%e8%80%83","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=2998","title":{"rendered":"12306\u62a2\u7968\uff1a\u6781\u9650\u5e76\u53d1\u5e26\u6765\u7684\u601d\u8003"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<p style=\"text-align: center;\" data-mpa-powered-by=\"yiban.io\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-70a6383e0165f0dbcbad618db3f108b4.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" class=\"rich_pages wxw-img js_insertlocalimg\" style=\"border-radius: 6px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-70a6383e0165f0dbcbad618db3f108b4.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.625\" data-s=\"300,640\" data-type=\"jpeg\" data-w=\"600\" \/><\/div><\/p>\n<section data-mpa-template=\"t\">&nbsp;<\/p>\n<\/section>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6bcf\u5230\u8282\u5047\u65e5\u671f\u95f4\uff0c\u4e00\u4e8c\u7ebf\u57ce\u5e02\u8fd4\u4e61\u3001\u5916\u51fa\u6e38\u73a9\u7684\u4eba\u4eec\u51e0\u4e4e\u90fd\u9762\u4e34\u7740\u4e00\u4e2a\u95ee\u9898\uff1a\u62a2\u706b\u8f66\u7968\uff01\u867d\u7136\u73b0\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u90fd\u80fd\u8ba2\u5230\u7968\uff0c\u4f46\u662f\u653e\u7968\u77ac\u95f4\u5373\u65e0\u7968\u7684\u573a\u666f\uff0c\u76f8\u4fe1\u5927\u5bb6\u90fd\u6df1\u6709\u4f53\u4f1a\u3002\u5c24\u5176\u662f\u6625\u8282\u671f\u95f4\uff0c\u5927\u5bb6\u4e0d\u4ec5\u4f7f\u752812306\uff0c\u8fd8\u4f1a\u8003\u8651\u201c\u667a\u884c\u201d\u548c\u5176\u4ed6\u7684\u62a2\u7968\u8f6f\u4ef6\uff0c\u5168\u56fd\u4e0a\u4e0b\u51e0\u4ebf\u4eba\u5728\u8fd9\u6bb5\u65f6\u95f4\u90fd\u5728\u62a2\u7968\u3002\u201c12306\u670d\u52a1\u201d\u627f\u53d7\u7740\u8fd9\u4e2a\u4e16\u754c\u4e0a\u4efb\u4f55\u79d2\u6740\u7cfb\u7edf\u90fd\u65e0\u6cd5\u8d85\u8d8a\u7684QPS\uff0c\u4e0a\u767e\u4e07\u7684\u5e76\u53d1\u518d\u6b63\u5e38\u4e0d\u8fc7\u4e86\uff01\u7b14\u8005\u4e13\u95e8\u7814\u7a76\u4e86\u4e00\u4e0b\u201c12306\u201d\u7684\u670d\u52a1\u7aef\u67b6\u6784\uff0c\u5b66\u4e60\u5230\u4e86\u5176\u7cfb\u7edf\u8bbe\u8ba1\u4e0a\u5f88\u591a\u4eae\u70b9\uff0c\u5728\u8fd9\u91cc\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u5e76\u6a21\u62df\u4e00\u4e2a\u4f8b\u5b50\uff1a\u5982\u4f55\u5728100\u4e07\u4eba\u540c\u65f6\u62a21\u4e07\u5f20\u706b\u8f66\u7968\u65f6\uff0c\u7cfb\u7edf\u63d0\u4f9b\u6b63\u5e38\u3001\u7a33\u5b9a\u7684\u670d\u52a1\u3002<\/section>\n<\/section>\n<\/section>\n<p>&nbsp;<\/p>\n<section data-mpa-template=\"t\">\n<section style=\"margin: 0px; padding: 0px 10px 0px 9px; color: #3c3c3c; font-size: 16px; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; line-height: 1.8; background: #ffffff; z-index: 10000;\">\u5927\u578b\u9ad8\u5e76\u53d1\u7cfb\u7edf\u67b6\u6784<\/section>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"padding: 0px; color: #3c3c3c; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; background-color: #ffffff; font-size: 15px; display: inline-block; left: 0px; transform: rotateX(60deg); height: auto !important; width: 632px !important; visibility: visible !important; margin: 5px !important 0px 0px 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.053125\" data-type=\"png\" data-w=\"640\" \/><\/div><\/p>\n<p>&nbsp;<\/p>\n<\/section>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u9ad8\u5e76\u53d1\u7684\u7cfb\u7edf\u67b6\u6784\u90fd\u4f1a\u91c7\u7528\u5206\u5e03\u5f0f\u96c6\u7fa4\u90e8\u7f72\uff0c\u670d\u52a1\u4e0a\u5c42\u6709\u7740\u5c42\u5c42\u8d1f\u8f7d\u5747\u8861\uff0c\u5e76\u63d0\u4f9b\u5404\u79cd\u5bb9\u707e\u624b\u6bb5\uff08\u53cc\u706b\u673a\u623f\u3001\u8282\u70b9\u5bb9\u9519\u3001\u670d\u52a1\u5668\u707e\u5907\u7b49\uff09\u4fdd\u8bc1\u7cfb\u7edf\u7684\u9ad8\u53ef\u7528\uff0c\u6d41\u91cf\u4e5f\u4f1a\u6839\u636e\u4e0d\u540c\u7684\u8d1f\u8f7d\u80fd\u529b\u548c\u914d\u7f6e\u7b56\u7565\u5747\u8861\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\u4e0a\u3002\u4e0b\u8fb9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u610f\u56fe\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-23c5515d682766f8df428c8cf72426c5.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"margin: 0px; inset: 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-23c5515d682766f8df428c8cf72426c5.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.6205733558178752\" data-type=\"png\" data-w=\"593\" \/><\/div><\/p>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u8d1f\u8f7d\u5747\u8861\u7b80\u4ecb<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4e0a\u56fe\u4e2d\u63cf\u8ff0\u4e86\u7528\u6237\u8bf7\u6c42\u5230\u670d\u52a1\u5668\u7ecf\u5386\u4e86\u4e09\u5c42\u7684\u8d1f\u8f7d\u5747\u8861\uff0c\u4e0b\u8fb9\u5206\u522b\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u8fd9\u4e09\u79cd\u8d1f\u8f7d\u5747\u8861\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section data-mpa-template=\"t\">\n<section style=\"color: #333333; font-size: 17px; text-align: justify;\" data-mpa-template=\"t\">\n<ul class=\"list-paddingleft-2\" style=\"padding-left: 2.2em; width: 577.422px; list-style-type: square;\">\n<li style=\"clear: both;\">\n<p style=\"padding-right: 10px; padding-left: 9px; clear: both; min-height: 1em; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">OSPF\uff08\u5f00\u653e\u5f0f\u6700\u77ed\u94fe\u8def\u4f18\u5148\uff09\u662f\u4e00\u4e2a\u5185\u90e8\u7f51\u5173\u534f\u8bae\uff08Interior Gateway Protocol\uff0c\u7b80\u79f0IGP\uff09\u3002OSPF\u901a\u8fc7\u8def\u7531\u5668\u4e4b\u95f4\u901a\u544a\u7f51\u7edc\u63a5\u53e3\u7684\u72b6\u6001\u6765\u5efa\u7acb\u94fe\u8def\u72b6\u6001\u6570\u636e\u5e93\uff0c\u751f\u6210\u6700\u77ed\u8def\u5f84\u6811\uff0cOSPF\u4f1a\u81ea\u52a8\u8ba1\u7b97\u8def\u7531\u63a5\u53e3\u4e0a\u7684Cost\u503c\uff0c\u4f46\u4e5f\u53ef\u4ee5\u901a\u8fc7\u624b\u5de5\u6307\u5b9a\u8be5\u63a5\u53e3\u7684Cost\u503c\uff0c\u624b\u5de5\u6307\u5b9a\u7684\u4f18\u5148\u4e8e\u81ea\u52a8\u8ba1\u7b97\u7684\u503c\u3002OSPF\u8ba1\u7b97\u7684Cost\uff0c\u540c\u6837\u662f\u548c\u63a5\u53e3\u5e26\u5bbd\u6210\u53cd\u6bd4\uff0c\u5e26\u5bbd\u8d8a\u9ad8\uff0cCost\u503c\u8d8a\u5c0f\u3002\u5230\u8fbe\u76ee\u6807\u76f8\u540cCost\u503c\u7684\u8def\u5f84\uff0c\u53ef\u4ee5\u6267\u884c\u8d1f\u8f7d\u5747\u8861\uff0c\u6700\u591a6\u6761\u94fe\u8def\u540c\u65f6\u6267\u884c\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n<\/li>\n<li style=\"clear: both;\">\n<p style=\"padding-right: 10px; padding-left: 9px; clear: both; min-height: 1em; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">LVS\uff08Linux VirtualServer\uff09\uff0c\u5b83\u662f\u4e00\u79cd\u96c6\u7fa4\uff08Cluster\uff09\u6280\u672f\uff0c\u91c7\u7528IP\u8d1f\u8f7d\u5747\u8861\u6280\u672f\u548c\u57fa\u4e8e\u5185\u5bb9\u8bf7\u6c42\u5206\u53d1\u6280\u672f\u3002\u8c03\u5ea6\u5668\u5177\u6709\u5f88\u597d\u7684\u541e\u5410\u7387\uff0c\u5c06\u8bf7\u6c42\u5747\u8861\u5730\u8f6c\u79fb\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\u4e0a\u6267\u884c\uff0c\u4e14\u8c03\u5ea6\u5668\u81ea\u52a8\u5c4f\u853d\u6389\u670d\u52a1\u5668\u7684\u6545\u969c\uff0c\u4ece\u800c\u5c06\u4e00\u7ec4\u670d\u52a1\u5668\u6784\u6210\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684\u3001\u9ad8\u53ef\u7528\u7684\u865a\u62df\u670d\u52a1\u5668\u3002<\/p>\n<\/li>\n<li style=\"clear: both;\">\n<p style=\"padding-right: 10px; padding-left: 9px; clear: both; min-height: 1em; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">Nginx\u60f3\u5fc5\u5927\u5bb6\u90fd\u5f88\u719f\u6089\u4e86\uff0c\u662f\u4e00\u6b3e\u975e\u5e38\u9ad8\u6027\u80fd\u7684http\u4ee3\u7406\/\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u670d\u52a1\u5f00\u53d1\u4e2d\u4e5f\u7ecf\u5e38\u4f7f\u7528\u5b83\u6765\u505a\u8d1f\u8f7d\u5747\u8861\u3002Nginx\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u7684\u65b9\u5f0f\u4e3b\u8981\u6709\u4e09\u79cd:\u8f6e\u8be2\u3001\u52a0\u6743\u8f6e\u8be2\u3001ip hash\u8f6e\u8be2\uff0c\u4e0b\u9762\u6211\u4eec\u5c31\u9488\u5bf9Nginx\u7684\u52a0\u6743\u8f6e\u8be2\u505a\u4e13\u95e8\u7684\u914d\u7f6e\u548c\u6d4b\u8bd5\u3002<\/p>\n<\/li>\n<\/ul>\n<\/section>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>Nginx\u52a0\u6743\u8f6e\u8be2\u7684\u6f14\u793a<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">Nginx\u5b9e\u73b0\u8d1f\u8f7d\u5747\u8861\u901a\u8fc7upstream\u6a21\u5757\u5b9e\u73b0\uff0c\u5176\u4e2d\u52a0\u6743\u8f6e\u8be2\u7684\u914d\u7f6e\u662f\u53ef\u4ee5\u7ed9\u76f8\u5173\u7684\u670d\u52a1\u52a0\u4e0a\u4e00\u4e2a\u6743\u91cd\u503c\uff0c\u914d\u7f6e\u7684\u65f6\u5019\u53ef\u80fd\u6839\u636e\u670d\u52a1\u5668\u7684\u6027\u80fd\u3001\u8d1f\u8f7d\u80fd\u529b\u8bbe\u7f6e\u76f8\u5e94\u7684\u8d1f\u8f7d\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u52a0\u6743\u8f6e\u8be2\u8d1f\u8f7d\u7684\u914d\u7f6e\uff0c\u6211\u5c06\u5728\u672c\u5730\u7684\u76d1\u542c3001-3004\u7aef\u53e3\uff0c\u5206\u522b\u914d\u7f6e1\uff0c2\uff0c3\uff0c4\u7684\u6743\u91cd\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\"><span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\u914d\u7f6e\u8d1f\u8f7d\u5747\u8861<\/span><br \/>\nupstream\u00a0load_rule\u00a0{<br \/>\nserver\u00a0127.0.0.1:3001\u00a0weight=1;<br \/>\nserver\u00a0127.0.0.1:3002\u00a0weight=2;<br \/>\nserver\u00a0127.0.0.1:3003\u00a0weight=3;<br \/>\nserver\u00a0127.0.0.1:3004\u00a0weight=4;<br \/>\n}<br \/>\n&#8230;<br \/>\nserver\u00a0{<br \/>\nlisten\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a080;<br \/>\nserver_name\u00a0\u00a0load_balance.com\u00a0www.load_balance.com;<br \/>\nlocation\u00a0\/\u00a0{<br \/>\nproxy_pass\u00a0http:\/\/load_rule;<br \/>\n}<br \/>\n}<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6211\u5728\u672c\u5730\/etc\/hosts\u76ee\u5f55\u4e0b\u914d\u7f6e\u4e86www.load_balance.com\u7684\u865a\u62df\u57df\u540d\u5730\u5740\uff0c\u63a5\u4e0b\u6765\u4f7f\u7528Go\u8bed\u8a00\u5f00\u542f\u56db\u4e2ahttp\u7aef\u53e3\u76d1\u542c\u670d\u52a1\uff0c\u4e0b\u9762\u662f\u76d1\u542c\u57283001\u7aef\u53e3\u7684Go\u7a0b\u5e8f,\u5176\u4ed6\u51e0\u4e2a\u53ea\u9700\u8981\u4fee\u6539\u7aef\u53e3\u5373\u53ef\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">package\u00a0main<\/p>\n<p>import\u00a0(<br \/>\n<span style=\"color: #98c379; line-height: 26px;\">&#8220;net\/http&#8221;<\/span><br \/>\n<span style=\"color: #98c379; line-height: 26px;\">&#8220;os&#8221;<\/span><br \/>\n<span style=\"color: #98c379; line-height: 26px;\">&#8220;strings&#8221;<\/span><br \/>\n)<\/p>\n<p>func\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #61aeee; line-height: 26px;\">main<\/span><\/span>()\u00a0{<br \/>\nhttp.HandleFunc(<span style=\"color: #98c379; line-height: 26px;\">&#8220;\/buy\/ticket&#8221;<\/span>,\u00a0handleReq)<br \/>\nhttp.ListenAndServe(<span style=\"color: #98c379; line-height: 26px;\">&#8220;:3001&#8221;<\/span>,\u00a0nil)<br \/>\n}<\/p>\n<p>\/\/\u5904\u7406\u8bf7\u6c42\u51fd\u6570\uff0c\u6839\u636e\u8bf7\u6c42\u5c06\u54cd\u5e94\u7ed3\u679c\u4fe1\u606f\u5199\u5165\u65e5\u5fd7<br \/>\nfunc\u00a0handleReq(w\u00a0http.ResponseWriter,\u00a0r\u00a0*http.Request)\u00a0{<br \/>\nfailedMsg\u00a0:=\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;handle\u00a0in\u00a0port:&#8221;<\/span><br \/>\nwriteLog(failedMsg,\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;.\/stat.log&#8221;<\/span>)<br \/>\n}<\/p>\n<p>\/\/\u5199\u5165\u65e5\u5fd7<br \/>\nfunc\u00a0writeLog(msg\u00a0string,\u00a0logPath\u00a0string)\u00a0{<br \/>\nfd,\u00a0_\u00a0:=\u00a0os.OpenFile(logPath,\u00a0os.O_RDWR|os.O_CREATE|os.O_APPEND,\u00a00644)<br \/>\ndefer\u00a0fd.Close()<br \/>\ncontent\u00a0:=\u00a0strings.Join([]string{msg,\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;rn&#8221;<\/span>},\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;3001&#8221;<\/span>)<br \/>\nbuf\u00a0:=\u00a0[]byte(content)<br \/>\nfd.Write(buf)<br \/>\n}<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6211\u5c06\u8bf7\u6c42\u7684\u7aef\u53e3\u65e5\u5fd7\u4fe1\u606f\u5199\u5230\u4e86.\/stat.log\u6587\u4ef6\u5f53\u4e2d\uff0c\u7136\u540e\u4f7f\u7528ab\u538b\u6d4b\u5de5\u5177\u505a\u538b\u6d4b\uff1a<\/section>\n<\/section>\n<\/section>\n<section style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">ab\u00a0-n\u00a01000\u00a0-c\u00a0100\u00a0http:\/\/www.load_balance.com\/buy\/ticket<\/section>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u7edf\u8ba1\u65e5\u5fd7\u4e2d\u7684\u7ed3\u679c\uff0c3001-3004\u7aef\u53e3\u5206\u522b\u5f97\u5230\u4e86100\u3001200\u3001300\u3001400\u7684\u8bf7\u6c42\u91cf\uff0c\u8fd9\u548c\u6211\u5728Nginx\u4e2d\u914d\u7f6e\u7684\u6743\u91cd\u5360\u6bd4\u5f88\u597d\u7684\u543b\u5408\u5728\u4e86\u4e00\u8d77\uff0c\u5e76\u4e14\u8d1f\u8f7d\u540e\u7684\u6d41\u91cf\u975e\u5e38\u7684\u5747\u5300\u3001\u968f\u673a\u3002\u5177\u4f53\u7684\u5b9e\u73b0\u5927\u5bb6\u53ef\u4ee5\u53c2\u8003nginx\u7684upsteam\u6a21\u5757\u5b9e\u73b0\u6e90\u7801\uff0c\u8fd9\u91cc\u63a8\u8350\u4e00\u7bc7\u6587\u7ae0\uff1ahttps:\/\/www.kancloud.cn\/digest\/understandingnginx\/202607<\/section>\n<\/section>\n<\/section>\n<section>\n<section>\n<section><\/section>\n<section data-mpa-template=\"t\">\n<section style=\"margin: 0px; padding: 0px 10px 0px 9px; color: #3c3c3c; font-size: 16px; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; line-height: 1.8; background: #ffffff; z-index: 10000;\">\u79d2\u6740\u62a2\u8d2d\u7cfb\u7edf\u9009\u578b<\/section>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"padding: 0px; color: #3c3c3c; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; background-color: #ffffff; font-size: 15px; display: inline-block; left: 0px; transform: rotateX(60deg); height: auto !important; width: 632px !important; visibility: visible !important; margin: 5px !important 0px 0px 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-type=\"png\" data-ratio=\"0.053125\" data-w=\"640\" \/><\/div><\/p>\n<p>&nbsp;<\/p>\n<\/section>\n<\/section>\n<\/section>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u56de\u5230\u6211\u4eec\u6700\u521d\u63d0\u5230\u7684\u95ee\u9898\u4e2d\u6765\uff1a\u706b\u8f66\u7968\u79d2\u6740\u7cfb\u7edf\u5982\u4f55\u5728\u9ad8\u5e76\u53d1\u60c5\u51b5\u4e0b\u63d0\u4f9b\u6b63\u5e38\u3001\u7a33\u5b9a\u7684\u670d\u52a1\u5462\uff1f<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4ece\u4e0a\u9762\u7684\u4ecb\u7ecd\u6211\u4eec\u77e5\u9053\u7528\u6237\u79d2\u6740\u6d41\u91cf\u901a\u8fc7\u5c42\u5c42\u7684\u8d1f\u8f7d\u5747\u8861\uff0c\u5747\u5300\u5230\u4e86\u4e0d\u540c\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5373\u4f7f\u5982\u6b64\uff0c\u96c6\u7fa4\u4e2d\u7684\u5355\u673a\u6240\u627f\u53d7\u7684QPS\u4e5f\u662f\u975e\u5e38\u9ad8\u7684\u3002\u5982\u4f55\u5c06\u5355\u673a\u6027\u80fd\u4f18\u5316\u5230\u6781\u81f4\u5462\uff1f\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u5c31\u8981\u60f3\u660e\u767d\u4e00\u4ef6\u4e8b\uff1a\u901a\u5e38\u8ba2\u7968\u7cfb\u7edf\u8981\u5904\u7406\u751f\u6210\u8ba2\u5355\u3001\u51cf\u6263\u5e93\u5b58\u3001\u7528\u6237\u652f\u4ed8\u8fd9\u4e09\u4e2a\u57fa\u672c\u7684\u9636\u6bb5\uff0c\u6211\u4eec\u7cfb\u7edf\u8981\u505a\u7684\u4e8b\u60c5\u662f\u8981\u4fdd\u8bc1\u706b\u8f66\u7968\u8ba2\u5355\u4e0d\u8d85\u5356\u3001\u4e0d\u5c11\u5356\uff0c\u6bcf\u5f20\u552e\u5356\u7684\u8f66\u7968\u90fd\u5fc5\u987b\u652f\u4ed8\u624d\u6709\u6548\uff0c\u8fd8\u8981\u4fdd\u8bc1\u7cfb\u7edf\u627f\u53d7\u6781\u9ad8\u7684\u5e76\u53d1\u3002\u8fd9\u4e09\u4e2a\u9636\u6bb5\u7684\u5148\u540e\u987a\u5e8f\u6539\u600e\u4e48\u5206\u914d\u624d\u66f4\u52a0\u5408\u7406\u5462\uff1f\u6211\u4eec\u6765\u5206\u6790\u4e00\u4e0b\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u4e0b\u5355\u51cf\u5e93\u5b58<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u5f53\u7528\u6237\u5e76\u53d1\u8bf7\u6c42\u5230\u8fbe\u670d\u52a1\u7aef\u65f6\uff0c\u9996\u5148\u521b\u5efa\u8ba2\u5355\uff0c\u7136\u540e\u6263\u9664\u5e93\u5b58\uff0c\u7b49\u5f85\u7528\u6237\u652f\u4ed8\u3002\u8fd9\u79cd\u987a\u5e8f\u662f\u6211\u4eec\u4e00\u822c\u4eba\u9996\u5148\u4f1a\u60f3\u5230\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e5f\u80fd\u4fdd\u8bc1\u8ba2\u5355\u4e0d\u4f1a\u8d85\u5356\uff0c\u56e0\u4e3a\u521b\u5efa\u8ba2\u5355\u4e4b\u540e\u5c31\u4f1a\u51cf\u5e93\u5b58\uff0c\u8fd9\u662f\u4e00\u4e2a\u539f\u5b50\u64cd\u4f5c\u3002\u4f46\u662f\u8fd9\u6837\u4e5f\u4f1a\u4ea7\u751f\u4e00\u4e9b\u95ee\u9898\uff0c\u7b2c\u4e00\u5c31\u662f\u5728\u6781\u9650\u5e76\u53d1\u60c5\u51b5\u4e0b\uff0c\u4efb\u4f55\u4e00\u4e2a\u5185\u5b58\u64cd\u4f5c\u7684\u7ec6\u8282\u90fd\u81f3\u5173\u5f71\u54cd\u6027\u80fd\uff0c\u5c24\u5176\u50cf\u521b\u5efa\u8ba2\u5355\u8fd9\u79cd\u903b\u8f91\uff0c\u4e00\u822c\u90fd\u9700\u8981\u5b58\u50a8\u5230\u78c1\u76d8\u6570\u636e\u5e93\u7684\uff0c\u5bf9\u6570\u636e\u5e93\u7684\u538b\u529b\u662f\u53ef\u60f3\u800c\u77e5\u7684\uff1b\u7b2c\u4e8c\u662f\u5982\u679c\u7528\u6237\u5b58\u5728\u6076\u610f\u4e0b\u5355\u7684\u60c5\u51b5\uff0c\u53ea\u4e0b\u5355\u4e0d\u652f\u4ed8\u8fd9\u6837\u5e93\u5b58\u5c31\u4f1a\u53d8\u5c11\uff0c\u4f1a\u5c11\u5356\u5f88\u591a\u8ba2\u5355\uff0c\u867d\u7136\u670d\u52a1\u7aef\u53ef\u4ee5\u9650\u5236IP\u548c\u7528\u6237\u7684\u8d2d\u4e70\u8ba2\u5355\u6570\u91cf\uff0c\u8fd9\u4e5f\u4e0d\u7b97\u662f\u4e00\u4e2a\u597d\u65b9\u6cd5\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-06a191d530a2f29e745a17d63c3397e0.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"box-sizing: border-box; vertical-align: middle; max-width: 625px; margin: 0px; inset: 0px; border: 0px initial initial;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-06a191d530a2f29e745a17d63c3397e0.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.1436077057793345\" data-type=\"jpeg\" data-w=\"571\" \/><\/div><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u652f\u4ed8\u51cf\u5e93\u5b58<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u5982\u679c\u7b49\u5f85\u7528\u6237\u652f\u4ed8\u4e86\u8ba2\u5355\u5728\u51cf\u5e93\u5b58\uff0c\u7b2c\u4e00\u611f\u89c9\u5c31\u662f\u4e0d\u4f1a\u5c11\u5356\u3002\u4f46\u662f\u8fd9\u662f\u5e76\u53d1\u67b6\u6784\u7684\u5927\u5fcc\uff0c\u56e0\u4e3a\u5728\u6781\u9650\u5e76\u53d1\u60c5\u51b5\u4e0b\uff0c\u7528\u6237\u53ef\u80fd\u4f1a\u521b\u5efa\u5f88\u591a\u8ba2\u5355\uff0c\u5f53\u5e93\u5b58\u51cf\u4e3a\u96f6\u7684\u65f6\u5019\u5f88\u591a\u7528\u6237\u53d1\u73b0\u62a2\u5230\u7684\u8ba2\u5355\u652f\u4ed8\u4e0d\u4e86\u4e86\uff0c\u8fd9\u4e5f\u5c31\u662f\u6240\u8c13\u7684\u201c\u8d85\u5356\u201d\u3002\u4e5f\u4e0d\u80fd\u907f\u514d\u5e76\u53d1\u64cd\u4f5c\u6570\u636e\u5e93\u78c1\u76d8IO\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-3ee58a877b0576fadc19fe2e015f1dc5.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"box-sizing: border-box; vertical-align: middle; max-width: 625px; margin: 0px; inset: 0px; border: 0px initial initial;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-3ee58a877b0576fadc19fe2e015f1dc5.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.1436077057793345\" data-type=\"jpeg\" data-w=\"571\" \/><\/div><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u9884\u6263\u5e93\u5b58<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4ece\u4e0a\u8fb9\u4e24\u79cd\u65b9\u6848\u7684\u8003\u8651\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u51fa\u7ed3\u8bba\uff1a\u53ea\u8981\u521b\u5efa\u8ba2\u5355\uff0c\u5c31\u8981\u9891\u7e41\u64cd\u4f5c\u6570\u636e\u5e93IO\u3002\u90a3\u4e48\u6709\u6ca1\u6709\u4e00\u79cd\u4e0d\u9700\u8981\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u5e93IO\u7684\u65b9\u6848\u5462\uff0c\u8fd9\u5c31\u662f\u9884\u6263\u5e93\u5b58\u3002\u5148\u6263\u9664\u4e86\u5e93\u5b58\uff0c\u4fdd\u8bc1\u4e0d\u8d85\u5356\uff0c\u7136\u540e\u5f02\u6b65\u751f\u6210\u7528\u6237\u8ba2\u5355\uff0c\u8fd9\u6837\u54cd\u5e94\u7ed9\u7528\u6237\u7684\u901f\u5ea6\u5c31\u4f1a\u5feb\u5f88\u591a\uff1b\u90a3\u4e48\u600e\u4e48\u4fdd\u8bc1\u4e0d\u5c11\u5356\u5462\uff1f\u7528\u6237\u62ff\u5230\u4e86\u8ba2\u5355\uff0c\u4e0d\u652f\u4ed8\u600e\u4e48\u529e\uff1f\u6211\u4eec\u90fd\u77e5\u9053\u73b0\u5728\u8ba2\u5355\u90fd\u6709\u6709\u6548\u671f\uff0c\u6bd4\u5982\u8bf4\u7528\u6237\u4e94\u5206\u949f\u5185\u4e0d\u652f\u4ed8\uff0c\u8ba2\u5355\u5c31\u5931\u6548\u4e86\uff0c\u8ba2\u5355\u4e00\u65e6\u5931\u6548\uff0c\u5c31\u4f1a\u52a0\u5165\u65b0\u7684\u5e93\u5b58\uff0c\u8fd9\u4e5f\u662f\u73b0\u5728\u5f88\u591a\u7f51\u4e0a\u96f6\u552e\u4f01\u4e1a\u4fdd\u8bc1\u5546\u54c1\u4e0d\u5c11\u5356\u91c7\u7528\u7684\u65b9\u6848\u3002\u8ba2\u5355\u7684\u751f\u6210\u662f\u5f02\u6b65\u7684,\u4e00\u822c\u90fd\u4f1a\u653e\u5230MQ\u3001Kafka\u8fd9\u6837\u7684\u5373\u65f6\u6d88\u8d39\u961f\u5217\u4e2d\u5904\u7406,\u8ba2\u5355\u91cf\u6bd4\u8f83\u5c11\u7684\u60c5\u51b5\u4e0b\uff0c\u751f\u6210\u8ba2\u5355\u975e\u5e38\u5feb\uff0c\u7528\u6237\u51e0\u4e4e\u4e0d\u7528\u6392\u961f\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-ee94a48fd2feecf04b76a0d2cf993d04.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"margin: 0px; inset: 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-ee94a48fd2feecf04b76a0d2cf993d04.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.6830985915492958\" data-type=\"jpeg\" data-w=\"426\" \/><\/div><\/p>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u6263\u5e93\u5b58\u7684\u827a\u672f<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4ece\u4e0a\u9762\u7684\u5206\u6790\u53ef\u77e5\uff0c\u663e\u7136\u9884\u6263\u5e93\u5b58\u7684\u65b9\u6848\u6700\u5408\u7406\u3002\u6211\u4eec\u8fdb\u4e00\u6b65\u5206\u6790\u6263\u5e93\u5b58\u7684\u7ec6\u8282\uff0c\u8fd9\u91cc\u8fd8\u6709\u5f88\u5927\u7684\u4f18\u5316\u7a7a\u95f4\uff0c\u5e93\u5b58\u5b58\u5728\u54ea\u91cc\uff1f\u600e\u6837\u4fdd\u8bc1\u9ad8\u5e76\u53d1\u4e0b\uff0c\u6b63\u786e\u7684\u6263\u5e93\u5b58\uff0c\u8fd8\u80fd\u5feb\u901f\u7684\u54cd\u5e94\u7528\u6237\u8bf7\u6c42\uff1f<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u5728\u5355\u673a\u4f4e\u5e76\u53d1\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5b9e\u73b0\u6263\u5e93\u5b58\u901a\u5e38\u662f\u8fd9\u6837\u7684\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-83ec1a3ce24678fa13fe6df29d26a582.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"margin: 0px; inset: 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-83ec1a3ce24678fa13fe6df29d26a582.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.4076086956521739\" data-type=\"jpeg\" data-w=\"368\" \/><\/div><\/p>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4e3a\u4e86\u4fdd\u8bc1\u6263\u5e93\u5b58\u548c\u751f\u6210\u8ba2\u5355\u7684\u539f\u5b50\u6027\uff0c\u9700\u8981\u91c7\u7528\u4e8b\u52a1\u5904\u7406\uff0c\u7136\u540e\u53d6\u5e93\u5b58\u5224\u65ad\u3001\u51cf\u5e93\u5b58\uff0c\u6700\u540e\u63d0\u4ea4\u4e8b\u52a1\uff0c\u6574\u4e2a\u6d41\u7a0b\u6709\u5f88\u591aIO\uff0c\u5bf9\u6570\u636e\u5e93\u7684\u64cd\u4f5c\u53c8\u662f\u963b\u585e\u7684\u3002\u8fd9\u79cd\u65b9\u5f0f\u6839\u672c\u4e0d\u9002\u5408\u9ad8\u5e76\u53d1\u7684\u79d2\u6740\u7cfb\u7edf\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u63a5\u4e0b\u6765\u6211\u4eec\u5bf9\u5355\u673a\u6263\u5e93\u5b58\u7684\u65b9\u6848\u505a\u4f18\u5316\uff1a\u672c\u5730\u6263\u5e93\u5b58\u3002\u6211\u4eec\u628a\u4e00\u5b9a\u7684\u5e93\u5b58\u91cf\u5206\u914d\u5230\u672c\u5730\u673a\u5668\uff0c\u76f4\u63a5\u5728\u5185\u5b58\u4e2d\u51cf\u5e93\u5b58\uff0c\u7136\u540e\u6309\u7167\u4e4b\u524d\u7684\u903b\u8f91\u5f02\u6b65\u521b\u5efa\u8ba2\u5355\u3002\u6539\u8fdb\u8fc7\u4e4b\u540e\u7684\u5355\u673a\u7cfb\u7edf\u662f\u8fd9\u6837\u7684\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1cc0f6bf174ad58dc6438f4dd6cd5af4.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"margin: 0px; inset: 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1cc0f6bf174ad58dc6438f4dd6cd5af4.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.3268101761252446\" data-type=\"jpeg\" data-w=\"511\" \/><\/div><\/p>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u8fd9\u6837\u5c31\u907f\u514d\u4e86\u5bf9\u6570\u636e\u5e93\u9891\u7e41\u7684IO\u64cd\u4f5c\uff0c\u53ea\u5728\u5185\u5b58\u4e2d\u505a\u8fd0\u7b97\uff0c\u6781\u5927\u7684\u63d0\u9ad8\u4e86\u5355\u673a\u6297\u5e76\u53d1\u7684\u80fd\u529b\u3002\u4f46\u662f\u767e\u4e07\u7684\u7528\u6237\u8bf7\u6c42\u91cf\u5355\u673a\u662f\u65e0\u8bba\u5982\u4f55\u4e5f\u6297\u4e0d\u4f4f\u7684\uff0c\u867d\u7136Nginx\u5904\u7406\u7f51\u7edc\u8bf7\u6c42\u4f7f\u7528epoll\u6a21\u578b\uff0cc10k\u7684\u95ee\u9898\u5728\u4e1a\u754c\u65e9\u5df2\u5f97\u5230\u4e86\u89e3\u51b3\u3002\u4f46\u662fLinux\u7cfb\u7edf\u4e0b\uff0c\u4e00\u5207\u8d44\u6e90\u7686\u6587\u4ef6\uff0c\u7f51\u7edc\u8bf7\u6c42\u4e5f\u662f\u8fd9\u6837\uff0c\u5927\u91cf\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u4f1a\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u77ac\u95f4\u5931\u53bb\u54cd\u5e94\u3002\u4e0a\u9762\u6211\u4eec\u63d0\u5230\u4e86Nginx\u7684\u52a0\u6743\u5747\u8861\u7b56\u7565\uff0c\u6211\u4eec\u4e0d\u59a8\u5047\u8bbe\u5c06100W\u7684\u7528\u6237\u8bf7\u6c42\u91cf\u5e73\u5747\u5747\u8861\u5230100\u53f0\u670d\u52a1\u5668\u4e0a\uff0c\u8fd9\u6837\u5355\u673a\u6240\u627f\u53d7\u7684\u5e76\u53d1\u91cf\u5c31\u5c0f\u4e86\u5f88\u591a\u3002\u7136\u540e\u6211\u4eec\u6bcf\u53f0\u673a\u5668\u672c\u5730\u5e93\u5b58100\u5f20\u706b\u8f66\u7968\uff0c100\u53f0\u670d\u52a1\u5668\u4e0a\u7684\u603b\u5e93\u5b58\u8fd8\u662f1\u4e07\uff0c\u8fd9\u6837\u4fdd\u8bc1\u4e86\u5e93\u5b58\u8ba2\u5355\u4e0d\u8d85\u5356,\u4e0b\u9762\u662f\u6211\u4eec\u63cf\u8ff0\u7684\u96c6\u7fa4\u67b6\u6784\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-18e01144711a1709f662194cdf9344bf.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"margin: 0px; inset: 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-18e01144711a1709f662194cdf9344bf.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.46747352496217853\" data-type=\"jpeg\" data-w=\"661\" \/><\/div><\/p>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u95ee\u9898\u63a5\u8e35\u800c\u81f3\uff0c\u5728\u9ad8\u5e76\u53d1\u60c5\u51b5\u4e0b\uff0c\u73b0\u5728\u6211\u4eec\u8fd8\u65e0\u6cd5\u4fdd\u8bc1\u7cfb\u7edf\u7684\u9ad8\u53ef\u7528\uff0c\u5047\u5982\u8fd9100\u53f0\u670d\u52a1\u5668\u4e0a\u6709\u4e24\u4e09\u53f0\u673a\u5668\u56e0\u4e3a\u625b\u4e0d\u4f4f\u5e76\u53d1\u7684\u6d41\u91cf\u6216\u8005\u5176\u4ed6\u7684\u539f\u56e0\u5b95\u673a\u4e86\u3002\u90a3\u4e48\u8fd9\u4e9b\u670d\u52a1\u5668\u4e0a\u7684\u8ba2\u5355\u5c31\u5356\u4e0d\u51fa\u53bb\u4e86\uff0c\u8fd9\u5c31\u9020\u6210\u4e86\u8ba2\u5355\u7684\u5c11\u5356\u3002\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u603b\u8ba2\u5355\u91cf\u505a\u7edf\u4e00\u7684\u7ba1\u7406\uff0c\u8fd9\u5c31\u662f\u63a5\u4e0b\u6765\u7684\u5bb9\u9519\u65b9\u6848\u3002\u670d\u52a1\u5668\u4e0d\u4ec5\u8981\u5728\u672c\u5730\u51cf\u5e93\u5b58\uff0c\u53e6\u5916\u8981\u8fdc\u7a0b\u7edf\u4e00\u51cf\u5e93\u5b58\u3002\u6709\u4e86\u8fdc\u7a0b\u7edf\u4e00\u51cf\u5e93\u5b58\u7684\u64cd\u4f5c\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u6839\u636e\u673a\u5668\u8d1f\u8f7d\u60c5\u51b5\uff0c\u4e3a\u6bcf\u53f0\u673a\u5668\u5206\u914d\u4e00\u4e9b\u591a\u4f59\u7684\u201cbuffer\u5e93\u5b58\u201d\u7528\u6765\u9632\u6b62\u673a\u5668\u4e2d\u6709\u673a\u5668\u5b95\u673a\u7684\u60c5\u51b5\u3002\u6211\u4eec\u7ed3\u5408\u4e0b\u9762\u67b6\u6784\u56fe\u5177\u4f53\u5206\u6790\u4e00\u4e0b\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: center; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-089dfea94112fc95a5be7f2728853ffc.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"margin: 0px; inset: 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-089dfea94112fc95a5be7f2728853ffc.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.518361581920904\" data-type=\"jpeg\" data-w=\"708\" \/><\/div><\/p>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6211\u4eec\u91c7\u7528Redis\u5b58\u50a8\u7edf\u4e00\u5e93\u5b58\uff0c\u56e0\u4e3aRedis\u7684\u6027\u80fd\u975e\u5e38\u9ad8\uff0c\u53f7\u79f0\u5355\u673aQPS\u80fd\u629710W\u7684\u5e76\u53d1\u3002\u5728\u672c\u5730\u51cf\u5e93\u5b58\u4ee5\u540e\uff0c\u5982\u679c\u672c\u5730\u6709\u8ba2\u5355\uff0c\u6211\u4eec\u518d\u53bb\u8bf7\u6c42Redis\u8fdc\u7a0b\u51cf\u5e93\u5b58\uff0c\u672c\u5730\u51cf\u5e93\u5b58\u548c\u8fdc\u7a0b\u51cf\u5e93\u5b58\u90fd\u6210\u529f\u4e86\uff0c\u624d\u8fd4\u56de\u7ed9\u7528\u6237\u62a2\u7968\u6210\u529f\u7684\u63d0\u793a,\u8fd9\u6837\u4e5f\u80fd\u6709\u6548\u7684\u4fdd\u8bc1\u8ba2\u5355\u4e0d\u4f1a\u8d85\u5356\u3002\u5f53\u673a\u5668\u4e2d\u6709\u673a\u5668\u5b95\u673a\u65f6\uff0c\u56e0\u4e3a\u6bcf\u4e2a\u673a\u5668\u4e0a\u6709\u9884\u7559\u7684buffer\u4f59\u7968\uff0c\u6240\u4ee5\u5b95\u673a\u673a\u5668\u4e0a\u7684\u4f59\u7968\u4f9d\u7136\u80fd\u591f\u5728\u5176\u4ed6\u673a\u5668\u4e0a\u5f97\u5230\u5f25\u8865\uff0c\u4fdd\u8bc1\u4e86\u4e0d\u5c11\u5356\u3002buffer\u4f59\u7968\u8bbe\u7f6e\u591a\u5c11\u5408\u9002\u5462\uff0c\u7406\u8bba\u4e0abuffer\u8bbe\u7f6e\u7684\u8d8a\u591a\uff0c\u7cfb\u7edf\u5bb9\u5fcd\u5b95\u673a\u7684\u673a\u5668\u6570\u91cf\u5c31\u8d8a\u591a\uff0c\u4f46\u662fbuffer\u8bbe\u7f6e\u7684\u592a\u5927\u4e5f\u4f1a\u5bf9redis\u9020\u6210\u4e00\u5b9a\u7684\u5f71\u54cd\u3002\u867d\u7136Redis\u5185\u5b58\u6570\u636e\u5e93\u6297\u5e76\u53d1\u80fd\u529b\u975e\u5e38\u9ad8\uff0c\u8bf7\u6c42\u4f9d\u7136\u4f1a\u8d70\u4e00\u6b21\u7f51\u7edcIO\uff0c\u5176\u5b9e\u62a2\u7968\u8fc7\u7a0b\u4e2d\u5bf9redis\u7684\u8bf7\u6c42\u6b21\u6570\u662f\u672c\u5730\u5e93\u5b58\u548cbuffer\u5e93\u5b58\u7684\u603b\u91cf\uff0c\u56e0\u4e3a\u5f53\u672c\u5730\u5e93\u5b58\u4e0d\u8db3\u65f6\uff0c\u7cfb\u7edf\u76f4\u63a5\u8fd4\u56de\u7528\u6237\u201c\u5df2\u552e\u7f44\u201d\u7684\u4fe1\u606f\u63d0\u793a\uff0c\u5c31\u4e0d\u4f1a\u518d\u8d70\u7edf\u4e00\u6263\u5e93\u5b58\u7684\u903b\u8f91\uff0c\u8fd9\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u4e5f\u907f\u514d\u4e86\u5de8\u5927\u7684\u7f51\u7edc\u8bf7\u6c42\u91cf\u628aRedis\u538b\u8de8\uff0c\u6240\u4ee5buffer\u503c\u8bbe\u7f6e\u591a\u5c11\uff0c\u9700\u8981\u67b6\u6784\u5e08\u5bf9\u7cfb\u7edf\u7684\u8d1f\u8f7d\u80fd\u529b\u505a\u8ba4\u771f\u7684\u8003\u91cf\u3002<\/section>\n<\/section>\n<\/section>\n<p>&nbsp;<\/p>\n<section data-mpa-template=\"t\">\n<section style=\"margin: 0px; padding: 0px 10px 0px 9px; color: #3c3c3c; font-size: 16px; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; line-height: 1.8; background: #ffffff; z-index: 10000;\">\u4ee3\u7801\u6f14\u793a<\/section>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"padding: 0px; color: #3c3c3c; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; background-color: #ffffff; font-size: 15px; display: inline-block; left: 0px; transform: rotateX(60deg); height: auto !important; width: 632px !important; visibility: visible !important; margin: 5px !important 0px 0px 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.053125\" data-type=\"png\" data-w=\"640\" \/><\/div><\/p>\n<p>&nbsp;<\/p>\n<\/section>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">Go\u8bed\u8a00\u539f\u751f\u4e3a\u5e76\u53d1\u8bbe\u8ba1\uff0c\u6211\u91c7\u7528Go\u8bed\u8a00\u7ed9\u5927\u5bb6\u6f14\u793a\u4e00\u4e0b\u5355\u673a\u62a2\u7968\u7684\u5177\u4f53\u6d41\u7a0b\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u521d\u59cb\u5316\u5de5\u4f5c<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">Go\u5305\u4e2d\u7684init\u51fd\u6570\u5148\u4e8emain\u51fd\u6570\u6267\u884c\uff0c\u5728\u8fd9\u4e2a\u9636\u6bb5\u4e3b\u8981\u505a\u4e00\u4e9b\u51c6\u5907\u6027\u5de5\u4f5c\u3002\u6211\u4eec\u7cfb\u7edf\u9700\u8981\u505a\u7684\u51c6\u5907\u5de5\u4f5c\u6709\uff1a\u521d\u59cb\u5316\u672c\u5730\u5e93\u5b58\u3001\u521d\u59cb\u5316\u8fdc\u7a0bRedis\u5b58\u50a8\u7edf\u4e00\u5e93\u5b58\u7684hash\u952e\u503c\u3001\u521d\u59cb\u5316Redis\u8fde\u63a5\u6c60\uff1b\u53e6\u5916\u8fd8\u9700\u8981\u521d\u59cb\u5316\u4e00\u4e2a\u5927\u5c0f\u4e3a1\u7684int\u7c7b\u578bchan\uff0c\u76ee\u7684\u662f\u5b9e\u73b0\u5206\u5e03\u5f0f\u9501\u7684\u529f\u80fd\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u8bfb\u5199\u9501\u6216\u8005\u4f7f\u7528Redis\u7b49\u5176\u4ed6\u7684\u65b9\u5f0f\u907f\u514d\u8d44\u6e90\u7ade\u4e89\uff0c\u4f46\u4f7f\u7528channel\u66f4\u52a0\u9ad8\u6548\uff0c\u8fd9\u5c31\u662fGo\u8bed\u8a00\u7684\u54f2\u5b66\uff1a\u4e0d\u8981\u901a\u8fc7\u5171\u4eab\u5185\u5b58\u6765\u901a\u4fe1\uff0c\u800c\u8981\u901a\u8fc7\u901a\u4fe1\u6765\u5171\u4eab\u5185\u5b58\u3002Redis\u5e93\u4f7f\u7528\u7684\u662fredigo\uff0c\u4e0b\u9762\u662f\u4ee3\u7801\u5b9e\u73b0\uff1a<\/section>\n<\/section>\n<\/section>\n<section style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">&#8230;<br \/>\n\/\/localSpike\u5305\u7ed3\u6784\u4f53\u5b9a\u4e49<br \/>\npackage\u00a0localSpike<span style=\"color: #e6c07b; line-height: 26px;\">type<\/span>\u00a0LocalSpike\u00a0struct\u00a0{<br \/>\nLocalInStock\u00a0\u00a0\u00a0\u00a0\u00a0int64<br \/>\nLocalSalesVolume\u00a0int64<br \/>\n}<br \/>\n&#8230;<br \/>\n\/\/remoteSpike\u5bf9<span style=\"color: #e6c07b; line-height: 26px;\">hash<\/span>\u7ed3\u6784\u7684\u5b9a\u4e49\u548cRedis\u8fde\u63a5\u6c60<br \/>\npackage\u00a0remoteSpike<br \/>\n\/\/\u8fdc\u7a0b\u8ba2\u5355\u5b58\u50a8\u5065\u503c<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">type<\/span>\u00a0RemoteSpikeKeys\u00a0struct\u00a0{<br \/>\nSpikeOrderHashKey\u00a0string\u00a0\/\/Redis\u4e2d\u79d2\u6740\u8ba2\u5355<span style=\"color: #e6c07b; line-height: 26px;\">hash<\/span>\u7ed3\u6784key<br \/>\nTotalInventoryKey\u00a0string\u00a0\/\/<span style=\"color: #e6c07b; line-height: 26px;\">hash<\/span>\u7ed3\u6784\u4e2d\u603b\u8ba2\u5355\u5e93\u5b58key<br \/>\nQuantityOfOrderKey\u00a0string\u00a0\/\/<span style=\"color: #e6c07b; line-height: 26px;\">hash<\/span>\u7ed3\u6784\u4e2d\u5df2\u6709\u8ba2\u5355\u6570\u91cfkey<br \/>\n}<\/p>\n<p>\/\/\u521d\u59cb\u5316Redis\u8fde\u63a5\u6c60<br \/>\nfunc\u00a0NewPool()\u00a0*redis.Pool\u00a0{<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a0&amp;redis.Pool{<br \/>\nMaxIdle:\u00a0\u00a0\u00a010000,<br \/>\nMaxActive:\u00a012000,\u00a0\/\/\u00a0max\u00a0number\u00a0of\u00a0connections<br \/>\nDial:\u00a0func()\u00a0(redis.Conn,\u00a0error)\u00a0{<br \/>\nc,\u00a0err\u00a0:=\u00a0redis.Dial(<span style=\"color: #98c379; line-height: 26px;\">&#8220;tcp&#8221;<\/span>,\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;:6379&#8221;<\/span>)<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0err\u00a0!=\u00a0nil\u00a0{<br \/>\npanic(err.Error())<br \/>\n}<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a0c,\u00a0err<br \/>\n},<br \/>\n}<br \/>\n}<br \/>\n&#8230;<br \/>\nfunc\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #61aeee; line-height: 26px;\">init<\/span><\/span>()\u00a0{<br \/>\nlocalSpike\u00a0=\u00a0localSpike2.LocalSpike{<br \/>\nLocalInStock:\u00a0\u00a0\u00a0\u00a0\u00a0150,<br \/>\nLocalSalesVolume:\u00a00,<br \/>\n}<br \/>\nremoteSpike\u00a0=\u00a0remoteSpike2.RemoteSpikeKeys{<br \/>\nSpikeOrderHashKey:\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;ticket_hash_key&#8221;<\/span>,<br \/>\nTotalInventoryKey:\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;ticket_total_nums&#8221;<\/span>,<br \/>\nQuantityOfOrderKey:\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;ticket_sold_nums&#8221;<\/span>,<br \/>\n}<br \/>\nredisPool\u00a0=\u00a0remoteSpike2.NewPool()<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">done<\/span>\u00a0=\u00a0make(chan\u00a0int,\u00a01)<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">done<\/span>\u00a0&lt;-\u00a01<br \/>\n}<\/p>\n<\/section>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u672c\u5730\u6263\u5e93\u5b58\u548c\u7edf\u4e00\u6263\u5e93\u5b58<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u672c\u5730\u6263\u5e93\u5b58\u903b\u8f91\u975e\u5e38\u7b80\u5355\uff0c\u7528\u6237\u8bf7\u6c42\u8fc7\u6765\uff0c\u6dfb\u52a0\u9500\u91cf\uff0c\u7136\u540e\u5bf9\u6bd4\u9500\u91cf\u662f\u5426\u5927\u4e8e\u672c\u5730\u5e93\u5b58\uff0c\u8fd4\u56debool\u503c\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">package\u00a0localSpike<br \/>\n\/\/\u672c\u5730\u6263\u5e93\u5b58\uff0c\u8fd4\u56debool\u503c<br \/>\nfunc\u00a0(spike\u00a0*LocalSpike)\u00a0LocalDeductionStock()\u00a0bool{<br \/>\nspike.LocalSalesVolume\u00a0=\u00a0spike.LocalSalesVolume\u00a0+\u00a01<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a0spike.LocalSalesVolume\u00a0&lt;\u00a0spike.LocalInStock<br \/>\n}<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6ce8\u610f\u8fd9\u91cc\u5bf9\u5171\u4eab\u6570\u636eLocalSalesVolume\u7684\u64cd\u4f5c\u662f\u8981\u4f7f\u7528\u9501\u6765\u5b9e\u73b0\u7684\uff0c\u4f46\u662f\u56e0\u4e3a\u672c\u5730\u6263\u5e93\u5b58\u548c\u7edf\u4e00\u6263\u5e93\u5b58\u662f\u4e00\u4e2a\u539f\u5b50\u6027\u64cd\u4f5c\uff0c\u6240\u4ee5\u5728\u6700\u4e0a\u5c42\u4f7f\u7528channel\u6765\u5b9e\u73b0\uff0c\u8fd9\u5757\u540e\u8fb9\u4f1a\u8bb2\u3002\u7edf\u4e00\u6263\u5e93\u5b58\u64cd\u4f5cRedis\uff0c\u56e0\u4e3aRedis\u662f\u5355\u7ebf\u7a0b\u7684\uff0c\u800c\u6211\u4eec\u8981\u5b9e\u73b0\u4ece\u4e2d\u53d6\u6570\u636e\uff0c\u5199\u6570\u636e\u5e76\u8ba1\u7b97\u4e00\u4e9b\u5217\u6b65\u9aa4\uff0c\u6211\u4eec\u8981\u914d\u5408Lua\u811a\u672c\u6253\u5305\u547d\u4ee4\uff0c\u4fdd\u8bc1\u64cd\u4f5c\u7684\u539f\u5b50\u6027\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">package\u00a0remoteSpike<br \/>\n&#8230;&#8230;<br \/>\nconst\u00a0LuaScript\u00a0=\u00a0`<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">local<\/span>\u00a0ticket_key\u00a0=\u00a0KEYS[1]<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">local<\/span>\u00a0ticket_total_key\u00a0=\u00a0ARGV[1]<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">local<\/span>\u00a0ticket_sold_key\u00a0=\u00a0ARGV[2]<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">local<\/span>\u00a0ticket_total_nums\u00a0=\u00a0tonumber(redis.call(<span style=\"color: #98c379; line-height: 26px;\">&#8216;HGET&#8217;<\/span>,\u00a0ticket_key,\u00a0ticket_total_key))<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">local<\/span>\u00a0ticket_sold_nums\u00a0=\u00a0tonumber(redis.call(<span style=\"color: #98c379; line-height: 26px;\">&#8216;HGET&#8217;<\/span>,\u00a0ticket_key,\u00a0ticket_sold_key))<br \/>\n&#8212;\u00a0\u67e5\u770b\u662f\u5426\u8fd8\u6709\u4f59\u7968\uff0c\u589e\u52a0\u8ba2\u5355\u6570\u91cf\uff0c\u8fd4\u56de\u7ed3\u679c\u503c<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>(ticket_total_nums\u00a0&gt;=\u00a0ticket_sold_nums)\u00a0<span style=\"color: #c678dd; line-height: 26px;\">then<\/span><br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a0redis.call(<span style=\"color: #98c379; line-height: 26px;\">&#8216;HINCRBY&#8217;<\/span>,\u00a0ticket_key,\u00a0ticket_sold_key,\u00a01)<br \/>\nend<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a00<br \/>\n`<br \/>\n\/\/\u8fdc\u7aef\u7edf\u4e00\u6263\u5e93\u5b58<br \/>\nfunc\u00a0(RemoteSpikeKeys\u00a0*RemoteSpikeKeys)\u00a0RemoteDeductionStock(conn\u00a0redis.Conn)\u00a0bool\u00a0{<br \/>\nlua\u00a0:=\u00a0redis.NewScript(1,\u00a0LuaScript)<br \/>\nresult,\u00a0err\u00a0:=\u00a0redis.Int(lua.Do(conn,\u00a0RemoteSpikeKeys.SpikeOrderHashKey,\u00a0RemoteSpikeKeys.TotalInventoryKey,\u00a0RemoteSpikeKeys.QuantityOfOrderKey))<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0err\u00a0!=\u00a0nil\u00a0{<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a0<span style=\"color: #56b6c2; line-height: 26px;\">false<\/span><br \/>\n}<br \/>\n<span style=\"color: #e6c07b; line-height: 26px;\">return<\/span>\u00a0result\u00a0!=\u00a00<br \/>\n}<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6211\u4eec\u4f7f\u7528hash\u7ed3\u6784\u5b58\u50a8\u603b\u5e93\u5b58\u548c\u603b\u9500\u91cf\u7684\u4fe1\u606f\uff0c\u7528\u6237\u8bf7\u6c42\u8fc7\u6765\u65f6\uff0c\u5224\u65ad\u603b\u9500\u91cf\u662f\u5426\u5927\u4e8e\u5e93\u5b58\uff0c\u7136\u540e\u8fd4\u56de\u76f8\u5173\u7684bool\u503c\u3002\u5728\u542f\u52a8\u670d\u52a1\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u521d\u59cb\u5316Redis\u7684\u521d\u59cb\u5e93\u5b58\u4fe1\u606f\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">hmset\u00a0ticket_hash_key\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;ticket_total_nums&#8221;<\/span>\u00a010000\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;ticket_sold_nums&#8221;<\/span>\u00a00<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u54cd\u5e94\u7528\u6237\u4fe1\u606f<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6211\u4eec\u5f00\u542f\u4e00\u4e2ahttp\u670d\u52a1\uff0c\u76d1\u542c\u5728\u4e00\u4e2a\u7aef\u53e3\u4e0a\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">package\u00a0main<br \/>\n&#8230;<br \/>\nfunc\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #61aeee; line-height: 26px;\">main<\/span><\/span>()\u00a0{<br \/>\nhttp.HandleFunc(<span style=\"color: #98c379; line-height: 26px;\">&#8220;\/buy\/ticket&#8221;<\/span>,\u00a0handleReq)<br \/>\nhttp.ListenAndServe(<span style=\"color: #98c379; line-height: 26px;\">&#8220;:3005&#8221;<\/span>,\u00a0nil)<br \/>\n}<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4e0a\u9762\u6211\u4eec\u505a\u5b8c\u4e86\u6240\u6709\u7684\u521d\u59cb\u5316\u5de5\u4f5c\uff0c\u63a5\u4e0b\u6765handleReq\u7684\u903b\u8f91\u975e\u5e38\u6e05\u6670\uff0c\u5224\u65ad\u662f\u5426\u62a2\u7968\u6210\u529f\uff0c\u8fd4\u56de\u7ed9\u7528\u6237\u4fe1\u606f\u5c31\u53ef\u4ee5\u4e86\u3002<\/section>\n<\/section>\n<\/section>\n<section style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">package\u00a0main<br \/>\n\/\/\u5904\u7406\u8bf7\u6c42\u51fd\u6570\uff0c\u6839\u636e\u8bf7\u6c42\u5c06\u54cd\u5e94\u7ed3\u679c\u4fe1\u606f\u5199\u5165\u65e5\u5fd7<br \/>\nfunc\u00a0handleReq(w\u00a0http.ResponseWriter,\u00a0r\u00a0*http.Request)\u00a0{<br \/>\nredisConn\u00a0:=\u00a0redisPool.Get()<br \/>\nLogMsg\u00a0:=\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;&#8221;<\/span><br \/>\n&lt;-<span style=\"color: #c678dd; line-height: 26px;\">done<\/span><br \/>\n\/\/\u5168\u5c40\u8bfb\u5199\u9501<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">if<\/span>\u00a0localSpike.LocalDeductionStock()\u00a0&amp;&amp;\u00a0remoteSpike.RemoteDeductionStock(redisConn)\u00a0{<br \/>\nutil.RespJson(w,\u00a01,\u00a0\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;\u62a2\u7968\u6210\u529f&#8221;<\/span>,\u00a0nil)<br \/>\nLogMsg\u00a0=\u00a0LogMsg\u00a0+\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;result:1,localSales:&#8221;<\/span>\u00a0+\u00a0strconv.FormatInt(localSpike.LocalSalesVolume,\u00a010)<br \/>\n}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">else<\/span>\u00a0{<br \/>\nutil.RespJson(w,\u00a0-1,\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;\u5df2\u552e\u7f44&#8221;<\/span>,\u00a0nil)<br \/>\nLogMsg\u00a0=\u00a0LogMsg\u00a0+\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;result:0,localSales:&#8221;<\/span>\u00a0+\u00a0strconv.FormatInt(localSpike.LocalSalesVolume,\u00a010)<br \/>\n}<br \/>\n<span style=\"color: #c678dd; line-height: 26px;\">done<\/span>\u00a0&lt;-\u00a01\u00a0\/\/\u5c06\u62a2\u7968\u72b6\u6001\u5199\u5165\u5230<span style=\"color: #e6c07b; line-height: 26px;\">log<\/span>\u4e2d<br \/>\nwriteLog(LogMsg,\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;.\/stat.log&#8221;<\/span>)<br \/>\n}<\/p>\n<p>func\u00a0writeLog(msg\u00a0string,\u00a0logPath\u00a0string)\u00a0{<br \/>\nfd,\u00a0_\u00a0:=\u00a0os.OpenFile(logPath,\u00a0os.O_RDWR|os.O_CREATE|os.O_APPEND,\u00a00644)<br \/>\ndefer\u00a0fd.Close()<br \/>\ncontent\u00a0:=\u00a0strings.Join([]string{msg,\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;rn&#8221;<\/span>},\u00a0<span style=\"color: #98c379; line-height: 26px;\">&#8220;&#8221;<\/span>)<br \/>\nbuf\u00a0:=\u00a0[]byte(content)<br \/>\nfd.Write(buf)<br \/>\n}<\/p>\n<\/section>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u524d\u8fb9\u63d0\u5230\u6211\u4eec\u6263\u5e93\u5b58\u65f6\u8981\u8003\u8651\u7ade\u6001\u6761\u4ef6\uff0c\u6211\u4eec\u8fd9\u91cc\u662f\u4f7f\u7528channel\u907f\u514d\u5e76\u53d1\u7684\u8bfb\u5199\uff0c\u4fdd\u8bc1\u4e86\u8bf7\u6c42\u7684\u9ad8\u6548\u987a\u5e8f\u6267\u884c\u3002\u6211\u4eec\u5c06\u63a5\u53e3\u7684\u8fd4\u56de\u4fe1\u606f\u5199\u5165\u5230\u4e86.\/stat.log\u6587\u4ef6\u65b9\u4fbf\u505a\u538b\u6d4b\u7edf\u8ba1\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><strong>\u5355\u673a\u670d\u52a1\u538b\u6d4b<\/strong><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u5f00\u542f\u670d\u52a1\uff0c\u6211\u4eec\u4f7f\u7528ab\u538b\u6d4b\u5de5\u5177\u8fdb\u884c\u6d4b\u8bd5\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">ab\u00a0-n\u00a010000\u00a0-c\u00a0100\u00a0http:\/\/127.0.0.1:3005\/buy\/ticket<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u4e0b\u9762\u662f\u6211\u672c\u5730\u4f4e\u914dmac\u7684\u538b\u6d4b\u4fe1\u606f\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">This\u00a0is\u00a0ApacheBench,\u00a0Version\u00a02.3\u00a0&lt;<span style=\"color: #d19a66; line-height: 26px;\">$Revision<\/span>:\u00a01826891\u00a0$&gt;<br \/>\nCopyright\u00a01996\u00a0Adam\u00a0Twiss,\u00a0Zeus\u00a0Technology\u00a0Ltd,\u00a0http:\/\/www.zeustech.net\/<br \/>\nLicensed\u00a0to\u00a0The\u00a0Apache\u00a0Software\u00a0Foundation,\u00a0http:\/\/www.apache.org\/<\/p>\n<p>Benchmarking\u00a0127.0.0.1\u00a0(be\u00a0patient)<br \/>\nCompleted\u00a01000\u00a0requests<br \/>\nCompleted\u00a02000\u00a0requests<br \/>\nCompleted\u00a03000\u00a0requests<br \/>\nCompleted\u00a04000\u00a0requests<br \/>\nCompleted\u00a05000\u00a0requests<br \/>\nCompleted\u00a06000\u00a0requests<br \/>\nCompleted\u00a07000\u00a0requests<br \/>\nCompleted\u00a08000\u00a0requests<br \/>\nCompleted\u00a09000\u00a0requests<br \/>\nCompleted\u00a010000\u00a0requests<br \/>\nFinished\u00a010000\u00a0requests<\/p>\n<p>Server\u00a0Software:<br \/>\nServer\u00a0Hostname:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0127.0.0.1<br \/>\nServer\u00a0Port:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03005<\/p>\n<p>Document\u00a0Path:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/buy\/ticket<br \/>\nDocument\u00a0Length:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a029\u00a0bytes<\/p>\n<p>Concurrency\u00a0Level:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0100<br \/>\nTime\u00a0taken\u00a0<span style=\"color: #c678dd; line-height: 26px;\">for<\/span>\u00a0tests:\u00a0\u00a0\u00a02.339\u00a0seconds<br \/>\nComplete\u00a0requests:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a010000<br \/>\nFailed\u00a0requests:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00<br \/>\nTotal\u00a0transferred:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01370000\u00a0bytes<br \/>\nHTML\u00a0transferred:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0290000\u00a0bytes<br \/>\nRequests\u00a0per\u00a0second:\u00a0\u00a0\u00a0\u00a04275.96\u00a0[<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">#\/sec]\u00a0(mean)<\/span><br \/>\nTime\u00a0per\u00a0request:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a023.387\u00a0[ms]\u00a0(mean)<br \/>\nTime\u00a0per\u00a0request:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00.234\u00a0[ms]\u00a0(mean,\u00a0across\u00a0all\u00a0concurrent\u00a0requests)<br \/>\nTransfer\u00a0rate:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0572.08\u00a0[Kbytes\/sec]\u00a0received<\/p>\n<p>Connection\u00a0Times\u00a0(ms)<br \/>\nmin\u00a0\u00a0mean[+\/-sd]\u00a0median\u00a0\u00a0\u00a0max<br \/>\nConnect:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00\u00a0\u00a0\u00a0\u00a08\u00a0\u00a014.7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a06\u00a0\u00a0\u00a0\u00a0\u00a0223<br \/>\nProcessing:\u00a0\u00a0\u00a0\u00a0\u00a02\u00a0\u00a0\u00a015\u00a0\u00a017.6\u00a0\u00a0\u00a0\u00a0\u00a011\u00a0\u00a0\u00a0\u00a0\u00a0232<br \/>\nWaiting:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a011\u00a0\u00a013.5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a08\u00a0\u00a0\u00a0\u00a0\u00a0225<br \/>\nTotal:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a07\u00a0\u00a0\u00a023\u00a0\u00a022.8\u00a0\u00a0\u00a0\u00a0\u00a018\u00a0\u00a0\u00a0\u00a0\u00a0239<\/p>\n<p>Percentage\u00a0of\u00a0the\u00a0requests\u00a0served\u00a0within\u00a0a\u00a0certain\u00a0time\u00a0(ms)<br \/>\n50%\u00a0\u00a0\u00a0\u00a0\u00a018<br \/>\n66%\u00a0\u00a0\u00a0\u00a0\u00a024<br \/>\n75%\u00a0\u00a0\u00a0\u00a0\u00a026<br \/>\n80%\u00a0\u00a0\u00a0\u00a0\u00a028<br \/>\n90%\u00a0\u00a0\u00a0\u00a0\u00a033<br \/>\n95%\u00a0\u00a0\u00a0\u00a0\u00a039<br \/>\n98%\u00a0\u00a0\u00a0\u00a0\u00a045<br \/>\n99%\u00a0\u00a0\u00a0\u00a0\u00a054<br \/>\n100%\u00a0\u00a0\u00a0\u00a0239\u00a0(longest\u00a0request)<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6839\u636e\u6307\u6807\u663e\u793a\uff0c\u6211\u5355\u673a\u6bcf\u79d2\u5c31\u80fd\u5904\u74064000+\u7684\u8bf7\u6c42\uff0c\u6b63\u5e38\u670d\u52a1\u5668\u90fd\u662f\u591a\u6838\u914d\u7f6e\uff0c\u5904\u74061W+\u7684\u8bf7\u6c42\u6839\u672c\u6ca1\u6709\u95ee\u9898\u3002\u800c\u4e14\u67e5\u770b\u65e5\u5fd7\u53d1\u73b0\u6574\u4e2a\u670d\u52a1\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u6c42\u90fd\u5f88\u6b63\u5e38\uff0c\u6d41\u91cf\u5747\u5300\uff0cRedis\u4e5f\u5f88\u6b63\u5e38\uff1a<\/section>\n<\/section>\n<\/section>\n<p style=\"font-size: 12px; font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace; display: -webkit-box; overflow-x: auto; padding: 16px; color: #abb2bf; background: #282c34; border-radius: 0px; margin-left: 8px; margin-right: 8px;\">\/\/stat.log<br \/>\n&#8230;<br \/>\nresult:1,localSales:145<br \/>\nresult:1,localSales:146<br \/>\nresult:1,localSales:147<br \/>\nresult:1,localSales:148<br \/>\nresult:1,localSales:149<br \/>\nresult:1,localSales:150<br \/>\nresult:0,localSales:151<br \/>\nresult:0,localSales:152<br \/>\nresult:0,localSales:153<br \/>\nresult:0,localSales:154<br \/>\nresult:0,localSales:156<br \/>\n&#8230;<\/p>\n<pre style=\"font-size: 16px; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 10px; margin-bottom: 10px; overflow: auto; color: #000000; text-align: left; background-color: #ffffff;\"><\/pre>\n<section data-mpa-template=\"t\">\n<section style=\"margin: 0px; padding: 0px 10px 0px 9px; color: #3c3c3c; font-size: 16px; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; line-height: 1.8; background: #ffffff; z-index: 10000;\"><\/section>\n<section style=\"margin: 0px; padding: 0px 10px 0px 9px; color: #3c3c3c; font-size: 16px; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; line-height: 1.8; background: #ffffff; z-index: 10000;\">\u603b\u7ed3\u56de\u987e<\/section>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" style=\"padding: 0px; color: #3c3c3c; font-weight: bold; letter-spacing: 1px; text-align: center; white-space: normal; background-color: #ffffff; font-size: 15px; display: inline-block; left: 0px; transform: rotateX(60deg); height: auto !important; width: 632px !important; visibility: visible !important; margin: 5px !important 0px 0px 0px;\" data-original=\"https:\/\/www.xh86.me\/wp-content\/uploads\/2021\/10\/wxsync-2021-10-1708fdcac61cedac5979fc1b01e5ac23.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" data-ratio=\"0.053125\" data-type=\"png\" data-w=\"640\" \/><\/div><\/p>\n<p>&nbsp;<\/p>\n<\/section>\n<section data-mpa-template=\"t\">\n<section data-mpa-template=\"t\">\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u603b\u4f53\u6765\u8bf4\uff0c\u79d2\u6740\u7cfb\u7edf\u662f\u975e\u5e38\u590d\u6742\u7684\u3002\u6211\u4eec\u8fd9\u91cc\u53ea\u662f\u7b80\u5355\u4ecb\u7ecd\u6a21\u62df\u4e86\u4e00\u4e0b\u5355\u673a\u5982\u4f55\u4f18\u5316\u5230\u9ad8\u6027\u80fd\uff0c\u96c6\u7fa4\u5982\u4f55\u907f\u514d\u5355\u70b9\u6545\u969c\uff0c\u4fdd\u8bc1\u8ba2\u5355\u4e0d\u8d85\u5356\u3001\u4e0d\u5c11\u5356\u7684\u4e00\u4e9b\u7b56\u7565\uff0c\u5b8c\u6574\u7684\u8ba2\u5355\u7cfb\u7edf\u8fd8\u6709\u8ba2\u5355\u8fdb\u5ea6\u7684\u67e5\u770b\uff0c\u6bcf\u53f0\u670d\u52a1\u5668\u4e0a\u90fd\u6709\u4e00\u4e2a\u4efb\u52a1\uff0c\u5b9a\u65f6\u7684\u4ece\u603b\u5e93\u5b58\u540c\u6b65\u4f59\u7968\u548c\u5e93\u5b58\u4fe1\u606f\u5c55\u793a\u7ed9\u7528\u6237,\u8fd8\u6709\u7528\u6237\u5728\u8ba2\u5355\u6709\u6548\u671f\u5185\u4e0d\u652f\u4ed8\uff0c\u91ca\u653e\u8ba2\u5355\uff0c\u8865\u5145\u5230\u5e93\u5b58\u7b49\u7b49\u3002<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u6211\u4eec\u5b9e\u73b0\u4e86\u9ad8\u5e76\u53d1\u62a2\u7968\u7684\u6838\u5fc3\u903b\u8f91\uff0c\u53ef\u4ee5\u8bf4\u7cfb\u7edf\u8bbe\u8ba1\u7684\u975e\u5e38\u7684\u5de7\u5999\uff0c\u5de7\u5999\u7684\u907f\u5f00\u4e86\u5bf9DB\u6570\u636e\u5e93IO\u7684\u64cd\u4f5c\uff0c\u5bf9Redis\u7f51\u7edcIO\u7684\u9ad8\u5e76\u53d1\u8bf7\u6c42\uff0c\u51e0\u4e4e\u6240\u6709\u7684\u8ba1\u7b97\u90fd\u662f\u5728\u5185\u5b58\u4e2d\u5b8c\u6210\u7684\uff0c\u800c\u4e14\u6709\u6548\u7684\u4fdd\u8bc1\u4e86\u4e0d\u8d85\u5356\u3001\u4e0d\u5c11\u5356\uff0c\u8fd8\u80fd\u591f\u5bb9\u5fcd\u90e8\u5206\u673a\u5668\u7684\u5b95\u673a\u3002\u6211\u89c9\u5f97\u5176\u4e2d\u6709\u4e24\u70b9\u7279\u522b\u503c\u5f97\u5b66\u4e60\u603b\u7ed3\uff1a<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<section data-mpa-template=\"t\">\n<section style=\"color: #333333; font-size: 17px; text-align: justify;\" data-mpa-template=\"t\">\n<ul class=\"list-paddingleft-2\" style=\"padding-left: 2.2em; width: 577.422px; list-style-type: square;\">\n<li style=\"clear: both;\">\n<p style=\"padding-right: 10px; padding-left: 9px; clear: both; min-height: 1em; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u8d1f\u8f7d\u5747\u8861\uff0c\u5206\u800c\u6cbb\u4e4b\u3002\u901a\u8fc7\u8d1f\u8f7d\u5747\u8861\uff0c\u5c06\u4e0d\u540c\u7684\u6d41\u91cf\u5212\u5206\u5230\u4e0d\u540c\u7684\u673a\u5668\u4e0a\uff0c\u6bcf\u53f0\u673a\u5668\u5904\u7406\u597d\u81ea\u5df1\u7684\u8bf7\u6c42\uff0c\u5c06\u81ea\u5df1\u7684\u6027\u80fd\u53d1\u6325\u5230\u6781\u81f4\uff0c\u8fd9\u6837\u7cfb\u7edf\u7684\u6574\u4f53\u4e5f\u5c31\u80fd\u627f\u53d7\u6781\u9ad8\u7684\u5e76\u53d1\u4e86\uff0c\u5c31\u50cf\u5de5\u4f5c\u7684\u7684\u4e00\u4e2a\u56e2\u961f\uff0c\u6bcf\u4e2a\u4eba\u90fd\u5c06\u81ea\u5df1\u7684\u4ef7\u503c\u53d1\u6325\u5230\u4e86\u6781\u81f4\uff0c\u56e2\u961f\u6210\u957f\u81ea\u7136\u662f\u5f88\u5927\u7684\u3002<\/p>\n<\/li>\n<li style=\"clear: both;\">\n<p style=\"padding-right: 10px; padding-left: 9px; clear: both; min-height: 1em; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\">\u5408\u7406\u7684\u4f7f\u7528\u5e76\u53d1\u548c\u5f02\u6b65\u3002\u81eaepoll\u7f51\u7edc\u67b6\u6784\u6a21\u578b\u89e3\u51b3\u4e86c10k\u95ee\u9898\u4ee5\u6765\uff0c\u5f02\u6b65\u8d8a\u6765\u88ab\u670d\u52a1\u7aef\u5f00\u53d1\u4eba\u5458\u6240\u63a5\u53d7\uff0c\u80fd\u591f\u7528\u5f02\u6b65\u6765\u505a\u7684\u5de5\u4f5c\uff0c\u5c31\u7528\u5f02\u6b65\u6765\u505a\uff0c\u5728\u529f\u80fd\u62c6\u89e3\u4e0a\u80fd\u8fbe\u5230\u610f\u60f3\u4e0d\u5230\u7684\u6548\u679c\uff0c\u8fd9\u70b9\u5728Nginx\u3001node.js\u3001Redis\u4e0a\u90fd\u80fd\u4f53\u73b0\uff0c\u4ed6\u4eec\u5904\u7406\u7f51\u7edc\u8bf7\u6c42\u4f7f\u7528\u7684epoll\u6a21\u578b\uff0c\u7528\u5b9e\u8df5\u544a\u8bc9\u4e86\u6211\u4eec\u5355\u7ebf\u7a0b\u4f9d\u7136\u53ef\u4ee5\u53d1\u6325\u5f3a\u5927\u7684\u5a01\u529b\u3002\u670d\u52a1\u5668\u5df2\u7ecf\u8fdb\u5165\u4e86\u591a\u6838\u65f6\u4ee3\uff0cGo\u8bed\u8a00\u8fd9\u79cd\u5929\u751f\u4e3a\u5e76\u53d1\u800c\u751f\u7684\u8bed\u8a00\uff0c\u5b8c\u7f8e\u7684\u53d1\u6325\u4e86\u670d\u52a1\u5668\u591a\u6838\u4f18\u52bf\uff0c\u5f88\u591a\u53ef\u4ee5\u5e76\u53d1\u5904\u7406\u7684\u4efb\u52a1\u90fd\u53ef\u4ee5\u4f7f\u7528\u5e76\u53d1\u6765\u89e3\u51b3\uff0c\u6bd4\u5982Go\u5904\u7406http\u8bf7\u6c42\u65f6\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u4f1a\u5728\u4e00\u4e2agoroutine\u4e2d\u6267\u884c\uff0c\u603b\u4e4b\u600e\u6837\u5408\u7406\u7684\u538b\u69a8CPU\uff0c\u8ba9\u5176\u53d1\u6325\u51fa\u5e94\u6709\u7684\u4ef7\u503c\uff0c\u662f\u6211\u4eec\u4e00\u76f4\u9700\u8981\u63a2\u7d22\u5b66\u4e60\u7684\u65b9\u5411\u3002<\/p>\n<\/li>\n<\/ul>\n<\/section>\n<\/section>\n<section style=\"padding-right: 10px; padding-left: 9px; text-align: justify; font-size: 15px; letter-spacing: 1px; line-height: 1.8; color: #3c3c3c;\"><\/section>\n<\/section>\n<\/section>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u6bcf\u5230\u8282\u5047\u65e5\u671f\u95f4\uff0c\u4e00\u4e8c\u7ebf\u57ce\u5e02\u8fd4\u4e61\u3001\u5916\u51fa\u6e38\u73a9\u7684\u4eba\u4eec\u51e0\u4e4e\u90fd\u9762\u4e34\u7740\u4e00\u4e2a\u95ee\u9898\uff1a\u62a2\u706b\u8f66\u7968\uff01\u867d\u7136\u73b0\u5728\u5927\u591a\u6570\u60c5\u51b5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-2998","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2998"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2998\/revisions"}],"predecessor-version":[{"id":3000,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/2998\/revisions\/3000"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}