{"id":84789,"date":"2026-07-26T17:56:52","date_gmt":"2026-07-26T09:56:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/84789.html"},"modified":"2026-07-26T17:56:52","modified_gmt":"2026-07-26T09:56:52","slug":"%e3%80%90java%e9%9d%a2%e8%af%95%e3%80%91-%e5%88%86%e5%b8%83%e5%bc%8f%e6%9e%b6%e6%9e%84","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/84789.html","title":{"rendered":"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784"},"content":{"rendered":"<p>\u597d\u7684&#xff0c;\u6211\u4eec\u7ee7\u7eed\u6309\u7167\u539f\u5927\u7eb2&#xff0c;\u8865\u5145 \u5fae\u670d\u52a1\u4e0e\u5206\u5e03\u5f0f&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u9ad8\u5e76\u53d1\u4e0e\u67b6\u6784&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4e91\u539f\u751f&#xff08;\u2605\u2605\u2605\u2605\u2606&#xff09;\u3001\u5236\u9020\u4e1a\u4e0e\u8de8\u5883\u7535\u5546&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4ee3\u7801\u80fd\u529b\u4e0e\u7ebf\u4e0a\u6392\u67e5&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09; \u7b49\u5269\u4f59\u6838\u5fc3\u6a21\u5757\u3002\u8fd9\u90e8\u5206\u662f\u9ad8\u7ea7\u5de5\u7a0b\u5e08\u7684\u201c\u5206\u6c34\u5cad\u201d&#xff0c;\u6db5\u76d6\u4e86\u4ece\u4ee3\u7801\u843d\u5730\u5230\u67b6\u6784\u8bbe\u8ba1\u3001\u518d\u5230\u884c\u4e1a\u573a\u666f\u843d\u5730\u7684\u5b8c\u6574\u95ed\u73af\u3002<\/p>\n<hr \/>\n<h2>\u516d\u3001\u5fae\u670d\u52a1\u4e0e\u5206\u5e03\u5f0f\u67b6\u6784&#xff08;\u6838\u5fc3\u80fd\u529b 15% &#043; 15%&#xff09;<\/h2>\n<h3>6.1 Spring Cloud \u751f\u6001\u6838\u5fc3\u7ec4\u4ef6\u7cbe\u8bb2<\/h3>\n<h4>6.1.1 \u670d\u52a1\u6ce8\u518c\u4e0e\u53d1\u73b0&#xff1a;Nacos&#xff08;\u963f\u91cc\u53cc\u6a21\u6ce8\u518c\u4e2d\u5fc3&#xff09;<\/h4>\n<p>Nacos \u6700\u5927\u7684\u7279\u70b9\u662f\u540c\u65f6\u652f\u6301 CP \u548c AP \u6a21\u5f0f&#xff08;\u901a\u8fc7 spring.cloud.nacos.discovery.ephemeral \u63a7\u5236&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u6a21\u5f0f\u4e00\u81f4\u6027\u534f\u8bae\u9002\u7528\u573a\u666f\u6570\u636e\u5b58\u50a8<\/tr>\n<tbody>\n<tr>\n<td>AP \u6a21\u5f0f&#xff08;\u4e34\u65f6\u5b9e\u4f8b&#xff0c;\u9ed8\u8ba4&#xff09;<\/td>\n<td>Distro &#043; \u5f02\u6b65\u5fc3\u8df3<\/td>\n<td>\u670d\u52a1\u53d1\u73b0&#xff08;\u6ce8\u91cd\u53ef\u7528\u6027&#xff0c;\u5141\u8bb8\u77ed\u6682\u4e0d\u4e00\u81f4&#xff09;<\/td>\n<td>\u5185\u5b58 &#043; \u5f02\u6b65\u6301\u4e45\u5316<\/td>\n<\/tr>\n<tr>\n<td>CP \u6a21\u5f0f&#xff08;\u6301\u4e45\u5b9e\u4f8b&#xff09;<\/td>\n<td>Raft \u534f\u8bae<\/td>\n<td>\u914d\u7f6e\u7ba1\u7406\u3001\u5206\u5e03\u5f0f\u9501&#xff08;\u6ce8\u91cd\u4e00\u81f4\u6027&#xff09;<\/td>\n<td>\u78c1\u76d8 &#043; \u65e5\u5fd7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u673a\u5236&#xff1a;<\/p>\n<ul>\n<li>\u670d\u52a1\u5fc3\u8df3&#xff1a;\u5ba2\u6237\u7aef\u6bcf 5 \u79d2\u53d1\u9001\u5fc3\u8df3&#xff0c;\u82e5 15 \u79d2\u672a\u6536\u5230\u5219\u6807\u8bb0\u4e3a\u4e0d\u5065\u5eb7&#xff0c;30 \u79d2\u672a\u6536\u5230\u5219\u5254\u9664\u3002<\/li>\n<li>\u670d\u52a1\u4fdd\u62a4\u9608\u503c&#xff08;Protection Threshold&#xff09; &#xff1a;\u5f53\u5065\u5eb7\u5b9e\u4f8b\u6bd4\u4f8b\u4f4e\u4e8e\u9608\u503c&#xff08;\u5982 0.3&#xff09;\u65f6&#xff0c;Nacos \u4f1a\u8fd4\u56de\u6240\u6709\u5b9e\u4f8b&#xff08;\u5305\u62ec\u4e0d\u5065\u5eb7\u7684&#xff09;&#xff0c;\u9632\u6b62\u6240\u6709\u6d41\u91cf\u56e0\u5c11\u6570\u5b9e\u4f8b\u5b95\u673a\u800c\u5b8c\u5168\u7194\u65ad&#xff08;\u96ea\u5d29\u4fdd\u62a4&#xff09;\u3002<\/li>\n<li>\u914d\u7f6e\u4e2d\u5fc3&#xff1a;\u652f\u6301 &#064;NacosValue \u52a8\u6001\u5237\u65b0\u3001\u76d1\u542c\u5668\u56de\u8c03&#xff08;Listener&#xff09;\u3001\u591a\u73af\u5883\u9694\u79bb&#xff08;Namespace &#043; Group &#043; DataId&#xff09;\u3002<\/li>\n<\/ul>\n<h4>6.1.2 \u58f0\u660e\u5f0f\u8fdc\u7a0b\u8c03\u7528&#xff1a;OpenFeign<\/h4>\n<ul>\n<li>\u6838\u5fc3\u539f\u7406&#xff1a;\u5229\u7528 Spring \u7684 &#064;Import &#043; FactoryBean &#043; JDK \u52a8\u6001\u4ee3\u7406\u3002Feign \u5ba2\u6237\u7aef\u63a5\u53e3\u88ab\u4ee3\u7406\u540e&#xff0c;\u65b9\u6cd5\u8c03\u7528\u88ab\u7f16\u7801\u4e3a HTTP \u8bf7\u6c42&#xff08;\u901a\u8fc7 Contract \u89e3\u6790\u6ce8\u89e3&#xff0c;Encoder \u5e8f\u5217\u5316\u53c2\u6570&#xff0c;Client \u6267\u884c HTTP \u8c03\u7528&#xff09;\u3002<\/li>\n<li>\u6027\u80fd\u4f18\u5316\u8981\u70b9&#xff1a;\n<ul>\n<li>\u8fde\u63a5\u6c60&#xff1a;\u5fc5\u987b\u914d\u7f6e feign.httpclient.enabled&#061;true \u5e76\u5f15\u5165 Apache HttpClient \u6216 OkHttp&#xff0c;\u66ff\u4ee3\u9ed8\u8ba4\u7684 HttpURLConnection&#xff08;\u65e0\u8fde\u63a5\u6c60&#xff0c;\u6bcf\u6b21\u65b0\u5efa\u8fde\u63a5&#xff09;\u3002<\/li>\n<li>\u8d85\u65f6\u8bbe\u7f6e&#xff1a;connectTimeout&#xff08;\u8fde\u63a5\u8d85\u65f6&#xff09;\u4e0e readTimeout&#xff08;\u8bfb\u53d6\u8d85\u65f6&#xff09;\u5fc5\u987b\u533a\u5206\u8bbe\u7f6e&#xff0c;\u9632\u6b62\u4e0b\u6e38\u6162 SQL \u62d6\u57ae\u4e0a\u6e38\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u7194\u65ad\u96c6\u6210&#xff1a;feign.sentinel.enabled&#061;true&#xff08;\u82e5\u5f15\u5165 Sentinel&#xff09;&#xff0c;\u53ef\u5b9e\u73b0\u8c03\u7528\u5931\u8d25\u65f6\u7684\u964d\u7ea7\u903b\u8f91&#xff08;fallback \u6216 fallbackFactory&#xff0c;\u53ef\u6355\u83b7\u5f02\u5e38&#xff09;\u3002<\/li>\n<\/ul>\n<h4>6.1.3 API \u7f51\u5173&#xff1a;Spring Cloud Gateway&#xff08;\u57fa\u4e8e WebFlux&#xff09;<\/h4>\n<ul>\n<li>\u6838\u5fc3\u67b6\u6784&#xff1a;Route&#xff08;\u8def\u7531&#xff09; &#043; Predicate&#xff08;\u65ad\u8a00\u5de5\u5382&#xff09; &#043; Filter&#xff08;\u8fc7\u6ee4\u5668&#xff09;\u3002<\/li>\n<li>\u5de5\u4f5c\u539f\u7406&#xff1a;Netty \u63a5\u6536\u8bf7\u6c42 \u2192 \u901a\u8fc7 RoutePredicateHandlerMapping \u5339\u914d\u8def\u7531 \u2192 \u8c03\u7528 FilteringWebHandler \u6267\u884c\u5168\u5c40\u8fc7\u6ee4\u5668\u94fe&#xff08;Global Filter Chain&#xff09; \u2192 \u8f6c\u53d1\u5230\u540e\u7aef\u5fae\u670d\u52a1\u3002<\/li>\n<li>\u5173\u952e\u8fc7\u6ee4\u5668&#xff1a;\n<ul>\n<li>RetryGatewayFilterFactory&#xff1a;\u91cd\u8bd5\u673a\u5236&#xff08;\u9700\u8c28\u614e\u914d\u7f6e&#xff0c;\u9632\u6b62\u5e42\u7b49\u6027\u95ee\u9898&#xff09;\u3002<\/li>\n<li>RequestRateLimiterGatewayFilterFactory&#xff1a;\u57fa\u4e8e Redis &#043; Lua \u811a\u672c\u5b9e\u73b0\u4ee4\u724c\u6876\u9650\u6d41\u3002<\/li>\n<li>\u81ea\u5b9a\u4e49\u5168\u5c40\u8fc7\u6ee4\u5668&#xff1a;\u5b9e\u73b0 GlobalFilter &#043; Ordered&#xff0c;\u7528\u4e8e\u7edf\u4e00\u9274\u6743\u3001\u65e5\u5fd7\u67d3\u8272&#xff08;TraceId \u6ce8\u5165&#xff09;\u3001\u8bf7\u6c42\u7be1\u6539\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u4e0e Zuul 1.x \u5bf9\u6bd4&#xff1a;Gateway \u57fa\u4e8e\u975e\u963b\u585e&#xff08;Netty &#043; Reactor&#xff09;&#xff0c;\u6027\u80fd\u8fdc\u8d85\u540c\u6b65\u963b\u585e\u7684 Zuul 1.x&#xff1b;Zuul 2.x \u867d\u4e5f\u5f02\u6b65&#xff0c;\u4f46\u793e\u533a\u6d3b\u8dc3\u5ea6\u4e0d\u53ca Gateway\u3002<\/li>\n<\/ul>\n<h4>6.1.4 \u7194\u65ad\u3001\u9650\u6d41\u3001\u964d\u7ea7&#xff1a;Sentinel&#xff08;\u963f\u91cc\u6d41\u91cf\u9632\u536b\u5175&#xff09;<\/h4>\n<p>Sentinel \u6bd4 Hystrix \u8bbe\u8ba1\u66f4\u4f18&#xff08;Hystrix \u5df2\u8fdb\u5165\u7ef4\u62a4\u72b6\u6001&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u7279\u6027SentinelHystrix<\/tr>\n<tbody>\n<tr>\n<td>\u9650\u6d41\u7ef4\u5ea6<\/td>\n<td>\u652f\u6301 QPS\u3001\u7ebf\u7a0b\u6570\u3001\u7cfb\u7edf\u8d1f\u8f7d&#xff08;\u81ea\u9002\u5e94&#xff09;\u3001\u70ed\u70b9\u53c2\u6570<\/td>\n<td>\u4ec5\u7ebf\u7a0b\u6c60\/\u4fe1\u53f7\u91cf\u9694\u79bb<\/td>\n<\/tr>\n<tr>\n<td>\u7194\u65ad\u7b56\u7565<\/td>\n<td>\u6162\u8c03\u7528\u6bd4\u4f8b\u3001\u5f02\u5e38\u6bd4\u4f8b\u3001\u5f02\u5e38\u6570&#xff08;\u6ed1\u52a8\u7a97\u53e3\u5b9e\u65f6\u7edf\u8ba1&#xff09;<\/td>\n<td>\u57fa\u4e8e\u6ed1\u52a8\u7a97\u53e3\u7684\u5931\u8d25\u7387&#xff0c;\u9700\u914d\u7f6e metrics.rollingStats.timeInMilliseconds<\/td>\n<\/tr>\n<tr>\n<td>\u89c4\u5219\u6301\u4e45\u5316<\/td>\n<td>\u652f\u6301\u52a8\u6001\u6570\u636e\u6e90&#xff08;Nacos\u3001Apollo\u3001Zookeeper&#xff09;<\/td>\n<td>\u9700\u81ea\u884c\u6269\u5c55<\/td>\n<\/tr>\n<tr>\n<td>\u63a7\u5236\u53f0<\/td>\n<td>\u529f\u80fd\u5f3a\u5927&#xff08;\u5b9e\u65f6\u76d1\u63a7\u3001\u89c4\u5219\u63a8\u9001\u3001\u673a\u5668\u5217\u8868&#xff09;<\/td>\n<td>\u7b80\u964b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6838\u5fc3\u5de5\u4f5c\u6d41\u7a0b&#xff08;Slot Chain&#xff09;&#xff1a;<\/p>\n<li>NodeSelectorSlot&#xff1a;\u6784\u5efa\u8d44\u6e90\u8c03\u7528\u94fe\u3002<\/li>\n<li>ClusterBuilderSlot&#xff1a;\u7edf\u8ba1\u96c6\u7fa4\u7ef4\u5ea6\u6570\u636e\u3002<\/li>\n<li>StatisticSlot&#xff1a;\u5b9e\u65f6\u7edf\u8ba1 QPS\u3001\u54cd\u5e94\u65f6\u95f4\u3001\u5f02\u5e38\u6570\u3002<\/li>\n<li>ParamFlowSlot&#xff1a;\u70ed\u70b9\u53c2\u6570\u9650\u6d41&#xff08;\u5982 userId \u7ef4\u5ea6&#xff09;\u3002<\/li>\n<li>SystemSlot&#xff1a;\u7cfb\u7edf\u81ea\u9002\u5e94\u4fdd\u62a4&#xff08;CPU\u3001Load\u3001RT&#xff09;\u3002<\/li>\n<li>FlowSlot&#xff1a;\u6d41\u63a7\u89c4\u5219\u5224\u65ad&#xff08;QPS\/\u7ebf\u7a0b\u6570&#xff09;\u3002<\/li>\n<li>DegradeSlot&#xff1a;\u7194\u65ad\u964d\u7ea7\u5224\u65ad\u3002<\/li>\n<li>AuthoritySlot&#xff1a;\u9ed1\u767d\u540d\u5355\u6388\u6743\u3002<\/li>\n<p>\u751f\u4ea7\u6700\u4f73\u5b9e\u8df5&#xff1a;\u6240\u6709 Feign \u8c03\u7528\u548c HTTP \u5165\u53e3\u5747\u914d\u7f6e &#064;SentinelResource&#xff0c;\u5e76\u6307\u5b9a blockHandler&#xff08;\u9650\u6d41\u89e6\u53d1&#xff09;\u548c fallback&#xff08;\u5f02\u5e38\u89e6\u53d1&#xff09;&#xff0c;\u914d\u5408 Nacos \u5b9e\u73b0\u89c4\u5219\u52a8\u6001\u63a8\u9001\u3002<\/p>\n<hr \/>\n<h3>6.2 \u5206\u5e03\u5f0f\u7406\u8bba\u57fa\u77f3&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;<\/h3>\n<h4>6.2.1 CAP \u5b9a\u7406&#xff08;\u5e03\u9c81\u5c14\u5b9a\u7406&#xff09;<\/h4>\n<p>\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d&#xff0c;\u4e00\u81f4\u6027&#xff08;C&#xff09;\u3001\u53ef\u7528\u6027&#xff08;A&#xff09;\u3001\u5206\u533a\u5bb9\u9519\u6027&#xff08;P&#xff09; \u4e09\u8005\u4e0d\u53ef\u517c\u5f97&#xff0c;\u6700\u591a\u53ea\u80fd\u540c\u65f6\u6ee1\u8db3\u4e24\u4e2a\u3002<\/p>\n<table>\n<tr>\u573a\u666f\u9009\u62e9\u5178\u578b\u4e2d\u95f4\u4ef6<\/tr>\n<tbody>\n<tr>\n<td>\u7f51\u7edc\u6b63\u5e38&#xff08;\u65e0\u5206\u533a&#xff09;<\/td>\n<td>CA&#xff08;\u4f46\u7f51\u7edc\u5206\u533a\u662f\u5e38\u6001&#xff0c;\u6545\u57fa\u672c\u4e0d\u8ba8\u8bba\u7eaf CA&#xff09;<\/td>\n<td>\u5355\u673a\u6570\u636e\u5e93<\/td>\n<\/tr>\n<tr>\n<td>\u53d1\u751f\u7f51\u7edc\u5206\u533a&#xff08;\u5fc5\u9009 P&#xff09;<\/td>\n<td>CP&#xff08;\u727a\u7272\u53ef\u7528\u6027&#xff0c;\u4fdd\u8bc1\u4e00\u81f4\u6027&#xff09;<\/td>\n<td>ZooKeeper\u3001Etcd\u3001HBase<\/td>\n<\/tr>\n<tr>\n<td>\u53d1\u751f\u7f51\u7edc\u5206\u533a&#xff08;\u5fc5\u9009 P&#xff09;<\/td>\n<td>AP&#xff08;\u727a\u7272\u4e00\u81f4\u6027&#xff0c;\u4fdd\u8bc1\u53ef\u7528\u6027&#xff0c;\u6700\u7ec8\u4e00\u81f4&#xff09;<\/td>\n<td>Eureka\u3001Nacos&#xff08;AP \u6a21\u5f0f&#xff09;\u3001Cassandra\u3001RocketMQ<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728\u5fae\u670d\u52a1\u4e2d\u7684\u6743\u8861&#xff1a;\u6ce8\u518c\u4e2d\u5fc3\u901a\u5e38\u9009 AP&#xff08;\u670d\u52a1\u53d1\u73b0\u5b81\u53ef\u8bfb\u5230\u65e7\u5730\u5740&#xff0c;\u4e5f\u4e0d\u80fd\u5b8c\u5168\u4e0d\u53ef\u7528&#xff09;&#xff1b;\u914d\u7f6e\u4e2d\u5fc3\/\u5206\u5e03\u5f0f\u9501\u901a\u5e38\u9009 CP&#xff08;\u5b81\u53ef\u77ed\u6682\u65e0\u6cd5\u83b7\u53d6\u914d\u7f6e&#xff0c;\u4e5f\u4e0d\u80fd\u8bfb\u5230\u9519\u8bef\u914d\u7f6e&#xff09;\u3002<\/p>\n<h4>6.2.2 BASE \u7406\u8bba&#xff08;AP \u7684\u5ef6\u4f38&#xff09;<\/h4>\n<ul>\n<li>Basically Available&#xff08;\u57fa\u672c\u53ef\u7528&#xff09;&#xff1a;\u6545\u969c\u65f6\u5141\u8bb8\u635f\u5931\u90e8\u5206\u529f\u80fd\u6216\u54cd\u5e94\u65f6\u95f4\u3002<\/li>\n<li>Soft state&#xff08;\u8f6f\u72b6\u6001&#xff09;&#xff1a;\u7cfb\u7edf\u72b6\u6001\u5141\u8bb8\u4e2d\u95f4\u72b6\u6001&#xff08;\u5982\u6570\u636e\u540c\u6b65\u5ef6\u8fdf&#xff09;\u3002<\/li>\n<li>Eventually consistent&#xff08;\u6700\u7ec8\u4e00\u81f4\u6027&#xff09;&#xff1a;\u7ecf\u8fc7\u4e00\u6bb5\u65f6\u95f4\u540e&#xff0c;\u6570\u636e\u6700\u7ec8\u8fbe\u5230\u4e00\u81f4\u3002<\/li>\n<\/ul>\n<p>\u5b9e\u8df5\u843d\u5730&#xff1a;\u8ba2\u5355\u72b6\u6001\u201c\u652f\u4ed8\u4e2d\u201d\u662f\u8f6f\u72b6\u6001&#xff0c;\u901a\u8fc7\u6d88\u606f\u961f\u5217\u6216\u5b9a\u65f6\u5bf9\u8d26\u4efb\u52a1\u4fdd\u8bc1\u6700\u7ec8\u4e00\u81f4\u6027\u3002<\/p>\n<hr \/>\n<h3>6.3 \u5206\u5e03\u5f0f\u4e8b\u52a1\u89e3\u51b3\u65b9\u6848&#xff08;\u2605\u2605\u2605\u2605\u2605 \u6838\u5fc3\u96be\u70b9&#xff09;<\/h3>\n<h4>6.3.1 \u4e24\u9636\u6bb5\u63d0\u4ea4&#xff08;XA&#xff09;\u2014\u2014 \u5f3a\u4e00\u81f4\u6027<\/h4>\n<ul>\n<li>\u539f\u7406&#xff1a;Transaction Manager \u534f\u8c03\u591a\u4e2a\u8d44\u6e90\u7ba1\u7406\u5668&#xff08;RM&#xff09;&#xff0c;\u5206 Prepare \u548c Commit \u4e24\u9636\u6bb5\u3002<\/li>\n<li>\u5b9e\u73b0&#xff1a;Seata \u7684 AT \u6a21\u5f0f&#xff08;\u57fa\u4e8e XA \u6539\u826f&#xff09;\u6216 Atomikos\u3002<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u963b\u585e\u5f0f\u9501\u8d44\u6e90&#xff08;Prepare \u540e\u4e00\u76f4\u6301\u6709\u9501&#xff09;&#xff0c;\u6027\u80fd\u5dee&#xff0c;\u4e0d\u9002\u5408\u9ad8\u5e76\u53d1&#xff1b;\u4ec5\u9002\u5408\u77ed\u4e8b\u52a1\u3002<\/li>\n<\/ul>\n<h4>6.3.2 TCC&#xff08;Try-Confirm-Cancel&#xff09;\u2014\u2014 \u67d4\u6027\u4e8b\u52a1<\/h4>\n<p>\u4e09\u4e2a\u9636\u6bb5&#xff1a;<\/p>\n<li>Try&#xff1a;\u9884\u7559\u4e1a\u52a1\u8d44\u6e90&#xff08;\u5982\u6263\u51cf\u5e93\u5b58\u65f6&#xff0c;\u5c06\u5e93\u5b58\u4ece\u201c\u53ef\u7528\u201d\u51bb\u7ed3\u4e3a\u201c\u5df2\u5206\u914d\u201d&#xff09;\u3002<\/li>\n<li>Confirm&#xff1a;\u786e\u8ba4\u6267\u884c&#xff08;\u51bb\u7ed3\u5e93\u5b58\u771f\u6b63\u6263\u51cf&#xff0c;\u751f\u6210\u8ba2\u5355&#xff09;\u3002<\/li>\n<li>Cancel&#xff1a;\u53d6\u6d88\u56de\u6eda&#xff08;\u91ca\u653e\u51bb\u7ed3\u5e93\u5b58&#xff09;\u3002<\/li>\n<p>\u4e09\u5927\u96be\u9898&#xff08;\u5fc5\u987b\u89e3\u51b3&#xff0c;\u2605\u2605\u2605\u2605\u2605&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\u7a7a\u56de\u6eda&#xff08;Empty Rollback&#xff09;&#xff1a;Try \u672a\u6267\u884c&#xff08;\u7f51\u7edc\u8d85\u65f6\u6216\u672a\u6536\u5230\u8bf7\u6c42&#xff09;&#xff0c;Cancel \u5148\u5230\u8fbe\u3002\u5fc5\u987b\u5141\u8bb8 Cancel \u5728\u65e0 Try \u8bb0\u5f55\u65f6\u76f4\u63a5\u8fd4\u56de\u6210\u529f&#xff08;\u4f7f\u7528\u4e8b\u52a1\u65e5\u5fd7\u8868\u5224\u65ad&#xff09;\u3002<\/li>\n<li>\u60ac\u6302&#xff08;Suspension&#xff09;&#xff1a;Cancel \u5148\u6267\u884c&#xff08;\u7a7a\u56de\u6eda&#xff09;&#xff0c;\u540e\u7eed Try \u518d\u5230\u8fbe&#xff0c;\u6b64\u65f6 Try \u5e94\u88ab\u76f4\u63a5\u62d2\u7edd&#xff08;\u9632\u6b62\u8d44\u6e90\u88ab\u9519\u8bef\u9884\u7559&#xff09;\u3002\u65b9\u6848&#xff1a;\u4f7f\u7528\u4e3b\u952e\u6216 transaction_id \u72b6\u6001\u5224\u65ad&#xff0c;\u82e5\u5df2 Cancel&#xff0c;\u5219 Try \u76f4\u63a5\u8fd4\u56de\u5931\u8d25\u3002<\/li>\n<li>\u5e42\u7b49\u6027&#xff08;Idempotent&#xff09;&#xff1a;Try\u3001Confirm\u3001Cancel \u90fd\u53ef\u80fd\u88ab\u91cd\u8bd5&#xff08;\u7f51\u7edc\u6296\u52a8&#xff09;&#xff0c;\u5fc5\u987b\u652f\u6301\u5e42\u7b49&#xff08;\u901a\u8fc7\u4e8b\u52a1 ID \u5224\u91cd&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u8ba2\u5355\u652f\u4ed8\u3001\u79ef\u5206\u6263\u51cf\u7b49\u5f3a\u4e00\u81f4\u6027\u4f46\u5141\u8bb8\u77ed\u6682\u4e2d\u95f4\u72b6\u6001\u7684\u573a\u666f\u3002<\/p>\n<h4>6.3.3 Saga&#xff08;\u957f\u4e8b\u52a1\u8865\u507f&#xff09;\u2014\u2014 \u4e0d\u7528 Try \u9884\u7559<\/h4>\n<ul>\n<li>\u539f\u7406&#xff1a;\u5c06\u957f\u4e8b\u52a1\u62c6\u5206\u4e3a\u591a\u4e2a\u672c\u5730\u4e8b\u52a1&#xff08;\u5b50\u4e8b\u52a1&#xff09;&#xff0c;\u6bcf\u4e2a\u5b50\u4e8b\u52a1\u90fd\u6709\u5bf9\u5e94\u7684\u8865\u507f\u64cd\u4f5c&#xff08;Compensation&#xff09;\u3002<\/li>\n<li>\u6267\u884c\u6a21\u5f0f&#xff1a;\n<ul>\n<li>\u5411\u524d\u6062\u590d&#xff08;Forward Recovery&#xff09;&#xff1a;\u5b50\u4e8b\u52a1\u5931\u8d25\u540e&#xff0c;\u91cd\u8bd5\u76f4\u5230\u6210\u529f&#xff08;\u9002\u5408\u6700\u7ec8\u6210\u529f\u7684\u573a\u666f&#xff09;\u3002<\/li>\n<li>\u5411\u540e\u6062\u590d&#xff08;Backward Recovery&#xff09;&#xff1a;\u5b50\u4e8b\u52a1\u5931\u8d25\u540e&#xff0c;\u9006\u5411\u4f9d\u6b21\u6267\u884c\u4e4b\u524d\u5df2\u6210\u529f\u5b50\u4e8b\u52a1\u7684\u8865\u507f\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u534f\u8c03\u65b9\u5f0f&#xff1a;\n<ul>\n<li>\u7f16\u6392&#xff08;Choreography&#xff09;&#xff1a;\u5404\u670d\u52a1\u901a\u8fc7\u4e8b\u4ef6&#xff08;MQ&#xff09;\u81ea\u884c\u89e6\u53d1\u4e0b\u4e00\u4e2a\u5b50\u4e8b\u52a1&#xff08;\u89e3\u8026&#xff0c;\u4f46\u94fe\u8def\u590d\u6742\u96be\u8ffd\u8e2a&#xff09;\u3002<\/li>\n<li>\u63a7\u5236&#xff08;Orchestration&#xff0c;\u63a8\u8350&#xff09;&#xff1a;\u7531 Saga \u534f\u8c03\u5668 \u96c6\u4e2d\u63a7\u5236&#xff08;\u5982 Seata Saga\u3001Apache Camel&#xff09;&#xff0c;\u4fbf\u4e8e\u7ba1\u7406\u548c\u76d1\u63a7\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u9002\u7528\u573a\u666f&#xff1a;\u8de8\u591a\u4e2a\u5fae\u670d\u52a1\u7684\u4e1a\u52a1\u6d41\u7a0b&#xff08;\u5982\u65c5\u6e38\u9884\u8ba2&#xff1a;\u8ba2\u9152\u5e97 \u2192 \u8ba2\u673a\u7968 \u2192 \u8ba2\u8f66&#xff09;&#xff0c;\u6bcf\u4e2a\u6b65\u9aa4\u5141\u8bb8\u8f83\u957f\u65f6\u95f4\u3002<\/li>\n<\/ul>\n<h4>6.3.4 \u672c\u5730\u6d88\u606f\u8868 &#043; MQ&#xff08;\u6700\u7ec8\u4e00\u81f4\u6027\u7ecf\u5178\u65b9\u6848&#xff09;<\/h4>\n<ul>\n<li>\u6838\u5fc3\u601d\u60f3&#xff1a;\u5c06\u4e8b\u52a1\u6267\u884c\u548c\u6d88\u606f\u53d1\u9001\u653e\u5728\u540c\u4e00\u4e2a\u672c\u5730\u4e8b\u52a1\u4e2d\u3002<\/li>\n<li>\u6d41\u7a0b&#xff1a;\n<li>\u4e1a\u52a1\u65b9\u6267\u884c\u672c\u5730\u4e8b\u52a1&#xff08;INSERT \u8ba2\u5355&#xff09;&#xff0c;\u540c\u65f6\u5411 \u672c\u5730\u6d88\u606f\u8868 \u63d2\u5165\u4e00\u6761\u201c\u5f85\u53d1\u9001\u201d\u6d88\u606f&#xff08;\u5728\u540c\u4e00\u672c\u5730\u4e8b\u52a1\u4e2d\u63d0\u4ea4&#xff09;\u3002<\/li>\n<li>\u72ec\u7acb\u7684 \u6d88\u606f\u6062\u590d\/\u8f6e\u8be2\u4efb\u52a1&#xff08;\u5b9a\u65f6 Job&#xff09; \u626b\u63cf\u672c\u5730\u6d88\u606f\u8868&#xff0c;\u5c06\u72b6\u6001\u4e3a\u201c\u5f85\u53d1\u9001\u201d\u7684\u6d88\u606f\u6295\u9012\u5230 MQ\u3002<\/li>\n<li>MQ \u6d88\u8d39\u65b9\u6d88\u8d39\u6d88\u606f&#xff0c;\u6267\u884c\u672c\u5730\u4e8b\u52a1&#xff0c;\u6210\u529f\u540e\u5411 MQ \u56de\u4f20 ACK&#xff08;\u6d88\u8d39\u786e\u8ba4&#xff09;\u3002<\/li>\n<li>\u82e5\u6d88\u8d39\u65b9\u6267\u884c\u5931\u8d25&#xff0c;\u6d88\u606f\u91cd\u8bd5\u6216\u8fdb\u5165\u6b7b\u4fe1\u961f\u5217&#xff0c;\u4eba\u5de5\/\u8865\u507f\u673a\u5236\u515c\u5e95\u3002<\/li>\n<\/li>\n<li>\u4f18\u70b9&#xff1a;\u4e0d\u4f9d\u8d56 MQ \u7684\u4e8b\u52a1\u6d88\u606f&#xff08;\u5bf9\u4e2d\u95f4\u4ef6\u65e0\u7279\u6b8a\u8981\u6c42&#xff09;\u3002<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u9700\u8981\u8f6e\u8be2\u626b\u63cf\u8868&#xff0c;\u53ef\u80fd\u4ea7\u751f\u5ef6\u8fdf&#xff1b;\u5bf9\u6570\u636e\u5e93\u538b\u529b\u8f83\u5927&#xff08;\u9700\u5efa\u7d22\u5f15&#xff09;\u3002<\/li>\n<\/ul>\n<h4>6.3.5 MQ \u4e8b\u52a1\u6d88\u606f&#xff08;RocketMQ \/ Kafka \u4e8b\u52a1&#xff09;\u2014\u2014 Outbox \u6a21\u5f0f\u53d8\u79cd<\/h4>\n<ul>\n<li>RocketMQ \u4e8b\u52a1\u6d88\u606f\u6d41\u7a0b&#xff1a;\n<li>\u751f\u4ea7\u8005\u53d1\u9001 \u534a\u6d88\u606f&#xff08;Half Message&#xff09; &#xff0c;\u6682\u4e0d\u53ef\u6d88\u8d39\u3002<\/li>\n<li>\u6267\u884c\u672c\u5730\u4e8b\u52a1&#xff08;\u5982\u6263\u5e93\u5b58&#xff09;\u3002<\/li>\n<li>\u6839\u636e\u672c\u5730\u4e8b\u52a1\u7ed3\u679c&#xff0c;\u5411 Broker \u53d1\u9001 Commit \u6216 Rollback\u3002<\/li>\n<li>Broker \u82e5\u957f\u65f6\u95f4\u672a\u6536\u5230\u4e8c\u6b21\u786e\u8ba4&#xff0c;\u4f1a\u56de\u67e5\u751f\u4ea7\u8005\u7684\u4e8b\u52a1\u6267\u884c\u72b6\u6001&#xff08;\u9700\u5b9e\u73b0 TransactionListener \u7684 checkLocalTransaction&#xff09;\u3002<\/li>\n<li>Commit \u540e\u6d88\u606f\u5bf9\u6d88\u8d39\u8005\u53ef\u89c1\u3002<\/li>\n<\/li>\n<\/ul>\n<p>\u4e0e\u672c\u5730\u6d88\u606f\u8868\u7684\u5bf9\u6bd4&#xff1a;RocketMQ \u4e8b\u52a1\u6d88\u606f\u907f\u514d\u4e86\u6570\u636e\u5e93\u8f6e\u8be2&#xff0c;\u5b9e\u65f6\u6027\u66f4\u9ad8&#xff0c;\u4f46\u9700\u8981 MQ \u4e2d\u95f4\u4ef6\u652f\u6301&#xff1b;\u672c\u5730\u6d88\u606f\u8868\u65b9\u6848\u66f4\u901a\u7528&#xff08;\u517c\u5bb9 Kafka\/RabbitMQ&#xff09;\u3002<\/p>\n<h4>6.3.6 Outbox \u6a21\u5f0f&#xff08;\u5fae\u670d\u52a1\u67b6\u6784\u6700\u4f73\u5b9e\u8df5&#xff09;<\/h4>\n<ul>\n<li>\u5229\u7528 Debezium&#xff08;CDC&#xff0c;Change Data Capture&#xff09; \u6216 Canal \u76d1\u542c\u6570\u636e\u5e93 Binlog&#xff08;\u5982\u8ba2\u5355\u8868 INSERT&#xff09;\u3002<\/li>\n<li>Binlog \u53d8\u5316\u89e6\u53d1\u540c\u6b65\u4efb\u52a1&#xff0c;\u5c06\u4e8b\u4ef6\u63a8\u9001\u81f3 MQ\u3002\u8fd9\u6837\u4e1a\u52a1\u4ee3\u7801\u5b8c\u5168\u96f6\u4fb5\u5165&#xff0c;\u4e14\u7edd\u5bf9\u4fdd\u8bc1\u201c\u81f3\u5c11\u4e00\u6b21\u201d\u7684\u6295\u9012\u3002<\/li>\n<li>\u9002\u5408\u573a\u666f&#xff1a;\u5df2\u6709\u8001\u7cfb\u7edf\u6539\u9020&#xff0c;\u4e0d\u613f\u5f15\u5165\u590d\u6742\u4e8b\u52a1\u903b\u8f91\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>6.4 \u5e42\u7b49\u6027\u8bbe\u8ba1&#xff08;\u2605\u2605\u2605\u2605\u2605 \u8d2f\u7a7f\u6240\u6709\u5206\u5e03\u5f0f\u65b9\u6848&#xff09;<\/h3>\n<p>\u4e3a\u4ec0\u4e48\u9700\u8981\u5e42\u7b49&#xff1f; \u7f51\u7edc\u8d85\u65f6\u3001MQ \u91cd\u8bd5\u3001\u524d\u7aef\u91cd\u590d\u70b9\u51fb\u5bfc\u81f4\u540c\u4e00\u64cd\u4f5c\u88ab\u6267\u884c\u591a\u6b21&#xff0c;\u5fc5\u987b\u4fdd\u8bc1\u7ed3\u679c\u4e00\u81f4\u3002<\/p>\n<p>6 \u79cd\u5e42\u7b49\u5b9e\u73b0\u65b9\u6848&#xff1a;<\/p>\n<table>\n<tr>\u65b9\u6848\u539f\u7406\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u5e93\u552f\u4e00\u952e<\/td>\n<td>\u4e1a\u52a1\u5355\u53f7&#xff08;\u5982 order_no&#xff09;\u4f5c\u4e3a\u552f\u4e00\u7d22\u5f15&#xff0c;\u91cd\u590d INSERT \u76f4\u63a5\u62a5\u9519<\/td>\n<td>\u63d2\u5165\u578b\u4e1a\u52a1&#xff08;\u8ba2\u5355\u521b\u5efa&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u4e50\u89c2\u9501&#xff08;\u7248\u672c\u53f7&#xff09;<\/td>\n<td>UPDATE table SET version &#061; version &#043; 1 WHERE id &#061; ? AND version &#061; old_version<\/td>\n<td>\u66f4\u65b0\u578b\u4e1a\u52a1&#xff08;\u5e93\u5b58\u6263\u51cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u72b6\u6001\u673a&#xff08;\u9632\u56de\u9000&#xff09;<\/td>\n<td>\u72b6\u6001\u6d41\u8f6c\u5f3a\u5236\u5355\u5411&#xff08;\u5982 \u5f85\u652f\u4ed8 \u2192 \u652f\u4ed8\u4e2d \u2192 \u652f\u4ed8\u6210\u529f \u2192 \u5df2\u53d1\u8d27&#xff09;&#xff0c;\u4e0d\u5141\u8bb8\u91cd\u590d\/\u56de\u9000<\/td>\n<td>\u8ba2\u5355\u751f\u547d\u5468\u671f\u7ba1\u7406<\/td>\n<\/tr>\n<tr>\n<td>Token \u673a\u5236&#xff08;\u5168\u5c40\u552f\u4e00 ID&#xff09;<\/td>\n<td>\u8bf7\u6c42\u643a\u5e26 request_id&#xff0c;\u670d\u52a1\u7aef\u7528 Redis \u5b58\u50a8 SETNX request_id 1 EX 600&#xff0c;\u5904\u7406\u5b8c\u518d\u5220\u9664<\/td>\n<td>\u524d\u7aef\u8868\u5355\u91cd\u590d\u63d0\u4ea4<\/td>\n<\/tr>\n<tr>\n<td>\u5206\u5e03\u5f0f\u9501&#xff08;Redis\/ZK&#xff09;<\/td>\n<td>key &#061; \u4e1a\u52a1ID &#043; \u64cd\u4f5c\u7c7b\u578b&#xff0c;tryLock \u6210\u529f\u624d\u6267\u884c&#xff0c;\u6267\u884c\u5b8c\u91ca\u653e&#xff08;\u9700\u6743\u8861\u9501\u8d85\u65f6&#xff09;<\/td>\n<td>\u4e92\u65a5\u8d44\u6e90\u64cd\u4f5c<\/td>\n<\/tr>\n<tr>\n<td>\u6d88\u606f\u53bb\u91cd\u8868&#xff08;MQ \u6d88\u8d39\u65b9&#xff09;<\/td>\n<td>\u6d88\u8d39\u65f6\u63d2\u5165 Redis&#xff08;\u4e1a\u52a1ID &#043; \u6d88\u8d39\u72b6\u6001&#xff09;&#xff0c;\u5904\u7406\u5b8c\u66f4\u65b0\u72b6\u6001&#xff0c;\u901a\u8fc7\u72b6\u6001\u5224\u65ad\u662f\u5426\u5df2\u5904\u7406<\/td>\n<td>\u5f02\u6b65\u6d88\u606f\u6d88\u8d39<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u4e03\u3001\u9ad8\u5e76\u53d1\u4e0e\u6027\u80fd\u4f18\u5316&#xff08;\u6838\u5fc3\u80fd\u529b 10%&#xff09;<\/h2>\n<h3>7.1 \u79d2\u6740\u7cfb\u7edf\u8bbe\u8ba1&#xff08;\u2605\u2605\u2605\u2605\u2605 \u5fc5\u8003\u67b6\u6784\u9898&#xff09;<\/h3>\n<p>\u573a\u666f&#xff1a;100 \u4e07\u4eba\u62a2 100 \u4ef6\u5546\u54c1\u3002\u6838\u5fc3\u662f \u524a\u5cf0\u586b\u8c37 &#043; \u6781\u81f4\u8bfb\u591a\u5199\u5c11\u3002<\/p>\n<h4>7.1.1 \u6574\u4f53\u5206\u5c42\u67b6\u6784<\/h4>\n<table>\n<tr>\u5c42\u7ea7\u6280\u672f\u6808\u6838\u5fc3\u804c\u8d23<\/tr>\n<tbody>\n<tr>\n<td>\u5ba2\u6237\u7aef\u5c42<\/td>\n<td>CDN &#043; \u9759\u6001\u8d44\u6e90\u5206\u79bb &#043; \u9875\u9762\u9759\u6001\u5316&#xff08;HTML \u7f13\u5b58&#xff09;<\/td>\n<td>\u51cf\u5c11\u9759\u6001\u8d44\u6e90\u8bf7\u6c42\u6253\u5230\u540e\u7aef<\/td>\n<\/tr>\n<tr>\n<td>\u63a5\u5165\u5c42&#xff08;\u7f51\u5173&#xff09;<\/td>\n<td>Nginx &#043; Gateway &#043; Sentinel<\/td>\n<td>\u9650\u6d41&#xff08;\u4ee4\u724c\u6876&#xff09;\u3001IP \u9ed1\u540d\u5355\u3001\u62e6\u622a\u5237\u5b50\u6d41\u91cf<\/td>\n<\/tr>\n<tr>\n<td>\u4e1a\u52a1\u903b\u8f91\u5c42<\/td>\n<td>\u5fae\u670d\u52a1\u96c6\u7fa4&#xff08;\u5e93\u5b58\u3001\u8ba2\u5355\u3001\u7528\u6237&#xff09;<\/td>\n<td>\u4e1a\u52a1\u6821\u9a8c&#xff08;\u53c2\u6570\u3001\u5e93\u5b58&#xff09;\u3001\u5f02\u6b65\u4e0b\u5355<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5c42<\/td>\n<td>Redis&#xff08;\u7f13\u5b58&#xff09; &#043; MQ&#xff08;\u524a\u5cf0&#xff09; &#043; DB&#xff08;\u6700\u7ec8\u843d\u76d8&#xff09;<\/td>\n<td>\u8bfb\u5199\u5206\u79bb\u3001\u5f02\u6b65\u89e3\u8026\u3001\u6570\u636e\u6301\u4e45\u5316<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>7.1.2 \u5173\u952e\u6b65\u9aa4\u4e0e\u6838\u5fc3\u6280\u672f<\/h4>\n<p>&#xff08;1&#xff09;\u5e93\u5b58\u9884\u70ed&#xff08;\u63d0\u524d\u52a0\u8f7d&#xff09;<\/p>\n<ul>\n<li>\u79d2\u6740\u5f00\u59cb\u524d 30 \u5206\u949f&#xff0c;\u5c06\u5546\u54c1\u5e93\u5b58\u4ece DB \u52a0\u8f7d\u5230 Redis&#xff08;HSET seckill:stock:{id} total 100&#xff09;\u3002<\/li>\n<li>\u540c\u65f6\u751f\u6210\u5546\u54c1\u8be6\u60c5\u9875\u7684\u9759\u6001 HTML \u5e76\u63a8\u9001\u5230 CDN\u3002<\/li>\n<\/ul>\n<p>&#xff08;2&#xff09;\u6781\u81f4\u9650\u6d41&#xff08;\u5165\u53e3\u4fdd\u62a4&#xff09;<\/p>\n<ul>\n<li>Nginx \u5c42&#xff1a;limit_req_zone \u6309 IP \u9650\u6d41&#xff08;\u5982 5 \u6b21\/\u79d2&#xff09;\u3002<\/li>\n<li>Gateway \u5c42&#xff1a;\u57fa\u4e8e Redis \u7684\u4ee4\u724c\u6876&#xff08;RequestRateLimiter&#xff09;&#xff0c;\u6bcf\u79d2\u653e\u884c\u56fa\u5b9a\u6570\u91cf\u7684\u8bf7\u6c42&#xff08;\u5982 5000 QPS&#xff09;&#xff0c;\u5176\u4f59\u76f4\u63a5\u8fd4\u56de\u201c\u6392\u961f\u4e2d\u201d\u6216\u201c\u5df2\u552e\u7f44\u201d\u3002<\/li>\n<\/ul>\n<p>&#xff08;3&#xff09;Redis Lua \u811a\u672c&#xff08;\u539f\u5b50\u6263\u51cf\u5e93\u5b58&#xff09;<\/p>\n<p><span class=\"token comment\">&#8212; \u6263\u51cf\u5e93\u5b58&#xff0c;\u8fd4\u56de\u5269\u4f59\u6570\u91cf<\/span><br \/>\n<span class=\"token keyword\">local<\/span> stock <span class=\"token operator\">&#061;<\/span> redis<span class=\"token punctuation\">.<\/span><span class=\"token function\">call<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;GET&#039;<\/span><span class=\"token punctuation\">,<\/span> KEYS<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> stock <span class=\"token keyword\">or<\/span> <span class=\"token function\">tonumber<\/span><span class=\"token punctuation\">(<\/span>stock<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&lt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token keyword\">then<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span>  <span class=\"token comment\">&#8212; \u65e0\u5e93\u5b58<\/span><br \/>\n<span class=\"token keyword\">end<\/span><br \/>\nredis<span class=\"token punctuation\">.<\/span><span class=\"token function\">call<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;DECR&#039;<\/span><span class=\"token punctuation\">,<\/span> KEYS<span class=\"token punctuation\">[<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">return<\/span> <span class=\"token number\">1<\/span><\/p>\n<p>\u5173\u952e&#xff1a;Lua \u4fdd\u8bc1\u539f\u5b50\u6027&#xff0c;\u907f\u514d\u8d85\u5356\u3002\u5982\u679c\u5e93\u5b58\u4e3a 0&#xff0c;\u76f4\u63a5\u8fd4\u56de\u5931\u8d25&#xff0c;\u4e0d\u521b\u5efa\u8ba2\u5355\u3002<\/p>\n<p>&#xff08;4&#xff09;\u5f02\u6b65\u4e0b\u5355 &#043; MQ \u524a\u5cf0<\/p>\n<ul>\n<li>\u6263\u51cf Redis \u5e93\u5b58\u6210\u529f\u540e&#xff0c;\u751f\u6210\u9884\u4e0b\u5355 Token&#xff08;\u5982 order:token:{userId}&#xff09;\u5e76\u653e\u5165 MQ\u3002<\/li>\n<li>MQ \u6d88\u8d39\u8005&#xff08;\u901f\u7387\u53ef\u63a7&#xff0c;\u5982 200 TPS&#xff09;\u62c9\u53d6\u6d88\u606f&#xff0c;\u6267\u884c\u6570\u636e\u5e93\u4e8b\u52a1&#xff08;\u521b\u5efa\u8ba2\u5355\u3001\u6263\u51cf DB \u5e93\u5b58\u3001\u751f\u6210\u652f\u4ed8\u94fe\u63a5&#xff09;\u3002<\/li>\n<li>\u76ee\u7684&#xff1a;\u5c06 100 \u4e07\u77ac\u65f6\u8bf7\u6c42\u524a\u5cf0\u4e3a 200 TPS \u7684\u7a33\u5b9a\u6d41\u91cf&#xff0c;\u4fdd\u62a4\u6570\u636e\u5e93\u3002<\/li>\n<\/ul>\n<p>&#xff08;5&#xff09;\u5e93\u5b58\u5206\u6bb5&#xff08;HotKey \u5206\u644a&#xff09;<\/p>\n<ul>\n<li>\u5982\u679c\u5355\u5546\u54c1 HotKey \u8fc7\u4e8e\u96c6\u4e2d&#xff0c;\u53ef\u5c06 100 \u4ef6\u5e93\u5b58\u62c6\u5206\u4e3a 10 \u6bb5&#xff08;\u5982 stock_1 ~ stock_10&#xff09;&#xff0c;\u6bcf\u6bb5 10 \u4ef6&#xff0c;\u968f\u673a\u8def\u7531\u5230\u4e0d\u540c Redis \u8282\u70b9\u6216\u4e0d\u540c Lua \u952e&#xff0c;\u5206\u6563\u70ed\u70b9\u538b\u529b\u3002<\/li>\n<\/ul>\n<p>&#xff08;6&#xff09;\u515c\u5e95\u4e0e\u9632\u91cd<\/p>\n<ul>\n<li>Redis \u6807\u8bb0\u7528\u6237\u62a2\u8d2d\u72b6\u6001&#xff1a;SETNX user:123:seckill:456 1 EX 86400&#xff0c;\u9632\u6b62\u540c\u4e00\u7528\u6237\u91cd\u590d\u62a2\u8d2d\u3002<\/li>\n<li>\u5f02\u6b65\u786e\u4fdd\u6700\u7ec8\u4e00\u81f4&#xff1a;DB \u6263\u5e93\u5b58\u5931\u8d25\u65f6&#xff0c;\u9700\u901a\u8fc7 MQ \u53cd\u5411\u8865\u507f&#xff08;\u91ca\u653e Redis \u5e93\u5b58&#xff09;\u3002<\/li>\n<\/ul>\n<h4>7.1.3 \u538b\u6d4b\u4e0e\u5bb9\u91cf\u8bc4\u4f30<\/h4>\n<ul>\n<li>\u4f7f\u7528 JMeter \/ Locust \u6a21\u62df\u6df7\u5408\u573a\u666f&#xff08;\u6b63\u5e38\u7528\u6237 &#043; \u811a\u672c\u5237\u5b50&#xff09;\u3002<\/li>\n<li>\u901a\u8fc7 Arthas \u7ebf\u4e0a\u70ed\u529b\u56fe \u6216 Grafana \u76d1\u63a7&#xff0c;\u89c2\u5bdf JVM GC\u3001\u7cfb\u7edf Load\u3001Redis \u8fde\u63a5\u6570\u3001MQ \u79ef\u538b\u60c5\u51b5&#xff0c;\u53cd\u5411\u8c03\u6574\u9650\u6d41\u9608\u503c\u548c\u7ebf\u7a0b\u6c60\u5927\u5c0f\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u516b\u3001\u67b6\u6784\u80fd\u529b\u4e0e DDD \u843d\u5730&#xff08;\u6838\u5fc3\u80fd\u529b 10%&#xff09;<\/h2>\n<h3>8.1 \u5fae\u670d\u52a1\u62c6\u5206\u539f\u5219&#xff08;Monolith \u2192 Microservices&#xff09;<\/h3>\n<table>\n<tr>\u539f\u5219\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\u9ad8\u5185\u805a\u3001\u4f4e\u8026\u5408<\/td>\n<td>\u6309\u4e1a\u52a1\u57df&#xff08;Domain&#xff09;\u800c\u975e\u6280\u672f\u5c42&#xff08;Controller\/Service\/DAO&#xff09;\u62c6\u5206<\/td>\n<\/tr>\n<tr>\n<td>\u5355\u4e00\u804c\u8d23&#xff08;SRP&#xff09;<\/td>\n<td>\u4e00\u4e2a\u670d\u52a1\u53ea\u8d1f\u8d23\u4e00\u4e2a\u4e1a\u52a1\u80fd\u529b&#xff08;\u5982\u8ba2\u5355\u670d\u52a1\u4e0d\u5904\u7406\u7528\u6237\u767b\u5f55&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u72ec\u7acb\u6570\u636e\u5e93<\/td>\n<td>\u6bcf\u4e2a\u5fae\u670d\u52a1\u62e5\u6709\u81ea\u5df1\u7684\u6570\u636e\u5e93&#xff08;\u7269\u7406\u9694\u79bb\u6216 Schema \u9694\u79bb&#xff09;&#xff0c;\u907f\u514d\u8de8\u5e93 JOIN<\/td>\n<\/tr>\n<tr>\n<td>\u7ec4\u7ec7\u5bf9\u9f50&#xff08;\u5eb7\u5a01\u5b9a\u5f8b&#xff09;<\/td>\n<td>\u56e2\u961f\u7ed3\u6784\u4e0e\u670d\u52a1\u67b6\u6784\u5339\u914d&#xff08;\u4e00\u4e2a\u56e2\u961f\u8d1f\u8d23\u4e00\u4e2a\u57df&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>8.2 DDD&#xff08;\u9886\u57df\u9a71\u52a8\u8bbe\u8ba1&#xff09;\u843d\u5730\u5b9e\u8df5<\/h3>\n<p>\u6838\u5fc3\u6218\u672f\u6a21\u5f0f&#xff1a;<\/p>\n<ul>\n<li>\u805a\u5408\u6839&#xff08;Aggregate Root&#xff09;&#xff1a;\u5916\u90e8\u8bbf\u95ee\u805a\u5408\u7684\u552f\u4e00\u5165\u53e3\u3002\u5982 Order \u662f\u805a\u5408\u6839&#xff0c;OrderItem \u5c5e\u4e8e\u5176\u5185\u90e8\u5b9e\u4f53&#xff0c;\u5916\u90e8\u4e0d\u80fd\u76f4\u63a5\u4fee\u6539 OrderItem\u3002<\/li>\n<li>\u503c\u5bf9\u8c61&#xff08;Value Object&#xff09;&#xff1a;\u65e0\u552f\u4e00\u6807\u8bc6&#xff0c;\u4e0d\u53ef\u53d8&#xff0c;\u5982 Money\u3001Address\u3002<\/li>\n<li>\u9886\u57df\u4e8b\u4ef6&#xff08;Domain Event&#xff09;&#xff1a;\u805a\u5408\u6839\u72b6\u6001\u53d8\u66f4\u540e\u53d1\u5e03\u4e8b\u4ef6&#xff08;\u5982 OrderCreatedEvent&#xff09;&#xff0c;\u901a\u8fc7 Spring \u7684 ApplicationEventPublisher \u53d1\u5e03&#xff0c;\u5176\u5b83\u670d\u52a1\u76d1\u542c\u5e76\u5904\u7406&#xff08;\u89e3\u8026&#xff09;\u3002<\/li>\n<\/ul>\n<p>CQRS&#xff08;\u547d\u4ee4\u67e5\u8be2\u804c\u8d23\u5206\u79bb&#xff09;&#xff1a;<\/p>\n<ul>\n<li>Command \u7aef&#xff1a;\u5904\u7406\u5199\u64cd\u4f5c&#xff08;DDD \u9886\u57df\u6a21\u578b&#xff0c;\u5f3a\u4e00\u81f4&#xff0c;\u4e8b\u52a1\u6027\u5f3a&#xff09;\u3002<\/li>\n<li>Query \u7aef&#xff1a;\u5904\u7406\u8bfb\u64cd\u4f5c&#xff08;\u76f4\u63a5\u67e5\u8be2 DB \u6216 Elasticsearch \u89c6\u56fe&#xff0c;\u7b80\u5355 SQL&#xff0c;\u4e0d\u505a\u590d\u6742\u4e1a\u52a1\u903b\u8f91&#xff09;\u3002<\/li>\n<li>\u4f18\u70b9&#xff1a;\u8bfb\u5199\u5206\u79bb&#xff0c;\u53ef\u72ec\u7acb\u4f18\u5316&#xff1b;\u7f3a\u70b9&#xff1a;\u590d\u6742\u5ea6\u9ad8&#xff0c;\u6570\u636e\u5b58\u5728\u77ed\u6682\u4e0d\u4e00\u81f4&#xff08;\u9700\u6700\u7ec8\u4e00\u81f4\u6027\u540c\u6b65&#xff09;\u3002<\/li>\n<\/ul>\n<p>Event Sourcing&#xff08;\u4e8b\u4ef6\u6eaf\u6e90&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\u539f\u7406&#xff1a;\u4e0d\u5b58\u50a8\u805a\u5408\u7684\u5f53\u524d\u72b6\u6001&#xff0c;\u53ea\u5b58\u50a8\u4e00\u7cfb\u5217\u9886\u57df\u4e8b\u4ef6&#xff08;Event Store&#xff09;\u3002\u805a\u5408\u7684\u5f53\u524d\u72b6\u6001\u901a\u8fc7\u91cd\u653e&#xff08;Replay&#xff09;\u6240\u6709\u4e8b\u4ef6\u8ba1\u7b97\u5f97\u51fa\u3002<\/li>\n<li>\u4f18\u70b9&#xff1a;\u5b8c\u7f8e\u7684\u5ba1\u8ba1\u65e5\u5fd7\u3001\u53ef\u56de\u6eaf\u4efb\u610f\u65f6\u95f4\u70b9\u72b6\u6001\u3002<\/li>\n<li>\u4f55\u65f6\u4f7f\u7528&#xff1a;\u91d1\u878d\u8d26\u672c\u3001\u533a\u5757\u94fe\u3001\u590d\u6742\u4e1a\u52a1\u6d41\u7a0b\u5ba1\u8ba1\u7b49\u3002<\/li>\n<li>\u4f55\u65f6\u4e0d\u8981\u7528&#xff1a;\u7b80\u5355 CRUD\u3001\u5bf9\u5ef6\u8fdf\u654f\u611f\u7684\u7cfb\u7edf&#xff08;\u91cd\u653e\u5927\u91cf\u4e8b\u4ef6\u592a\u6162&#xff09;\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u4e5d\u3001\u4e91\u539f\u751f\u4e0e\u53ef\u89c2\u6d4b\u6027&#xff08;\u6838\u5fc3\u80fd\u529b 5%&#xff09;<\/h2>\n<h3>9.1 Docker &#043; Kubernetes&#xff08;K8s&#xff09;\u6838\u5fc3\u8981\u70b9<\/h3>\n<ul>\n<li>Pod&#xff1a;K8s \u6700\u5c0f\u8c03\u5ea6\u5355\u5143&#xff0c;\u4e00\u4e2a Pod \u53ef\u5305\u542b\u591a\u4e2a\u5bb9\u5668&#xff08;\u5171\u4eab Network Namespace&#xff09;\u3002<\/li>\n<li>Deployment&#xff1a;\u65e0\u72b6\u6001\u5e94\u7528\u90e8\u7f72&#xff08;\u6eda\u52a8\u66f4\u65b0\u3001\u56de\u6eda\u3001\u526f\u672c\u6570\u63a7\u5236&#xff09;\u3002<\/li>\n<li>StatefulSet&#xff1a;\u6709\u72b6\u6001\u5e94\u7528&#xff08;\u5982 MySQL\u3001Redis \u96c6\u7fa4&#xff09;&#xff0c;\u63d0\u4f9b\u7a33\u5b9a\u7684\u7f51\u7edc\u6807\u8bc6&#xff08;pod-0\u3001pod-1&#xff09;\u548c\u6301\u4e45\u5316\u5b58\u50a8&#xff08;PVC&#xff09;\u3002<\/li>\n<li>Service&#xff1a;\u670d\u52a1\u53d1\u73b0\u4e0e\u8d1f\u8f7d\u5747\u8861&#xff08;ClusterIP\u3001NodePort\u3001LoadBalancer&#xff09;\u3002<\/li>\n<li>Ingress&#xff1a;\u4e03\u5c42 HTTP \u8def\u7531&#xff08;\u57df\u540d -&gt; Service&#xff09;\u3002<\/li>\n<li>ConfigMap \/ Secret&#xff1a;\u914d\u7f6e\u4e0e\u654f\u611f\u4fe1\u606f\u6ce8\u5165&#xff08;\u73af\u5883\u53d8\u91cf\u6216 Volume \u6302\u8f7d&#xff09;\u3002<\/li>\n<li>HPA&#xff08;Horizontal Pod Autoscaler&#xff09;&#xff1a;\u57fa\u4e8e CPU\/\u5185\u5b58\/\u81ea\u5b9a\u4e49\u6307\u6807&#xff08;\u5982 QPS&#xff09;\u81ea\u52a8\u6269\u7f29 Pod\u3002<\/li>\n<\/ul>\n<p>\u9ad8\u7ea7\u5de5\u7a0b\u5e08\u89c6\u89d2&#xff1a;\u4e0d\u4ec5\u8981\u4f1a kubectl apply&#xff0c;\u8fd8\u8981\u7406\u89e3 Pod \u751f\u547d\u5468\u671f&#xff08;Pending \u2192 Running \u2192 Succeeded\/Failed&#xff09;\u3001\u63a2\u9488&#xff08;Startup\/Readiness\/Liveness Probe&#xff09; \u5bf9\u53d1\u5e03\u548c\u7a33\u5b9a\u6027\u5e95\u7ebf\u7684\u4fdd\u969c\u3002<\/p>\n<h3>9.2 \u53ef\u89c2\u6d4b\u6027\u4e09\u5927\u652f\u67f1<\/h3>\n<table>\n<tr>\u652f\u67f1\u6280\u672f\u6808\u6838\u5fc3\u76ee\u7684<\/tr>\n<tbody>\n<tr>\n<td>\u76d1\u63a7&#xff08;Metrics&#xff09;<\/td>\n<td>Prometheus &#043; Grafana<\/td>\n<td>\u6307\u6807\u91c7\u96c6&#xff08;CPU\u3001\u5185\u5b58\u3001QPS\u3001\u9519\u8bef\u7387&#xff09;&#xff0c;\u8bbe\u7f6e\u544a\u8b66\u89c4\u5219&#xff08;\u5982\u201c5\u5206\u949f\u5185\u9519\u8bef\u7387 &gt; 10%\u201d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u65e5\u5fd7&#xff08;Logging&#xff09;<\/td>\n<td>ELK&#xff08;Elasticsearch &#043; Logstash &#043; Kibana&#xff09; \/ Loki<\/td>\n<td>\u7ed3\u6784\u5316\u65e5\u5fd7\u5b58\u50a8\u4e0e\u68c0\u7d22&#xff0c;\u6392\u67e5\u4e1a\u52a1\u5f02\u5e38\u5806\u6808<\/td>\n<\/tr>\n<tr>\n<td>\u94fe\u8def\u8ffd\u8e2a&#xff08;Tracing&#xff09;<\/td>\n<td>Jaeger \/ Zipkin &#043; OpenTelemetry<\/td>\n<td>\u5206\u5e03\u5f0f\u8c03\u7528\u94fe\u8ffd\u8e2a&#xff08;TraceId &#043; SpanId&#xff09;&#xff0c;\u5b9a\u4f4d\u8de8\u670d\u52a1\u6162\u8c03\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9e\u6218\u8981\u6c42&#xff1a;\u5fae\u670d\u52a1\u5fc5\u987b\u4f20\u9012 TraceId&#xff08;\u901a\u8fc7 MDC \u6216 ThreadLocal&#xff09;\u5e76\u5728\u65e5\u5fd7\u3001\u76d1\u63a7\u3001\u94fe\u8def\u4e2d\u5173\u8054&#xff0c;\u5f62\u6210 \u201cMetrics \u2192 Logs \u2192 Traces\u201d \u7684\u8054\u52a8\u6392\u67e5\u95ed\u73af\u3002<\/p>\n<hr \/>\n<h2>\u5341\u3001\u884c\u4e1a\u573a\u666f\u80fd\u529b&#xff08;\u8de8\u5883\u7535\u5546 &#043; \u5236\u9020\u4e1a&#xff09;<\/h2>\n<h3>10.1 \u5236\u9020\u4e1a&#xff08;MES\/\u5de5\u4e1a\u4e92\u8054&#xff09;<\/h3>\n<ul>\n<li>MES&#xff08;\u5236\u9020\u6267\u884c\u7cfb\u7edf&#xff09; \u9700\u8981\u5b9e\u65f6\u91c7\u96c6 PLC&#xff08;\u53ef\u7f16\u7a0b\u903b\u8f91\u63a7\u5236\u5668&#xff09;\u6570\u636e\u3002<\/li>\n<li>\u5de5\u4e1a\u534f\u8bae&#xff1a;Modbus&#xff08;\u4e32\u53e3\/\u4ee5\u592a\u7f51&#xff09;\u3001OPC UA&#xff08;\u6807\u51c6\u5316\u5de5\u4e1a\u901a\u4fe1&#xff09;\u3001MQTT&#xff08;\u8f7b\u91cf\u7ea7\u7269\u8054\u7f51\u534f\u8bae&#xff0c;\u9002\u5408\u4e91\u8fb9\u534f\u540c&#xff09;\u3002<\/li>\n<li>\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u7528 HTTP&#xff1f; \u5de5\u4e1a\u73b0\u573a\u8bbe\u5907\u8d44\u6e90\u53d7\u9650&#xff08;\u4f4e\u529f\u8017\u3001\u5f31\u7f51&#xff09;&#xff0c;TCP\/HTTP \u63e1\u624b\u5f00\u9500\u5927&#xff1b;\u4e14\u5b9e\u65f6\u6027\u8981\u6c42\u6beb\u79d2\u7ea7&#xff08;\u8f6e\u8be2\u5468\u671f 50ms~200ms&#xff09;&#xff0c;HTTP \u5ef6\u8fdf\u4e0d\u53ef\u63a7\u3002<\/li>\n<li>\u53ef\u9760\u6027\u4fdd\u969c&#xff1a;\u8fb9\u7f18\u7f51\u5173\u505a\u672c\u5730\u7f13\u5b58&#xff08;\u65ad\u7f51\u7eed\u4f20&#xff09;&#xff0c;\u6570\u636e\u5148\u5199\u5165 InfluxDB\/TDEngine&#xff08;\u65f6\u5e8f\u6570\u636e\u5e93&#xff09;&#xff0c;\u518d\u540c\u6b65\u4e91\u7aef\u3002<\/li>\n<\/ul>\n<h3>10.2 \u8de8\u5883\u7535\u5546\u8ba2\u5355\u5168\u6d41\u7a0b\u72b6\u6001\u673a<\/h3>\n<p>\u5b8c\u6574\u72b6\u6001\u6d41\u8f6c&#xff1a;<\/p>\n<p>\u521b\u5efa(CREATED) \u2192 \u652f\u4ed8\u4e2d(PAYING) \u2192 \u5df2\u652f\u4ed8(PAID) \u2192 \u9501\u5e93\u5b58\u6210\u529f(STOCK_LOCKED) \u2192<br \/>\n\u5f85\u53d1\u8d27(WAIT_SHIP) \u2192 \u6e05\u5173\u4e2d(CLEARING) \u2192 \u5df2\u6e05\u5173(CLEARED) \u2192<br \/>\n\u8fd0\u8f93\u4e2d(TRANSITING) \u2192 \u7b7e\u6536(DELIVERED) \u2192 \u5b8c\u6210(COMPLETED)<br \/>\n                  \u2198 \u9000\u6b3e\u4e2d(REFUNDING) \u2192 \u5df2\u9000\u6b3e(REFUNDED)<br \/>\n                  \u2198 \u552e\u540e\u4e2d(AFTER_SALE) \u2192 \u552e\u540e\u5b8c\u6210(AFTER_DONE)<\/p>\n<p>\u6838\u5fc3\u96be\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u652f\u4ed8\u4e0e\u5e93\u5b58\u7684\u6700\u7ec8\u4e00\u81f4\u6027&#xff1a;\u652f\u4ed8\u6210\u529f\u4f46\u5e93\u5b58\u6263\u51cf\u5931\u8d25 \u2192 \u81ea\u52a8\u9000\u6b3e&#xff08;TCC \u6216 MQ \u4e8b\u52a1&#xff09;\u3002<\/li>\n<li>\u8de8\u5883\u6e05\u5173\u6570\u636e\u540c\u6b65&#xff1a;\u5bf9\u63a5\u6d77\u5173\u7cfb\u7edf&#xff08;\u5f02\u6b65\u56de\u8c03 &#043; \u8f6e\u8be2\u8865\u507f&#xff09;&#xff0c;\u9700\u8bbe\u8ba1\u8d85\u65f6\u91cd\u8bd5\u548c\u5f02\u5e38\u5de5\u5355\u544a\u8b66\u3002<\/li>\n<li>\u4ef7\u683c\u4e0e\u8d27\u5e01\u8f6c\u6362&#xff1a;\u4ef7\u683c\u4e2d\u5fc3\u9700\u7ef4\u62a4\u591a\u5e01\u79cd\u6c47\u7387&#xff08;BigDecimal \u7cbe\u786e\u8ba1\u7b97&#xff0c;\u7981\u6b62 float\/double&#xff09;\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u5341\u4e00\u3001\u4ee3\u7801\u80fd\u529b\u4e0e\u8bbe\u8ba1\u6a21\u5f0f&#xff08;\u6838\u5fc3\u80fd\u529b\u8d2f\u7a7f\u59cb\u7ec8&#xff09;<\/h2>\n<h3>11.1 SOLID \u539f\u5219\u5b9e\u6218\u6620\u5c04<\/h3>\n<table>\n<tr>\u539f\u5219\u5fae\u670d\u52a1\/\u4ee3\u7801\u4f53\u73b0<\/tr>\n<tbody>\n<tr>\n<td>\u5355\u4e00\u804c\u8d23&#xff08;S&#xff09;<\/td>\n<td>\u4e00\u4e2a Service \u7c7b\u53ea\u505a\u4e00\u79cd\u4e1a\u52a1&#xff08;\u5982 PaymentService \u4e0d\u5199\u7269\u6d41\u903b\u8f91&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5f00\u95ed\u539f\u5219&#xff08;O&#xff09;<\/td>\n<td>\u4f7f\u7528\u7b56\u7565\u6a21\u5f0f\u5904\u7406\u4e0d\u540c\u652f\u4ed8\u6e20\u9053&#xff08;\u5fae\u4fe1\/\u652f\u4ed8\u5b9d&#xff09;&#xff0c;\u65b0\u589e\u6e20\u9053\u4e0d\u4fee\u6539\u8001\u4ee3\u7801<\/td>\n<\/tr>\n<tr>\n<td>\u91cc\u6c0f\u66ff\u6362&#xff08;L&#xff09;<\/td>\n<td>\u5b50\u7c7b\u6269\u5c55\u7236\u7c7b\u529f\u80fd&#xff0c;\u4e0d\u91cd\u5199\u7236\u7c7b\u975e\u62bd\u8c61\u65b9\u6cd5&#xff08;\u907f\u514d\u7834\u574f\u5951\u7ea6&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u63a5\u53e3\u9694\u79bb&#xff08;I&#xff09;<\/td>\n<td>\u81ea\u5b9a\u4e49 Feign \u63a5\u53e3\u7c92\u5ea6\u8981\u7ec6&#xff08;\u5982 OrderReadClient \u548c OrderWriteClient \u5206\u79bb&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u4f9d\u8d56\u5012\u7f6e&#xff08;D&#xff09;<\/td>\n<td>\u9ad8\u5c42\u6a21\u5757\u4f9d\u8d56\u62bd\u8c61\u63a5\u53e3&#xff08;\u5982 PaymentGateway \u63a5\u53e3&#xff09;&#xff0c;\u4e0d\u4f9d\u8d56\u5177\u4f53\u5b9e\u73b0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>11.2 \u5e38\u7528\u8bbe\u8ba1\u6a21\u5f0f\u573a\u666f<\/h3>\n<table>\n<tr>\u6a21\u5f0f\u5e94\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>\u5de5\u5382\u6a21\u5f0f<\/td>\n<td>\u521b\u5efa\u4e0d\u540c MQ \u8fde\u63a5&#xff08;KafkaProducerFactory \/ RabbitMQFactory&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u7b56\u7565\u6a21\u5f0f<\/td>\n<td>\u4e0d\u540c\u98ce\u63a7\u89c4\u5219\u3001\u4e0d\u540c\u8fd0\u8d39\u8ba1\u7b97\u903b\u8f91<\/td>\n<\/tr>\n<tr>\n<td>\u6a21\u677f\u65b9\u6cd5<\/td>\n<td>\u62bd\u8c61 BaseExportService&#xff0c;\u5b50\u7c7b\u5b9e\u73b0 CSV\/Excel\/PDF \u5bfc\u51fa\u7ec6\u8282<\/td>\n<\/tr>\n<tr>\n<td>\u8d23\u4efb\u94fe\u6a21\u5f0f<\/td>\n<td>\u8fc7\u6ee4\u5668\u94fe&#xff08;Filter&#xff09;\u3001\u6743\u9650\u6821\u9a8c\u94fe<\/td>\n<\/tr>\n<tr>\n<td>\u89c2\u5bdf\u8005\u6a21\u5f0f<\/td>\n<td>Spring \u4e8b\u4ef6\u76d1\u542c&#xff08;ApplicationListener&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5efa\u9020\u8005\u6a21\u5f0f<\/td>\n<td>\u590d\u6742\u5bf9\u8c61\u6784\u5efa&#xff08;Order.builder().userId().amount().build()&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>11.3 \u65e5\u5fd7\u4e0e\u5f02\u5e38\u89c4\u8303<\/h3>\n<ul>\n<li>\u65e5\u5fd7\u7ea7\u522b&#xff1a;ERROR&#xff08;\u7cfb\u7edf\u4e0d\u53ef\u7528&#xff09;\u3001WARN&#xff08;\u53ef\u81ea\u6108\u5f02\u5e38&#xff09;\u3001INFO&#xff08;\u5173\u952e\u4e1a\u52a1\u8282\u70b9&#xff09;\u3001DEBUG&#xff08;\u4ec5\u5728\u5f00\u53d1\/\u538b\u6d4b\u5f00\u542f&#xff09;\u3002<\/li>\n<li>\u5f02\u5e38\u5206\u7c7b&#xff1a;\u4e1a\u52a1\u5f02\u5e38&#xff08;BizException&#xff09; \u548c\u7cfb\u7edf\u5f02\u5e38&#xff08;SystemException&#xff09; \u5206\u79bb\u3002\u5168\u5c40\u5f02\u5e38\u5904\u7406\u5668&#xff08;&#064;ControllerAdvice&#xff09;\u7edf\u4e00\u8fd4\u56de\u6807\u51c6\u5316\u9519\u8bef\u7801&#xff08;\u5982 PAY_001&#xff09;&#xff0c;\u4e0d\u5c06\u5806\u6808\u629b\u7ed9\u524d\u7aef\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u5341\u4e8c\u3001\u7ebf\u4e0a\u95ee\u9898\u6392\u67e5\u95ed\u73af&#xff08;\u2605\u2605\u2605\u2605\u2605 \u7ec8\u6781\u80fd\u529b&#xff09;<\/h2>\n<p>\u5f62\u6210\u6807\u51c6\u7684 PDCA \u5faa\u73af&#xff1a;\u5b9a\u4f4d&#xff08;Discover&#xff09;\u2192 \u5206\u6790&#xff08;Analyze&#xff09;\u2192 \u9a8c\u8bc1&#xff08;Verify&#xff09;\u2192 \u4fee\u590d&#xff08;Fix&#xff09;\u2192 \u590d\u76d8&#xff08;Review&#xff09;\u3002<\/p>\n<h3>12.1 \u5178\u578b\u573a\u666f\u901f\u67e5\u8868<\/h3>\n<table>\n<tr>\u6545\u969c\u73b0\u8c61\u7b2c\u4e00\u53cd\u5e94\u5de5\u5177\u6838\u5fc3\u6392\u67e5\u601d\u8def<\/tr>\n<tbody>\n<tr>\n<td>CPU 100%<\/td>\n<td>top -H -p &#043; jstack &#043; Arthas thread<\/td>\n<td>\u6b7b\u5faa\u73af&#xff08;\u6b63\u5219\u56de\u6eaf\u3001JSON \u5e8f\u5217\u5316\u5927\u5bf9\u8c61&#xff09;\u3001\u9891\u7e41 GC\u3001\u9501\u7ade\u4e89<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58\u98d9\u5347\/OOM<\/td>\n<td>jmap -dump &#043; MAT \/ Arthas heap<\/td>\n<td>\u5185\u5b58\u6cc4\u6f0f&#xff08;\u9759\u6001\u96c6\u5408\u3001ThreadLocal \u672a\u6e05\u7406&#xff09;\u3001\u5927\u5bf9\u8c61\u76f4\u63a5\u8fdb\u5165\u8001\u5e74\u4ee3<\/td>\n<\/tr>\n<tr>\n<td>Full GC \u9891\u7e41<\/td>\n<td>jstat -gcutil &#043; GC \u65e5\u5fd7<\/td>\n<td>\u68c0\u67e5\u8001\u5e74\u4ee3\u5360\u7528\u7387\u3001\u5143\u7a7a\u95f4\u662f\u5426\u81a8\u80c0\u3001\u662f\u5426\u6709\u5185\u5b58\u6cc4\u6f0f<\/td>\n<\/tr>\n<tr>\n<td>\u63a5\u53e3\u54cd\u5e94\u6162<\/td>\n<td>SkyWalking\/Jaeger \u94fe\u8def &#043; Arthas trace<\/td>\n<td>\u5b9a\u4f4d\u6162 SQL&#xff08;\u6570\u636e\u5e93&#xff09;\u3001\u5916\u90e8\u8c03\u7528\u8d85\u65f6&#xff08;Feign&#xff09;\u3001\u9501\u7b49\u5f85<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5e93\u6b7b\u9501<\/td>\n<td>SHOW ENGINE INNODB STATUS<\/td>\n<td>\u5206\u6790\u52a0\u9501\u987a\u5e8f\u3001\u95f4\u9699\u9501\u51b2\u7a81&#xff0c;\u7edf\u4e00\u8bbf\u95ee\u987a\u5e8f\u6216\u964d\u7ea7 RC<\/td>\n<\/tr>\n<tr>\n<td>Redis \u6162\u67e5\u8be2<\/td>\n<td>SLOWLOG GET 100 &#043; redis-cli &#8211;bigkeys<\/td>\n<td>\u662f\u5426\u5b58\u5728 BigKey \u6216 KEYS * \u547d\u4ee4&#xff1b;\u68c0\u67e5\u7f51\u7edc\u5ef6\u8fdf<\/td>\n<\/tr>\n<tr>\n<td>Kafka \u79ef\u538b<\/td>\n<td>kafka-consumer-groups &#8211;describe<\/td>\n<td>\u6d88\u8d39\u8005\u6570\u91cf\/\u5904\u7406\u80fd\u529b\u4e0d\u8db3\u3001\u5206\u533a\u503e\u659c\u3001Rebalance \u98ce\u66b4<\/td>\n<\/tr>\n<tr>\n<td>\u7ebf\u7a0b\u6c60\u6ee1<\/td>\n<td>jstack \u67e5\u770b WAITING\/BLOCKED \u7ebf\u7a0b<\/td>\n<td>\u6838\u5fc3\u7ebf\u7a0b\u6570\u8fc7\u5c0f\u3001\u961f\u5217\u5806\u79ef\u3001\u4efb\u52a1\u6267\u884c\u65f6\u95f4\u8fc7\u957f&#xff08;\u65e0\u8d85\u65f6&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>12.2 \u590d\u76d8\u6587\u5316&#xff08;\u7ec8\u6781\u6210\u957f&#xff09;<\/h3>\n<p>\u6bcf\u6b21\u6545\u969c\u540e\u8f93\u51fa \u6545\u969c\u62a5\u544a&#xff08;Incident Report&#xff09;&#xff0c;\u5305\u542b&#xff1a;<\/p>\n<li>\u65f6\u95f4\u7ebf&#xff08;Timeline&#xff09;&#xff1a;\u53d1\u73b0 \u2192 \u54cd\u5e94 \u2192 \u89e3\u51b3 \u7684\u65f6\u95f4\u70b9\u3002<\/li>\n<li>\u6839\u56e0&#xff08;Root Cause&#xff09;&#xff1a;5-Why \u5206\u6790\u6cd5\u6df1\u6316&#xff08;\u5982\u201c\u4e3a\u4ec0\u4e48 GC&#xff1f;\u2192 \u56e0\u4e3a\u7f13\u5b58\u5bf9\u8c61\u592a\u5927 \u2192 \u4e3a\u4ec0\u4e48\u5927&#xff1f;\u2192 \u672a\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4 \u2192 \u4e3a\u4ec0\u4e48\u672a\u8bbe\u7f6e&#xff1f;\u2192 \u89c4\u8303\u7f3a\u5931\u201d&#xff09;\u3002<\/li>\n<li>\u6539\u8fdb\u63aa\u65bd&#xff08;Action Items&#xff09;&#xff1a;\u6280\u672f\u6539\u8fdb&#xff08;\u4ee3\u7801\/\u914d\u7f6e&#xff09; &#043; \u7ba1\u7406\u6539\u8fdb&#xff08;\u53d1\u5e03\u6d41\u7a0b\/\u76d1\u63a7\u5b8c\u5584&#xff09;&#xff0c;\u5e76\u660e\u786e\u8d23\u4efb\u4eba\u4e0e\u622a\u6b62\u65e5\u671f\u3002<\/li>\n<hr \/>\n<p>\u81f3\u6b64&#xff0c;\u6211\u4eec\u5df2\u7ecf\u5b8c\u6574\u8986\u76d6\u4e86\u4f60\u590d\u4e60\u8def\u7ebf\u56fe\u4ece Java \u57fa\u7840\u3001Spring\u3001\u6570\u636e\u5e93\u3001Redis\u3001MQ\u3001\u5fae\u670d\u52a1\u5206\u5e03\u5f0f\u3001\u9ad8\u5e76\u53d1\u67b6\u6784\u3001\u4e91\u539f\u751f\u3001\u884c\u4e1a\u573a\u666f\u5230\u4ee3\u7801\u8d28\u91cf\u4e0e\u7ebf\u4e0a\u6392\u67e5\u7684\u5168\u90e8\u5185\u5bb9\u3002\u8fd9\u4efd\u6587\u6863\u53ef\u4ee5\u4f5c\u4e3a\u4f60\u535a\u5ba2\u7cfb\u7edf\u5316\u77e5\u8bc6\u5e93\u7684\u5e95\u7a3f&#xff0c;\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u9ad8\u7ea7\u5de5\u7a0b\u5e08\u9762\u8bd5\u7684\u67e5\u6f0f\u8865\u7f3a\u6e05\u5355\u3002\u795d\u4f60\u5b66\u4e60\u987a\u5229&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u7684&#xff0c;\u6211\u4eec\u7ee7\u7eed\u6309\u7167\u539f\u5927\u7eb2&#xff0c;\u8865\u5145 \u5fae\u670d\u52a1\u4e0e\u5206\u5e03\u5f0f&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u9ad8\u5e76\u53d1\u4e0e\u67b6\u6784&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4e91\u539f\u751f&#xff08;\u2605\u2605\u2605\u2605\u2606&#xff09;\u3001\u5236\u9020\u4e1a\u4e0e\u8de8\u5883\u7535\u5546&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4ee3\u7801\u80fd\u529b\u4e0e\u7ebf\u4e0a\u6392\u67e5&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09; \u7b49\u5269\u4f59\u6838\u5fc3\u6a21\u5757\u3002\u8fd9\u90e8\u5206\u662f\u9ad8\u7ea7\u5de5\u7a0b\u5e08\u7684\u201c\u5206\u6c34\u5cad\u201d&#xff0c;\u6db5\u76d6\u4e86\u4ece\u4ee3\u7801\u843d\u5730\u5230\u67b6\u6784\u8bbe\u8ba1\u3001\u518d\u5230\u884c\u4e1a\u573a\u666f\u843d\u5730\u7684\u5b8c\u6574\u95ed\u73af\u3002\u516d\u3001\u5fae\u670d\u52a1\u4e0e\u5206\u5e03<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,664,176],"topic":[],"class_list":["post-84789","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-664","tag-176"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784 - \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\/84789.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u597d\u7684&#xff0c;\u6211\u4eec\u7ee7\u7eed\u6309\u7167\u539f\u5927\u7eb2&#xff0c;\u8865\u5145 \u5fae\u670d\u52a1\u4e0e\u5206\u5e03\u5f0f&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u9ad8\u5e76\u53d1\u4e0e\u67b6\u6784&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4e91\u539f\u751f&#xff08;\u2605\u2605\u2605\u2605\u2606&#xff09;\u3001\u5236\u9020\u4e1a\u4e0e\u8de8\u5883\u7535\u5546&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4ee3\u7801\u80fd\u529b\u4e0e\u7ebf\u4e0a\u6392\u67e5&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09; \u7b49\u5269\u4f59\u6838\u5fc3\u6a21\u5757\u3002\u8fd9\u90e8\u5206\u662f\u9ad8\u7ea7\u5de5\u7a0b\u5e08\u7684\u201c\u5206\u6c34\u5cad\u201d&#xff0c;\u6db5\u76d6\u4e86\u4ece\u4ee3\u7801\u843d\u5730\u5230\u67b6\u6784\u8bbe\u8ba1\u3001\u518d\u5230\u884c\u4e1a\u573a\u666f\u843d\u5730\u7684\u5b8c\u6574\u95ed\u73af\u3002\u516d\u3001\u5fae\u670d\u52a1\u4e0e\u5206\u5e03\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/84789.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-26T09:56:52+00:00\" \/>\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=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84789.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/84789.html\",\"name\":\"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-26T09:56:52+00:00\",\"dateModified\":\"2026-07-26T09:56:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/84789.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/84789.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/84789.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784\"}]},{\"@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":"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784 - \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\/84789.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u597d\u7684&#xff0c;\u6211\u4eec\u7ee7\u7eed\u6309\u7167\u539f\u5927\u7eb2&#xff0c;\u8865\u5145 \u5fae\u670d\u52a1\u4e0e\u5206\u5e03\u5f0f&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u9ad8\u5e76\u53d1\u4e0e\u67b6\u6784&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4e91\u539f\u751f&#xff08;\u2605\u2605\u2605\u2605\u2606&#xff09;\u3001\u5236\u9020\u4e1a\u4e0e\u8de8\u5883\u7535\u5546&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09;\u3001\u4ee3\u7801\u80fd\u529b\u4e0e\u7ebf\u4e0a\u6392\u67e5&#xff08;\u2605\u2605\u2605\u2605\u2605&#xff09; \u7b49\u5269\u4f59\u6838\u5fc3\u6a21\u5757\u3002\u8fd9\u90e8\u5206\u662f\u9ad8\u7ea7\u5de5\u7a0b\u5e08\u7684\u201c\u5206\u6c34\u5cad\u201d&#xff0c;\u6db5\u76d6\u4e86\u4ece\u4ee3\u7801\u843d\u5730\u5230\u67b6\u6784\u8bbe\u8ba1\u3001\u518d\u5230\u884c\u4e1a\u573a\u666f\u843d\u5730\u7684\u5b8c\u6574\u95ed\u73af\u3002\u516d\u3001\u5fae\u670d\u52a1\u4e0e\u5206\u5e03","og_url":"https:\/\/www.wsisp.com\/helps\/84789.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-26T09:56:52+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/84789.html","url":"https:\/\/www.wsisp.com\/helps\/84789.html","name":"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-26T09:56:52+00:00","dateModified":"2026-07-26T09:56:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/84789.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/84789.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/84789.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Java\u9762\u8bd5\u3011\u2014\u2014\u5206\u5e03\u5f0f\u67b6\u6784"}]},{"@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\/84789","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=84789"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/84789\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=84789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=84789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=84789"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=84789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}