{"id":34658,"date":"2025-04-30T09:00:44","date_gmt":"2025-04-30T01:00:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/34658.html"},"modified":"2025-04-30T09:00:44","modified_gmt":"2025-04-30T01:00:44","slug":"spring-cloud-gateway-%e5%8d%a0%e6%bb%a1%e6%9c%8d%e5%8a%a1%e5%99%a8cpu","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/34658.html","title":{"rendered":"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu"},"content":{"rendered":"<p>\u67e5\u770b gateway\u8fdb\u7a0b\u72b6\u6001\u53d1\u73b0\u00a0<\/p>\n<p>7301 \u00a0XNIO-1 I\/O-2 \u00a0 \u00a095.3% 7298 \u00a0XNIO-1 I\/O-1 \u00a0 \u00a094.4% \u4e24\u4e2a\u7ebf\u7a0b\u5360\u7528\u5927<\/p>\n<ul>\n<li>\n<p>XNIO \u662f Undertow \u7684\u5e95\u5c42 NIO \u7f51\u7edc\u5e93&#xff0c;\u7528\u4e8e\u975e\u963b\u585e\u7f51\u7edc IO\u3002<\/p>\n<\/li>\n<li>\n<p>\u5982\u679c\u51fa\u73b0\u9ad8 CPU&#xff0c;\u53ef\u80fd\u662f\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5904\u7406\u67d0\u4e9b \u963b\u585e\u4efb\u52a1\u3001\u8d85\u9ad8\u9891\u8bf7\u6c42 \u6216\u8005 \u7f51\u7edc\u8fde\u63a5\u5361\u6b7b\u4f46\u672a\u5173\u95ed\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"879\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250430010042-6811763a79e30.png\" width=\"1457\" \/><\/p>\n<p>\u76f2\u731c\u662fUndertow\u5bfc\u81f4\u7684\u95ee\u9898<\/p>\n<p>\u00a0\u5728pox\u91cc\u9762\u679c\u771f\u627e\u5230\u4e86Undertow<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"455\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250430010043-6811763b02764.png\" width=\"1040\" \/><\/p>\n<p>&#xff0c;\u8fd9\u65f6\u5019\u6211\u4eec\u770b\u770b\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5e72\u561b<\/p>\n<p>\u8981\u5728 jstack \u91cc\u627e\u5230\u5b83\u4eec&#xff0c;\u9700\u8981\u628a\u8fd9\u4e24\u4e2a\u5341\u8fdb\u5236\u7684 TID \u8f6c\u6210\u5341\u516d\u8fdb\u5236&#xff1a;<\/p>\n<p>printf &#034;7301 \u2192 0x%x\\\\n7298 \u2192 0x%x\\\\n&#034; 7301 7298 \u00a0<\/p>\n<p>\u4f7f\u7528jdk\u7684 jstack&#xff08;\u5148\u4fdd\u8bc1\u4f60\u6709&#xff0c;\u4f60\u53ef\u4ee5\u70b9\u8fdbbin\u91cc\u9762\u770b\u6709\u6ca1\u6709jstack&#xff09;\u5bfc\u51fadump.txt<\/p>\n<p>\/home\/java\/openJDk\/jdk-17.0.15\/bin\/jstack 4603 &gt; dump.txt<\/p>\n<p>\u5b83\u4f1a\u5728\u4f60\u5f53\u524d\u6240\u5728\u7684\u76ee\u5f55\u5bfc\u51fa\u4e00\u4e2a dump.txt<\/p>\n<p>\u7136\u540e\u4f60\u5c31\u6253\u5f00\u8fd9\u4e2atxt\u641c\u7d220x1c85\u548c0x1c82<\/p>\n<p>\u8fd9\u91cc\u662f\u6808\u4fe1\u606f&#xff0c;\u53ef\u4ee5\u5206\u6790\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5e72\u4ec0\u4e48<\/p>\n<p>&#034;XNIO-1 I\/O-2&#034; #71 prio&#061;5 os_prio&#061;0 cpu&#061;342102189.69ms elapsed&#061;357373.87s tid&#061;0x00007f9afd09c250 nid&#061;0x1c85 runnable \u00a0[0x00007f9a846fd000] \u00a0 \u00a0java.lang.Thread.State: RUNNABLE \u00a0\u00a0 \u00a0at org.xnio.nio.WorkerThread.run(WorkerThread.java:480)<\/p>\n<\/p>\n<p>&#034;XNIO-1 I\/O-1&#034; #70 prio&#061;5 os_prio&#061;0 cpu&#061;341952471.37ms elapsed&#061;357373.88s tid&#061;0x00007f9afd09b570 nid&#061;0x1c82 runnable \u00a0[0x00007f9a847fe000] \u00a0 \u00a0java.lang.Thread.State: RUNNABLE \u00a0\u00a0 \u00a0at sun.nio.ch.EPoll.wait(java.base&#064;17.0.15\/Native Method) \u00a0\u00a0 \u00a0at sun.nio.ch.EPollSelectorImpl.doSelect(java.base&#064;17.0.15\/EPollSelectorImpl.java:118) \u00a0\u00a0 \u00a0at sun.nio.ch.SelectorImpl.lockAndDoSelect(java.base&#064;17.0.15\/SelectorImpl.java:129) \u00a0\u00a0 \u00a0&#8211; locked &lt;0x00000000e18de358&gt; (a sun.nio.ch.Util$2) \u00a0\u00a0 \u00a0&#8211; locked &lt;0x00000000e18de260&gt; (a sun.nio.ch.EPollSelectorImpl) \u00a0\u00a0 \u00a0at sun.nio.ch.SelectorImpl.select(java.base&#064;17.0.15\/SelectorImpl.java:146) \u00a0\u00a0 \u00a0at org.xnio.nio.WorkerThread.run(WorkerThread.java:532)<\/p>\n<p>\u53ef\u4ee5\u770b\u5230<\/p>\n<ul>\n<li>\n<p>\u7ebf\u7a0b\u6765\u6e90\u662f XNIO&#xff08;Undertow \u7684 NIO \u5e95\u5c42&#xff09; \u7ebf\u7a0b\u540d XNIO-1 I\/O-* \u660e\u786e\u8bf4\u660e\u4f60\u5728\u8dd1\u7684\u662f Undertow \u7684 I\/O \u7ebf\u7a0b\u6c60&#xff0c;\u4e0d\u662f Gateway \u9ed8\u8ba4\u7684 Reactor Netty\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e3a\u4ec0\u4e48\u4f1a\u9ad8 CPU&#xff1f;<\/p>\n<ul>\n<li>\n<p>XNIO-1 I\/O-2 \u76f4\u63a5\u5728 WorkerThread.run \u4e3b\u5faa\u73af\u91cc&#xff0c;\u4e00\u76f4 RUNNABLE&#xff0c;\u8bf4\u660e\u5b83\u4e0d\u505c\u5730\u5728\u505a select &#043; \u4e8b\u4ef6\u5206\u53d1&#xff0c;\u5373\u4fbf\u5728\u7a7a\u95f2\u65f6\u4e5f\u53ef\u80fd\u4f7f\u7528\u201c\u5fd9\u8f6e\u8be2\u201d&#xff08;busy-spin&#xff09;\u6a21\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>XNIO-1 I\/O-1 \u867d\u7136\u5361\u5728\u4e86 EPoll.wait&#xff0c;\u4f46\u56e0\u4e3a XNIO \u9ed8\u8ba4\u53ef\u80fd\u628a epoll \u8c03\u7528 timeout \u8bbe\u7f6e\u4e3a 0 \u6216\u975e\u5e38\u77ed&#xff0c;\u4e5f\u4f1a\u975e\u5e38\u9891\u7e41\u5730\u5524\u9192\u518d select&#xff0c;\u4ece\u800c\u6d88\u8017\u5927\u91cf CPU\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u7528Undertow\u7406\u8bba\u4e0a\u662f\u6ca1\u6709\u95ee\u9898\u7684<\/p>\n<p>Undertow\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u3001\u7075\u6d3b\u7684\u3001\u9ad8\u6027\u80fd\u7684\u975e\u963b\u585e\u6027\u5e94\u7528\u670d\u52a1\u5668&#xff0c;\u7531JBoss\u63d0\u4f9b\u3002\u5b83\u53ef\u4ee5\u7528\u4f5c\u5d4c\u5165\u5f0f\u670d\u52a1\u5668&#xff0c;\u4e5f\u53ef\u4ee5\u7528\u4f5c\u5927\u578b\u9879\u76ee\u7684\u5168\u529f\u80fd\u5e94\u7528\u670d\u52a1\u5668\u3002Undertow\u7684\u8bbe\u8ba1\u4ee5\u63d0\u4f9b\u6700\u9ad8\u7684\u6027\u80fd\u548c\u6700\u5927\u7684\u7075\u6d3b\u6027\u4e3a\u4e3b\u8981\u76ee\u6807&#xff0c;\u652f\u6301\u975e\u963b\u585e\u6027\u548c\u963b\u585e\u6027\u5904\u7406\u65b9\u5f0f&#xff0c;\u53ef\u4ee5\u5904\u7406\u5341\u4e07\u7ea7\u7684\u5e76\u53d1\u8fde\u63a5\u3002<\/p>\n<\/p>\n<p>\u95ee\u9898\u53ef\u80fd\u51fa\u5728\u4f60\u7684\u4f9d\u8d56\u5f15\u5165\u4e86spring-boot-starter-web<\/p>\n<h4>\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u5f15\u5165 spring-boot-starter-web<\/h4>\n<ul>\n<li>\n<p>spring-boot-starter-web \u662f\u57fa\u4e8e Servlet &#043; Spring MVC \u7684\u6808&#xff0c;\u9ed8\u8ba4\u5185\u5d4c Tomcat&#xff08;\u6216\u8005\u4f60\u663e\u5f0f\u6539\u6210 Undertow&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e00\u65e6\u4f60\u7684\u5e94\u7528\u91cc\u6709\u4e86 Servlet \u5bb9\u5668&#xff08;Tomcat\/Undertow&#xff09;&#xff0c;Spring Boot \u5c31\u4f1a\u628a WebFlux&#xff08;reactive&#xff09;\u6a21\u5f0f\u5173\u95ed&#xff0c;\u8d70 Servlet \u6a21\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>\u800c Spring Cloud Gateway \u662f\u57fa\u4e8e Reactor Netty&#xff08;\u7eaf\u5f02\u6b65\u975e\u963b\u585e&#xff09;\u7684&#xff0c;\u5e95\u5c42\u4f9d\u8d56 Reactor Netty \u7684 reactor-http-* \u7ebf\u7a0b\u6c60&#xff0c;\u8def\u7531\u8f6c\u53d1\u3001\u8fc7\u6ee4\u5668\u94fe\u3001\u9650\u6d41\u7b49\u90fd\u8d70\u7684\u5f02\u6b65\u903b\u8f91\u3002<\/p>\n<\/li>\n<li>\n<p>\u52a0\u4e86 spring-boot-starter-web \u4ee5\u540e&#xff0c;\u7f51\u5173\u4f1a\u88ab\u8feb\u8dd1\u5230\u4e00\u4e2a\u963b\u585e\u7684 Servlet \u5bb9\u5668\u91cc&#xff0c;\u53cd\u800c\u5f15\u51fa\u4f60\u73b0\u5728\u770b\u5230\u7684 XNIO&#xff08;Undertow \u7684\u5e95\u5c42 NIO&#xff09;\u7ebf\u7a0b&#xff0c;\u5e76\u4e14\u6240\u6709\u7684\u8f6c\u53d1\u3001\u8fc7\u6ee4\u90fd\u6210\u4e86\u963b\u585e\u8c03\u7528&#xff0c;\u4e0d\u4ec5\u4e0d\u9ad8\u6548&#xff0c;\u8fd8\u5bb9\u6613\u6b7b\u9501\u3001\u65e0\u9650\u91cd\u8bd5\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4f46\u662f\u4e0d\u5de7\u7684\u662f&#xff0c;\u6211\u7684gateway\u7684pom\u6ca1\u6709\u89c1\u5230spring-boot-starter-web\u7684\u8eab\u5f71&#xff0c;\u8bf4\u660e\u4e0d\u662f\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>\u90a3\u6ca1\u529e\u6cd5\u4e86&#xff0c;\u53ea\u80fd\u56de\u5f52 Gateway \u6807\u914d \u2014 Reactor Netty\u00a0<\/p>\n<p>\u79fb\u9664<\/p>\n<ul>\n<li>\n<p>spring-boot-starter-web&#xff08;\u5982\u679c\u6709&#xff09;<\/p>\n<\/li>\n<li>\n<p>spring-boot-starter-undertow&#xff08;\u5982\u679c\u6709&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h4><\/h4>\n<h4>\u00a0application.yml \u52a0\u4e0a web-application-type<\/h4>\n<p>\u5728\u4f60\u7684 application.yml \u5934\u90e8&#xff0c;\u52a0\u4e0a\u8fd9\u51e0\u884c&#xff1a;<\/p>\n<p>spring: \u00a0 main: \u00a0 \u00a0 web-application-type: reactive \u00a0<\/p>\n<p>\u7136\u540e\u91cd\u65b0\u6253\u5305\u91cd\u65b0\u4e0a\u4f20jar\u5305\u8fd0\u884c<\/p>\n<p>\u7ec8\u4e8e\u6e05\u723d\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"505\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250430010043-6811763b53d08.png\" width=\"321\" \/><\/p>\n<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5f53\u4f60\u628a Spring Cloud Gateway \u90e8\u7f72\u5230 Undertow&#xff08;\u5373 Servlet \u5bb9\u5668&#xff09;\u4e0a&#xff0c;\u800c\u4e0d\u662f\u8d70\u5b83\u5185\u7f6e\u7684 Reactor Netty&#xff0c;\u5e95\u5c42\u5c31\u4e0d\u518d\u7528\u201c\u963b\u585e\u5f0f epoll \u7b49\u5f85\u201d&#xff0c;\u800c\u662f\u53d8\u6210\u4e86 XNIO \u7684 \u5fd9\u8f6e\u8be2&#xff08;busy-spin&#xff09;\u6a21\u578b\u2014\u2014\u51e0\u4e4e\u65e0\u95f4\u65ad\u5730\u8c03\u7528 Selector.select(0) \u6216\u76f4\u63a5\u5728 WorkerThread.run() \u7684\u4e3b\u5faa\u73af\u91cc\u6253\u8f6c\u3002<\/p>\n<p>\u4ece\u4f60\u8d34\u7684\u7ebf\u7a0b\u6808\u770b&#xff1a;<\/p>\n<p>css<\/p>\n<p>&#034;XNIO-1 I\/O-2&#034; \u2026 at org.xnio.nio.WorkerThread.run(WorkerThread.java:480) &#034;XNIO-1 I\/O-1&#034; \u2026 at sun.nio.ch.EPoll.wait(Native Method) at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:118) at org.xnio.nio.WorkerThread.run(WorkerThread.java:532) <\/p>\n<ul>\n<li>\n<p>XNIO-1 I\/O-2 \u4e00\u76f4\u5728 WorkerThread.run() \u7684\u4e3b\u5faa\u73af\u91cc\u505a \u201c\u6536\u6d88\u606f \u2192 \u5206\u53d1 \u2192 \u518d\u6536\u201d \u7684\u5de5\u4f5c&#xff0c;\u5373\u4fbf\u7a7a\u95f2\u4e5f\u5728\u4e0d\u505c\u5faa\u73af&#xff1b;<\/p>\n<\/li>\n<li>\n<p>XNIO-1 I\/O-1 \u5361\u5728\u4e86 EPoll.wait&#xff0c;\u4f46 XNIO \u9ed8\u8ba4\u7ed9 epoll \u7684 \u8d85\u65f6\u65f6\u95f4\u4e3a 0&#xff08;\u6216\u8005\u975e\u5e38\u77ed&#xff09;&#xff0c;\u4e8e\u662f\u5b83\u6839\u672c\u4e0d\u963b\u585e&#xff0c;\u7acb\u523b\u8fd4\u56de\u518d\u4e0b\u4e00\u6b21 select\u2014\u2014\u8fd9\u5c31\u76f8\u5f53\u4e8e\u5728\u201c\u6b7b\u5faa\u73af\u201d\u4e2d\u4e0d\u65ad\u5730\u5524\u9192\u548c\u8f6e\u8be2\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4e24\u4e2a\u7ebf\u7a0b\u90fd\u5904\u4e8e RUNNABLE \u72b6\u6001\u3001CPU \u5168\u901f\u8fd0\u8f6c&#xff0c;\u7ed3\u679c\u5c31\u662f 100% \u7684\u5360\u7528\u7387\u3002<\/p>\n<hr \/>\n<h3>\u4e3a\u4ec0\u4e48 Reactor Netty \u6ca1\u6709\u8fd9\u4e2a\u95ee\u9898&#xff1f;<\/h3>\n<ul>\n<li>\n<p>Reactor Netty \u7684 epoll\/kqueue \u7b49\u5f85\u662f \u963b\u585e\u5f0f \u7684&#xff1a;\u5f53\u6ca1\u6709\u4e8b\u4ef6\u65f6&#xff0c;\u5185\u6838\u4f1a\u628a\u7ebf\u7a0b\u6302\u8d77&#xff0c;\u76f4\u5230\u6709\u7f51\u7edc\u53ef\u8bfb\u5199\u6216\u8d85\u65f6\u624d\u5524\u9192\u2014\u2014\u56e0\u6b64\u7a7a\u95f2\u65f6\u51e0\u4e4e\u4e0d\u6d88\u8017 CPU\u3002<\/p>\n<\/li>\n<li>\n<p>XNIO \u4e3a\u4e86\u6781\u9650\u7684\u4f4e\u5ef6\u8fdf&#xff0c;\u9ed8\u8ba4\u4f7f\u7528 busy-spin idle strategy&#xff0c;\u727a\u7272 CPU \u5468\u671f\u53bb\u6362\u53d6\u4e9a\u5fae\u79d2\u7ea7\u7684\u5524\u9192\u65f6\u95f4&#xff0c;\u4f46\u5728 Gateway \u8fd9\u79cd\u5e76\u53d1\u4e0d\u6781\u7aef\u3001\u4e8b\u4ef6\u91cf\u4e0d\u7b97\u5929\u91cf\u7684\u573a\u666f\u4e0b\u5c31\u663e\u5f97\u201c\u5484\u5484\u903c\u4eba\u201d\u2014\u2014\u4e0d\u505c\u5730\u5728\u7a7a\u4e2d\u6253\u8f6c\u3002<\/p>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5c0f\u7ed3<\/h3>\n<ul>\n<li>\n<p>Undertow\/XNIO&#xff1a;\u5fd9\u8f6e\u8be2 \u21d2 \u9ad8\u5b9e\u65f6\u6027 \u21d2 CPU \u98d9\u5347<\/p>\n<\/li>\n<li>\n<p>Reactor Netty&#xff1a;\u963b\u585e\u5f0f epoll \u7b49\u5f85 \u21d2 \u4f4e\u7a7a\u95f2\u6d88\u8017 \u21d2 Gateway \u63a8\u8350<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u5b98\u65b9\u5f3a\u70c8\u5efa\u8bae Spring Cloud Gateway \u4e00\u5b9a\u8981\u8dd1\u5728 WebFlux &#043; Reactor Netty \u6a21\u5f0f\u4e0b&#xff1a;\u5b83\u7684\u6240\u6709\u8c03\u5ea6\u3001\u9650\u6d41\u3001\u7194\u65ad\u3001\u8def\u7531\u673a\u5236\u90fd\u662f\u56f4\u7ed5 Reactor \u4e8b\u4ef6\u5faa\u73af\u8bbe\u8ba1\u7684&#xff0c;\u653e\u5230 XNIO \u4e0a\u5c31\u4f1a\u51fa\u73b0\u8fd9\u79cd 100% CPU \u7684\u201c\u7a7a\u8f6c\u201d\u60c5\u51b5\u3002<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb767\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf10\u6b21\u3002\u67e5\u770b gateway\u8fdb\u7a0b\u72b6\u6001\u53d1\u73b0\u4e24\u4e2a\u7ebf\u7a0b\u5360\u7528\u5927XNIO\u662f Undertow \u7684\u5e95\u5c42 NIO \u7f51\u7edc\u5e93\uff0c\u7528\u4e8e\u975e\u963b\u585e\u7f51\u7edc IO\u3002\u5982\u679c\u51fa\u73b0\u9ad8 CPU\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5904\u7406\u67d0\u4e9b\u6216\u8005\u3002\u76f2\u731c\u662fUndertow\u5bfc\u81f4\u7684\u95ee\u9898\u5728pox\u91cc\u9762\u679c\u771f\u627e\u5230\u4e86Undertow\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u770b\u770b\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5e72\u561b\u8981\u5728jstack\u91cc\u627e\u5230\u5b83\u4eec\uff0c\u9700\u8981\u628a\u8fd9\u4e24\u4e2a\u5341\u8fdb\u5236\u7684 TID \u8f6c\u6210\u5341\u516d\u8fdb\u5236\uff1a\u4f7f\u7528jdk\u7684 jstack\uff08\u5148\u4fdd\u8bc1\u4f60\u6709\uff0c\u4f60\u53ef\u4ee5\u70b9\u8fdbbin\u91cc\u9762\u770b\u6709\u6ca1\u6709jstack\uff09\u5bfc\u51fadump.txt\u3002<\/p>\n","protected":false},"author":2,"featured_media":34655,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[43,44],"topic":[],"class_list":["post-34658","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu - \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\/34658.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb767\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf10\u6b21\u3002\u67e5\u770b gateway\u8fdb\u7a0b\u72b6\u6001\u53d1\u73b0\u4e24\u4e2a\u7ebf\u7a0b\u5360\u7528\u5927XNIO\u662f Undertow \u7684\u5e95\u5c42 NIO \u7f51\u7edc\u5e93\uff0c\u7528\u4e8e\u975e\u963b\u585e\u7f51\u7edc IO\u3002\u5982\u679c\u51fa\u73b0\u9ad8 CPU\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5904\u7406\u67d0\u4e9b\u6216\u8005\u3002\u76f2\u731c\u662fUndertow\u5bfc\u81f4\u7684\u95ee\u9898\u5728pox\u91cc\u9762\u679c\u771f\u627e\u5230\u4e86Undertow\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u770b\u770b\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5e72\u561b\u8981\u5728jstack\u91cc\u627e\u5230\u5b83\u4eec\uff0c\u9700\u8981\u628a\u8fd9\u4e24\u4e2a\u5341\u8fdb\u5236\u7684 TID \u8f6c\u6210\u5341\u516d\u8fdb\u5236\uff1a\u4f7f\u7528jdk\u7684 jstack\uff08\u5148\u4fdd\u8bc1\u4f60\u6709\uff0c\u4f60\u53ef\u4ee5\u70b9\u8fdbbin\u91cc\u9762\u770b\u6709\u6ca1\u6709jstack\uff09\u5bfc\u51fadump.txt\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/34658.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-30T01:00:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250430010042-6811763a79e30.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\/34658.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/34658.html\",\"name\":\"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-30T01:00:44+00:00\",\"dateModified\":\"2025-04-30T01:00:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/34658.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/34658.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/34658.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu\"}]},{\"@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":"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu - \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\/34658.html","og_locale":"zh_CN","og_type":"article","og_title":"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb767\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf10\u6b21\u3002\u67e5\u770b gateway\u8fdb\u7a0b\u72b6\u6001\u53d1\u73b0\u4e24\u4e2a\u7ebf\u7a0b\u5360\u7528\u5927XNIO\u662f Undertow \u7684\u5e95\u5c42 NIO \u7f51\u7edc\u5e93\uff0c\u7528\u4e8e\u975e\u963b\u585e\u7f51\u7edc IO\u3002\u5982\u679c\u51fa\u73b0\u9ad8 CPU\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5904\u7406\u67d0\u4e9b\u6216\u8005\u3002\u76f2\u731c\u662fUndertow\u5bfc\u81f4\u7684\u95ee\u9898\u5728pox\u91cc\u9762\u679c\u771f\u627e\u5230\u4e86Undertow\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u770b\u770b\u8fd9\u4e24\u4e2a\u7ebf\u7a0b\u5728\u5e72\u561b\u8981\u5728jstack\u91cc\u627e\u5230\u5b83\u4eec\uff0c\u9700\u8981\u628a\u8fd9\u4e24\u4e2a\u5341\u8fdb\u5236\u7684 TID \u8f6c\u6210\u5341\u516d\u8fdb\u5236\uff1a\u4f7f\u7528jdk\u7684 jstack\uff08\u5148\u4fdd\u8bc1\u4f60\u6709\uff0c\u4f60\u53ef\u4ee5\u70b9\u8fdbbin\u91cc\u9762\u770b\u6709\u6ca1\u6709jstack\uff09\u5bfc\u51fadump.txt\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/34658.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-30T01:00:44+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250430010042-6811763a79e30.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\/34658.html","url":"https:\/\/www.wsisp.com\/helps\/34658.html","name":"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-30T01:00:44+00:00","dateModified":"2025-04-30T01:00:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/34658.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/34658.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/34658.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Spring Cloud gateway \u5360\u6ee1\u670d\u52a1\u5668cpu"}]},{"@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\/34658","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=34658"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/34658\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/34655"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=34658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=34658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=34658"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=34658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}