{"id":115330,"date":"2026-10-11T22:41:02","date_gmt":"2026-10-11T14:41:02","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115330.html"},"modified":"2026-10-11T22:41:02","modified_gmt":"2026-10-11T14:41:02","slug":"locust-%e5%88%86%e5%b8%83%e5%bc%8f%e5%8e%8b%e6%b5%8b%e6%80%a7%e8%83%bd%e8%b0%83%e4%bc%98%ef%bc%9a%e5%8f%91%e5%8e%8b%e6%9c%ba-master-worker-%e6%9e%b6%e6%9e%84%e9%80%9a%e4%bf%a1%e4%b8%8e%e5%86%85","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115330.html","title":{"rendered":"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011144056-6acb9ff873ac8.png\" alt=\"\u5c01\u9762\u4fe1\u606f\u56fe\" \/><\/p>\n<p>\u5728\u7ec4\u7ec7\u53cc 11 \u5bb9\u91cf\u6478\u9ad8\u6216\u8005\u5927\u89c4\u6a21\u7cfb\u7edf\u6781\u9650\u538b\u6d4b\u65f6&#xff0c;\u5f88\u591a\u6d4b\u8bd5\u8d1f\u8d23\u4eba\u5e38\u5e38\u4f1a\u9047\u5230\u4e00\u4e2a\u6781\u5176\u5c34\u5c2c\u7684\u201c\u53d1\u538b\u673a\u5185\u5377\u60e8\u6848\u201d&#xff1a;<\/p>\n<p>\u56e2\u961f\u65a5\u5de8\u8d44\u7533\u8bf7\u4e86 32 \u53f0 64 \u6838\u7269\u7406\u670d\u52a1\u5668&#xff0c;\u90e8\u7f72\u4e86\u6570\u767e\u4e2a Locust Worker \u8282\u70b9&#xff0c;\u96c4\u5fc3\u52c3\u52c3\u5730\u8ba1\u5212\u538b\u6d4b\u51fa 30 \u4e07 QPS\u3002\u7136\u800c&#xff0c;\u5f53\u5e76\u53d1\u865a\u62df\u7528\u6237\u6570\u521a\u62c9\u5230 5 \u4e07\u65f6&#xff0c;\u88ab\u6d4b\u670d\u52a1\u7684 CPU \u8fd8\u6ca1\u5f00\u59cb\u70ed\u8eab&#xff0c;\u8d1f\u8d23\u6c47\u603b\u7684 Locust Master \u8282\u70b9\u5374\u7a81\u7136\u5931\u53bb\u4e86\u54cd\u5e94&#xff0c;\u63a7\u5236\u53f0 Web \u754c\u9762\u5361\u6b7b\u767d\u5c4f&#xff0c;\u76d1\u63a7\u66f2\u7ebf\u5168\u90e8\u65ad\u6d41&#xff1b;\u4e0e\u6b64\u540c\u65f6&#xff0c;\u5341\u51e0\u4e2a Worker \u5bb9\u5668\u56e0\u4e3a\u5185\u5b58\u66b4\u6da8\u76f8\u7ee7\u88ab Linux OOM Killer \u5f3a\u884c\u65a9\u9996&#xff01;<\/p>\n<p>\u6d4b\u8bd5\u56e2\u961f\u5927\u60ca\u5931\u8272&#xff0c;\u8bef\u4ee5\u4e3a\u88ab\u6d4b\u7f51\u7edc\u88ab\u538b\u7a7f\u4e86&#xff0c;\u7ed3\u679c\u767b\u5f55\u53d1\u538b\u96c6\u7fa4\u4e00\u67e5&#xff0c;\u5168\u662f\u88ab\u53d1\u538b\u673a\u81ea\u5df1\u7684\u8fdb\u7a0b\u5c38\u4f53\u7ed9\u7838\u6b7b\u7684\u3002<\/p>\n<p>Locust \u539f\u751f\u57fa\u4e8e Python \u7684 gevent \u534f\u7a0b\u4e0e ZeroMQ \u5206\u5e03\u5f0f\u6d88\u606f\u603b\u7ebf\u6784\u5efa\u3002\u5982\u679c\u4e0d\u5bf9\u53d1\u538b\u673a\u81ea\u8eab\u7684 Master-Worker \u901a\u4fe1\u9891\u7387\u3001\u534f\u7a0b\u5783\u573e\u56de\u6536\u4ee5\u53ca\u64cd\u4f5c\u7cfb\u7edf\u5e95\u5c42 TCP \u6808\u8fdb\u884c\u9488\u5bf9\u6027\u7684\u6df1\u5ea6\u8c03\u4f18&#xff0c;\u53d1\u538b\u673a\u96c6\u7fa4\u81ea\u8eab\u5c31\u4f1a\u7387\u5148\u6ca6\u4e3a\u6574\u573a\u538b\u6d4b\u4e2d\u6700\u8106\u5f31\u7684\u201c\u6027\u80fd\u7eca\u811a\u77f3\u201d\u3002<\/p>\n<h4>\u53d1\u538b\u673a\u81ea\u8eab\u66b4\u6bd9\u7684\u4e09\u5927\u5e95\u5c42\u786c\u4f24<\/h4>\n<p>\u4e3a\u4ec0\u4e48\u4ee5\u8f7b\u91cf\u8457\u79f0\u7684 Locust \u4f1a\u5728\u8d85\u9ad8\u5e76\u53d1\u4e0b\u628a\u81ea\u5df1\u641e\u5d29&#xff1f;\u5206\u6790\u5e95\u5c42\u6e90\u7801\u4e0e\u8fd0\u884c\u5256\u6790\u706b\u7130\u56fe&#xff0c;\u75c7\u7ed3\u4e3b\u8981\u51fa\u5728\u4e09\u4e2a\u73af\u8282&#xff1a;<\/p>\n<li>ZeroMQ \u6d88\u606f\u98ce\u66b4\u51fb\u57ae Master \u805a\u5408\u5355\u7ebf\u7a0b&#xff1a;\n<ul>\n<li>\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;\u6570\u767e\u4e2a Worker \u8282\u70b9\u6bcf\u9694\u56fa\u5b9a\u65f6\u95f4&#xff08;\u901a\u5e38\u662f 1~2 \u79d2&#xff09;\u5c31\u4f1a\u5c06\u81ea\u5df1\u641c\u96c6\u7684\u8be6\u7ec6\u8bf7\u6c42\u6307\u6807&#xff08;\u5305\u542b\u6bcf\u4e2a API \u7684\u5e73\u5747\u8017\u65f6\u3001\u767e\u5206\u4f4d\u3001\u9519\u8bef\u4fe1\u606f&#xff09;\u901a\u8fc7 ZeroMQ \u5957\u63a5\u5b57\u63a8\u5411 Master&#xff1b;<\/li>\n<li>\u5f53 API \u79cd\u7c7b\u7e41\u591a\u3001Worker \u6570\u91cf\u81a8\u80c0\u5230\u4e0a\u767e\u4e2a\u65f6&#xff0c;Master \u8282\u70b9\u7684\u5355\u4e2a Python \u8fdb\u7a0b\u5fc5\u987b\u5728\u6beb\u79d2\u7ea7\u5185\u53cd\u5e8f\u5217\u5316\u5e76\u805a\u5408\u6570\u4e07\u6761\u7ed3\u6784\u5316\u6570\u636e\u3002Master \u7684\u5355\u6838 CPU \u5f53\u573a\u88ab\u6253\u5230 100%&#xff0c;\u5f15\u53d1 ZeroMQ \u6d88\u606f\u7f13\u51b2\u533a\u6ea2\u51fa&#xff08;High Water Mark&#xff09;&#xff0c;\u5bfc\u81f4\u5fc3\u8df3\u4e22\u5931&#xff0c;\u8bef\u5224\u5168\u96c6\u7fa4 Worker \u6389\u7ebf\u3002<\/li>\n<\/ul>\n<\/li>\n<li>Worker \u8282\u70b9 Gevent \u7eff\u8272\u7ebf\u7a0b\u7684\u4e0a\u4e0b\u6587\u5185\u5b58\u6cc4\u6f0f&#xff1a;\n<ul>\n<li>\u6bcf\u4e2a\u865a\u62df\u7528\u6237&#xff08;Virtual User&#xff09;\u5728\u5e95\u5c42\u5bf9\u5e94\u4e00\u4e2a gevent.Greenlet \u534f\u7a0b\u3002\u5f53\u521b\u5efa 50,000 \u4e2a\u7528\u6237\u65f6&#xff0c;\u5982\u679c\u6bcf\u4e2a\u7528\u6237\u7684 Session \u5185\u90e8\u7f13\u5b58\u4e86\u957f\u8fde\u63a5 Cookie\u3001\u5386\u53f2\u8bf7\u6c42\u4e0a\u4e0b\u6587&#xff0c;\u51e0\u4e07\u4e2a\u534f\u7a0b\u7684\u5806\u5185\u5b58\u4f1a\u4ee5\u6bcf\u5206\u949f\u51e0\u767e\u5146\u7684\u901f\u5ea6\u7a33\u5b9a\u6cc4\u6f0f&#xff0c;\u6700\u7ec8\u5f15\u7206\u5bb9\u5668\u5185\u5b58\u4e0a\u9650\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u672c\u5730\u4e34\u65f6\u7aef\u53e3\u4e0e\u5957\u63a5\u5b57\u6587\u4ef6\u53e5\u67c4\u67af\u7aed&#xff08;Ephemeral Port Exhaustion&#xff09;&#xff1a;\n<ul>\n<li>\u53d1\u538b\u673a\u5728\u53d1\u8d77\u6bcf\u79d2\u6570\u5341\u4e07\u6b21 HTTP \u8bf7\u6c42\u65f6&#xff0c;\u5982\u679c\u6ca1\u6709\u5f00\u542f\u8fde\u63a5\u6c60\u590d\u7528&#xff08;Keep-Alive&#xff09;&#xff0c;\u6bcf\u4e2a\u77ed\u8fde\u63a5\u5173\u95ed\u540e\u90fd\u4f1a\u5728\u5185\u6838\u7559\u4e0b\u957f\u8fbe 60 \u79d2\u7684 TIME_WAIT \u72b6\u6001\u3002\u53d1\u538b\u673a\u7684 65,535 \u4e2a\u53ef\u7528\u7aef\u53e3\u5728\u77ed\u77ed 10 \u79d2\u5185\u88ab\u5f7b\u5e95\u8017\u5c3d&#xff0c;\u5bfc\u81f4\u540e\u7eed\u8bf7\u6c42\u76f4\u63a5\u629b\u51fa Cannot assign requested address\u3002<\/li>\n<\/ul>\n<\/li>\n<h4>\u5206\u5e03\u5f0f\u901a\u4fe1\u62d3\u6251\u4f18\u5316&#xff1a;\u89e3\u8026\u4e0e\u964d\u9891\u805a\u5408<\/h4>\n<p>\u4e3a\u4e86\u8ba9 Master \u80fd\u591f\u4ece\u5bb9\u7edf\u9886\u6570\u767e\u4e2a Worker \u8282\u70b9&#xff0c;\u5fc5\u987b\u5bf9\u5206\u5e03\u5f0f\u901a\u4fe1\u8fdb\u884c\u201c\u7269\u7406\u964d\u566a\u201d&#xff1a;<\/p>\n<p>                    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n                    \u2502     Locust Master \u76d1\u63a7\u603b\u63a7\u53f0   \u2502<br \/>\n                    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25b2\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n                                    \u2502 ZeroMQ \u9ad8\u901f\u6d88\u606f\u603b\u7ebf (\u914d\u7f6e HWM \u7f13\u51b2)<br \/>\n                                    \u2502 \u964d\u4f4e\u7edf\u8ba1\u4e0a\u62a5\u9891\u7387\u81f3 3~5 \u79d2\u4e00\u6b21<br \/>\n                    \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n                    \u2502                               \u2502<br \/>\n        \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510       \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n        \u2502  Locust Worker \u8282\u70b9 01 \u2502       \u2502  Locust Worker \u8282\u70b9 N  \u2502<br \/>\n        \u2502  &#8211; \u7eaf\u5c40\u90e8\u5185\u5b58\u6307\u6807\u805a\u5408   \u2502       \u2502  &#8211; \u7eaf\u5c40\u90e8\u5185\u5b58\u6307\u6807\u805a\u5408   \u2502<br \/>\n        \u2502  &#8211; \u542f\u7528\u8fde\u63a5\u6c60\u957f\u8fde\u63a5\u590d\u7528 \u2502       \u2502  &#8211; \u542f\u7528\u8fde\u63a5\u6c60\u957f\u8fde\u63a5\u590d\u7528 \u2502<br \/>\n        \u2502  &#8211; \u4e25\u683c\u9650\u5236\u672c\u5730 Cookie  \u2502       \u2502  &#8211; \u4e25\u683c\u9650\u5236\u672c\u5730 Cookie  \u2502<br \/>\n        \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518       \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<ul>\n<li>\u538b\u7f29\u6307\u6807\u4e0a\u62a5\u7c92\u5ea6&#xff1a;\u4e0d\u8981\u8ba9 Worker \u9891\u7e41\u628a\u5355\u6b21\u8c03\u7528\u7684\u539f\u59cb\u6570\u636e\u63a8\u7ed9 Master\u3002\u5728 Worker \u5185\u90e8\u589e\u52a0\u805a\u5408\u7f13\u5b58&#xff0c;\u4ec5\u4ee5 3 \u79d2\u4e3a\u5468\u671f\u5411 Master \u4e0a\u62a5\u6c47\u603b\u540e\u7684\u76f4\u65b9\u56fe\u7edf\u8ba1&#xff1b;<\/li>\n<li>\u914d\u7f6e ZeroMQ \u4fdd\u62a4\u6c34\u4f4d&#xff08;ZMQ High Water Mark&#xff09;&#xff1a;\u589e\u5927\u5957\u63a5\u5b57\u7f13\u51b2\u961f\u5217&#xff0c;\u9632\u6b62\u5076\u53d1\u7f51\u7edc\u6296\u52a8\u5bfc\u81f4\u4e22\u5305\u3002<\/li>\n<\/ul>\n<h4>\u5de5\u4e1a\u7ea7\u9ad8\u541e\u5410\u53d1\u538b\u811a\u672c\u4e0e\u8fde\u63a5\u6c60\u8c03\u4f18<\/h4>\n<p>\u5728\u7f16\u5199\u538b\u6d4b\u811a\u672c\u65f6&#xff0c;\u5fc5\u987b\u4e25\u683c\u7981\u6b62\u65e0\u8282\u5236\u7684\u5ba2\u6237\u7aef\u5185\u5b58\u6ede\u7559&#xff1a;<\/p>\n<p>import os<br \/>\nfrom locust import HttpUser, task, between, events<br \/>\nimport urllib3<\/p>\n<p># \u7981\u7528\u5168\u5c40 SSL \u6821\u9a8c\u544a\u8b66&#xff0c;\u6d88\u9664\u63a7\u5236\u53f0\u65e5\u5fd7 IO \u635f\u8017<br \/>\nurllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)<\/p>\n<p>class TunedHighThroughputUser(HttpUser):<br \/>\n    # \u6839\u636e\u4e1a\u52a1\u771f\u5b9e\u6a21\u578b\u8bbe\u7f6e\u6781\u8f7b\u91cf\u7684\u5fae\u79d2\u7ea7\u4f11\u7720<br \/>\n    wait_time &#061; between(0.05, 0.1)<\/p>\n<p>    def on_start(self):<br \/>\n        &#034;&#034;&#034;\u4f18\u5316\u5e95\u5c42 HTTP \u5ba2\u6237\u7aef\u8fde\u63a5\u6c60&#xff0c;\u4e25\u7981\u9891\u7e41\u63e1\u624b&#034;&#034;&#034;<br \/>\n        # 1. \u5f3a\u5236\u590d\u7528\u5e95\u5c42 TCP \u957f\u8fde\u63a5 (Keep-Alive)<br \/>\n        # \u589e\u5927\u6bcf\u4e2a\u53d1\u538b\u7528\u6237\u7684\u672c\u5730\u8fde\u63a5\u6c60\u5bb9\u91cf&#xff0c;\u9632\u6b62\u5e76\u53d1\u4e89\u7528<br \/>\n        adapter &#061; self.client.mount(<br \/>\n            &#034;http:\/\/&#034;,<br \/>\n            urllib3.HTTPConnectionPool(<br \/>\n                host&#061;&#034;gateway.target.corp&#034;,<br \/>\n                maxsize&#061;50,<br \/>\n                block&#061;False<br \/>\n            )<br \/>\n        )<\/p>\n<p>        # 2. \u4e25\u7981\u65e0\u8282\u5236\u4fdd\u5b58\u54cd\u5e94\u6587\u672c&#xff08;\u9632 Worker \u5185\u5b58 OOM \u7684\u7edd\u62db&#xff01;&#xff09;<br \/>\n        # \u9ed8\u8ba4 requests \u4f1a\u628a\u51e0\u5146\u7684 response.text \u5b58\u8fdb\u5185\u5b58&#xff0c;\u5927\u5e76\u53d1\u4e0b\u77ac\u95f4\u6491\u7206\u5806&#xff01;<br \/>\n        # \u5fc5\u987b\u4ec5\u5728\u6821\u9a8c\u9519\u8bef\u65f6\u6309\u9700\u8bfb\u53d6\u6d41<\/p>\n<p>    &#064;task<br \/>\n    def execute_core_benchmark(self):<br \/>\n        # \u6838\u5fc3\u673a\u5bc6&#xff1a;\u4f7f\u7528 stream&#061;True \u907f\u514d\u4e00\u6b21\u6027\u5c06\u54cd\u5e94\u5168\u91cf\u8bfb\u5165\u5185\u5b58<br \/>\n        with self.client.get(&#034;\/api\/v1\/health_check&#034;, stream&#061;True, catch_response&#061;True) as resp:<br \/>\n            if resp.status_code &#061;&#061; 200:<br \/>\n                # \u4ec5\u8bfb\u53d6\u524d 64 \u5b57\u8282\u5feb\u901f\u65ad\u8a00&#xff0c;\u968f\u540e\u7acb\u5373\u91ca\u653e\u7f51\u7edc\u6d41<br \/>\n                chunk &#061; resp.raw.read(64)<br \/>\n                resp.success()<br \/>\n            else:<br \/>\n                resp.failure(f&#034;\u670d\u52a1\u5f02\u5e38: {resp.status_code}&#034;)<\/p>\n<h4>\u53d1\u538b\u673a Linux \u64cd\u4f5c\u7cfb\u7edf\u7684\u7f51\u7edc\u5185\u6838\u795e\u7ea7\u8c03\u4f18<\/h4>\n<p>\u8981\u60f3\u8ba9\u5355\u53f0\u53d1\u538b\u673a\u8f70\u51fa 10 \u4e07\u4ee5\u4e0a\u7684 QPS&#xff0c;\u53d1\u538b\u673a\u81ea\u8eab\u7684\u64cd\u4f5c\u7cfb\u7edf\u7f51\u7edc\u6808\u5fc5\u987b\u6267\u884c\u6700\u6fc0\u8fdb\u7684\u5185\u6838\u4f18\u5316&#xff08;\/etc\/sysctl.conf&#xff09;&#xff1a;<\/p>\n<p># 1. \u5141\u8bb8\u53d1\u538b\u673a\u5185\u6838\u91cd\u7528\u5904\u4e8e TIME_WAIT \u72b6\u6001\u7684\u5957\u63a5\u5b57\u8fdb\u884c\u65b0\u7684\u5916\u8054&#xff01;(\u6781\u4e3a\u5173\u952e)<br \/>\nnet.ipv4.tcp_tw_reuse &#061; 1<\/p>\n<p># 2. \u6269\u5927\u672c\u5730\u53ef\u7528\u4e34\u65f6\u7aef\u53e3\u8303\u56f4\u81f3\u6700\u5927\u6781\u9650 (\u53ef\u63d0\u4f9b\u6574\u6574 64,500 \u4e2a\u7aef\u53e3)<br \/>\nnet.ipv4.ip_local_port_range &#061; 1024 65535<\/p>\n<p># 3. \u7f29\u77ed\u5957\u63a5\u5b57\u5b64\u513f\u72b6\u6001\u8d85\u65f6\u65f6\u95f4&#xff0c;\u4ece\u9ed8\u8ba4\u7684 60 \u79d2\u5f3a\u529b\u538b\u7f29\u81f3 15 \u79d2&#xff01;<br \/>\nnet.ipv4.tcp_fin_timeout &#061; 15<\/p>\n<p># 4. \u589e\u5927\u6700\u5927\u6392\u961f\u5957\u63a5\u5b57\u6570\u91cf\u4e0e\u7cfb\u7edf\u7ea7\u53e5\u67c4\u4e0a\u9650<br \/>\nfs.file-max &#061; 2097152<br \/>\nnet.core.somaxconn &#061; 65535<br \/>\nnet.ipv4.tcp_max_syn_backlog &#061; 32768<\/p>\n<p># 5. \u589e\u5927 TCP \u53d1\u9001\u4e0e\u63a5\u6536\u7f13\u51b2\u533a&#xff0c;\u4fdd\u969c\u5343\u5146\/\u4e07\u5146\u5e26\u5bbd\u5168\u901f\u6253\u6ee1<br \/>\nnet.ipv4.tcp_wmem &#061; 4096 65536 16777216<br \/>\nnet.ipv4.tcp_rmem &#061; 4096 87380 16777216<\/p>\n<p>\u6267\u884c sysctl -p \u77ac\u95f4\u6fc0\u6d3b\u751f\u6548\u3002<\/p>\n<h4>\u8c03\u4f18\u524d\u540e\u7684\u5168\u771f\u538b\u6d4b\u6570\u636e\u590d\u76d8<\/h4>\n<p>\u5728\u7531 8 \u53f0 32 \u6838\u9ad8\u914d\u53d1\u538b\u673a\u642d\u5efa\u7684\u5206\u5e03\u5f0f\u6d4b\u8bd5\u96c6\u7fa4\u4e0a&#xff0c;\u9488\u5bf9\u6838\u5fc3\u7f51\u5173\u8fdb\u884c\u6781\u9650\u538b\u6d4b\u8c03\u4f18\u524d\u540e\u7684\u5bf9\u6bd4&#xff1a;<\/p>\n<table>\n<tr>\u538b\u6d4b\u96c6\u7fa4\u6838\u5fc3\u6307\u6807\u8c03\u4f18\u524d (\u9ed8\u8ba4\u914d\u7f6e&#xff0c;\u53d1\u538b\u673a\u5d29\u76d8)\u6df1\u5ea6\u8c03\u4f18\u540e (ZeroMQ\u964d\u9891&#043;\u5185\u6838\u4f18\u5316)\u6539\u5584\u6210\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u53d1\u538b\u673a\u6781\u9650\u53ef\u53d1\u5c04 QPS<\/td>\n<td>48,000 QPS (\u968f\u540e Master \u5047\u6b7b)<\/td>\n<td>265,000 QPS (\u8d85\u5f3a\u706b\u529b\u8f93\u51fa)<\/td>\n<td>\u53d1\u538b\u80fd\u529b\u63d0\u5347 5.5 \u500d&#xff01;<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u4e2a Worker \u5185\u5b58\u5360\u7528<\/td>\n<td>\u6301\u7eed\u66b4\u6da8\u81f3 4.2 GB \u89e6\u53d1 OOM<\/td>\n<td>\u5e73\u7a33\u9501\u5b9a\u5728 320 MB \u9ec4\u91d1\u6c34\u4f4d<\/td>\n<td>\u5185\u5b58\u5360\u7528\u7f29\u51cf 92.3%<\/td>\n<\/tr>\n<tr>\n<td>\u53d1\u538b\u673a\u672c\u5730\u8fde\u63a5\u5931\u8d25\u62a5\u9519\u7387<\/td>\n<td>18.2% (Cannot assign address)<\/td>\n<td>0.0% (\u7aef\u53e3\u5feb\u901f\u590d\u7528&#xff0c;\u96f6\u62a5\u9519)<\/td>\n<td>\u5f7b\u5e95\u6d88\u9664\u4f2a\u5047\u6027\u9519\u8bef<\/td>\n<\/tr>\n<tr>\n<td>Master \u63a7\u5236\u53f0 Web \u754c\u9762\u72b6\u6001<\/td>\n<td>\u9891\u7e41\u65ad\u6d41\u3001\u5361\u6b7b\u767d\u5c4f<\/td>\n<td>\u79d2\u7ea7\u5b9e\u65f6\u5e73\u6ed1\u5237\u65b0<\/td>\n<td>\u538b\u6d4b\u638c\u63a7\u529b\u5168\u9762\u62c9\u6ee1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u751f\u4ea7\u538b\u6d4b\u7684\u7ec8\u6781\u4fee\u517b<\/h4>\n<p>\u5de5\u6b32\u5584\u5176\u4e8b&#xff0c;\u5fc5\u5148\u5229\u5176\u5668\u3002\u538b\u6d4b\u4ece\u6765\u4e0d\u662f\u201c\u62c9\u51e0\u53f0\u673a\u5668\u628a\u547d\u4ee4\u8dd1\u8d77\u6765\u201d\u90a3\u4e48\u7b80\u5355\u3002<\/p>\n<p>\u770b\u6e05\u53d1\u538b\u5de5\u5177\u81ea\u8eab\u7684\u7269\u7406\u74f6\u9888&#xff0c;\u61c2\u5f97\u7528\u8fde\u63a5\u6c60\u5b88\u62a4\u53d1\u538b\u673a\u7684\u5185\u5b58&#xff0c;\u7528\u5185\u6838\u53c2\u6570\u91ca\u653e\u7f51\u5361\u7684\u7aef\u53e3\u6f5c\u80fd\u3002\u53ea\u6709\u5148\u6253\u9020\u51fa\u4e00\u652f\u7eaa\u5f8b\u4e25\u660e\u3001\u575a\u4e0d\u53ef\u6467\u7684\u53d1\u538b\u673a\u96c6\u7fa4&#xff0c;\u6211\u4eec\u624d\u80fd\u5728\u53cc 11 \u7684\u5927\u8003\u6765\u4e34\u4e4b\u524d&#xff0c;\u771f\u6b63\u6d4b\u51fa\u88ab\u6d4b\u4e1a\u52a1\u7cfb\u7edf\u6700\u771f\u5b9e\u3001\u6700\u53ef\u4fe1\u7684\u6781\u9650\u5e95\u724c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7ec4\u7ec7\u53cc 11 \u5bb9\u91cf\u6478\u9ad8\u6216\u8005\u5927\u89c4\u6a21\u7cfb\u7edf\u6781\u9650\u538b\u6d4b\u65f6&#xff0c;\u5f88\u591a\u6d4b\u8bd5\u8d1f\u8d23\u4eba\u5e38\u5e38\u4f1a\u9047\u5230\u4e00\u4e2a\u6781\u5176\u5c34\u5c2c\u7684\u201c\u53d1\u538b\u673a\u5185\u5377\u60e8\u6848\u201d&#xff1a;<br \/>\n\u56e2\u961f\u65a5\u5de8\u8d44\u7533\u8bf7\u4e86 32 \u53f0 64 \u6838\u7269\u7406\u670d\u52a1\u5668&#xff0c;\u90e8\u7f72\u4e86\u6570\u767e\u4e2a Locust Worker \u8282\u70b9&#xff0c;\u96c4\u5fc3\u52c3\u52c3\u5730\u8ba1\u5212\u538b\u6d4b\u51fa 30 \u4e07 QPS\u3002\u7136\u800c&#xff0c;\u5f53\u5e76\u53d1\u865a\u62df\u7528\u6237\u6570\u521a\u62c9\u5230 5 \u4e07\u65f6&#xff0c;\u88ab\u6d4b\u670d\u52a1\u7684 CPU \u8fd8\u6ca1\u5f00\u59cb\u70ed\u8eab&#xff0c;\u8d1f\u8d23\u6c47\u603b\u7684 Locust Master \u8282\u70b9\u5374\u7a81\u7136\u5931\u53bb\u4e86\u54cd\u5e94&amp;<\/p>\n","protected":false},"author":2,"featured_media":115329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,50,292,100,51],"topic":[],"class_list":["post-115330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ai","tag-50","tag-292","tag-100","tag-51"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115330.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728\u7ec4\u7ec7\u53cc 11 \u5bb9\u91cf\u6478\u9ad8\u6216\u8005\u5927\u89c4\u6a21\u7cfb\u7edf\u6781\u9650\u538b\u6d4b\u65f6&#xff0c;\u5f88\u591a\u6d4b\u8bd5\u8d1f\u8d23\u4eba\u5e38\u5e38\u4f1a\u9047\u5230\u4e00\u4e2a\u6781\u5176\u5c34\u5c2c\u7684\u201c\u53d1\u538b\u673a\u5185\u5377\u60e8\u6848\u201d&#xff1a; \u56e2\u961f\u65a5\u5de8\u8d44\u7533\u8bf7\u4e86 32 \u53f0 64 \u6838\u7269\u7406\u670d\u52a1\u5668&#xff0c;\u90e8\u7f72\u4e86\u6570\u767e\u4e2a Locust Worker \u8282\u70b9&#xff0c;\u96c4\u5fc3\u52c3\u52c3\u5730\u8ba1\u5212\u538b\u6d4b\u51fa 30 \u4e07 QPS\u3002\u7136\u800c&#xff0c;\u5f53\u5e76\u53d1\u865a\u62df\u7528\u6237\u6570\u521a\u62c9\u5230 5 \u4e07\u65f6&#xff0c;\u88ab\u6d4b\u670d\u52a1\u7684 CPU \u8fd8\u6ca1\u5f00\u59cb\u70ed\u8eab&#xff0c;\u8d1f\u8d23\u6c47\u603b\u7684 Locust Master \u8282\u70b9\u5374\u7a81\u7136\u5931\u53bb\u4e86\u54cd\u5e94&amp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115330.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-11T14:41:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011144056-6acb9ff873ac8.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115330.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115330.html\",\"name\":\"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-11T14:41:02+00:00\",\"dateModified\":\"2026-10-11T14:41:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115330.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115330.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115330.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115330.html","og_locale":"zh_CN","og_type":"article","og_title":"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728\u7ec4\u7ec7\u53cc 11 \u5bb9\u91cf\u6478\u9ad8\u6216\u8005\u5927\u89c4\u6a21\u7cfb\u7edf\u6781\u9650\u538b\u6d4b\u65f6&#xff0c;\u5f88\u591a\u6d4b\u8bd5\u8d1f\u8d23\u4eba\u5e38\u5e38\u4f1a\u9047\u5230\u4e00\u4e2a\u6781\u5176\u5c34\u5c2c\u7684\u201c\u53d1\u538b\u673a\u5185\u5377\u60e8\u6848\u201d&#xff1a; \u56e2\u961f\u65a5\u5de8\u8d44\u7533\u8bf7\u4e86 32 \u53f0 64 \u6838\u7269\u7406\u670d\u52a1\u5668&#xff0c;\u90e8\u7f72\u4e86\u6570\u767e\u4e2a Locust Worker \u8282\u70b9&#xff0c;\u96c4\u5fc3\u52c3\u52c3\u5730\u8ba1\u5212\u538b\u6d4b\u51fa 30 \u4e07 QPS\u3002\u7136\u800c&#xff0c;\u5f53\u5e76\u53d1\u865a\u62df\u7528\u6237\u6570\u521a\u62c9\u5230 5 \u4e07\u65f6&#xff0c;\u88ab\u6d4b\u670d\u52a1\u7684 CPU \u8fd8\u6ca1\u5f00\u59cb\u70ed\u8eab&#xff0c;\u8d1f\u8d23\u6c47\u603b\u7684 Locust Master \u8282\u70b9\u5374\u7a81\u7136\u5931\u53bb\u4e86\u54cd\u5e94&amp;","og_url":"https:\/\/www.wsisp.com\/helps\/115330.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-11T14:41:02+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261011144056-6acb9ff873ac8.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115330.html","url":"https:\/\/www.wsisp.com\/helps\/115330.html","name":"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-11T14:41:02+00:00","dateModified":"2026-10-11T14:41:02+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115330.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115330.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115330.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Locust \u5206\u5e03\u5f0f\u538b\u6d4b\u6027\u80fd\u8c03\u4f18\uff1a\u53d1\u538b\u673a Master-Worker \u67b6\u6784\u901a\u4fe1\u4e0e\u5185\u5b58\u8c03\u4f18"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115330"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115330\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/115329"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115330"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}