{"id":203658,"date":"2025-05-22T11:01:05","date_gmt":"2025-05-22T03:01:05","guid":{"rendered":"https:\/\/server.hk\/cnblog\/203658\/"},"modified":"2025-05-22T11:01:05","modified_gmt":"2025-05-22T03:01:05","slug":"%e7%ba%bf%e7%a8%8b%e6%b1%a0%e9%9a%94%e7%a6%bb%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e9%9c%80%e8%a6%81%e5%ae%83%ef%bc%9f%e5%a6%82%e4%bd%95%e7%94%a8%e5%ae%83%e4%bc%98%e5%8c%96%e4%bd%a0%e7%9a%84%e5%ba%94","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/203658\/","title":{"rendered":"\u7ebf\u7a0b\u6c60\u9694\u79bb\uff1a\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f\u5982\u4f55\u7528\u5b83\u4f18\u5316\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u7ebf\u7a0b\u6c60\u9694\u79bb\uff1a\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f\u5982\u4f55\u7528\u5b83\u4f18\u5316\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\uff1f<\/h1>\n<p>\u4f60\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u77e5\u8bc6\u5417\uff1f\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u7ebf\u7a0b\u6c60\u9694\u79bb\uff1a\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f\u5982\u4f55\u7528\u5b83\u4f18\u5316\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\uff1f\u300b<\/span>\uff0c\u4e3b\u8981\u4ecb\u7ecd\u7684\u5185\u5bb9\u5c31\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\uff0c\u5982\u679c\u4f60\u60f3\u63d0\u5347\u81ea\u5df1\u7684\u5f00\u53d1\u80fd\u529b\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u8fd9\u7bc7\u6587\u7ae0\uff0c\u5927\u5bb6\u8981\u77e5\u9053\u7f16\u7a0b\u7406\u8bba\u57fa\u7840\u548c\u5b9e\u6218\u64cd\u4f5c\u90fd\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u54e6\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241116\/17317479986738609e62d4a.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u7ebf\u7a0b\u6c60\u9694\u79bb\u8be6\u89e3<\/strong><\/p>\n<p>\u7ebf\u7a0b\u6c60\u9694\u79bb\u662f\u6307\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u9694\u79bb\u4e0d\u540c\u7684\u7ebf\u7a0b\u6c60\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u6c60\u6839\u636e\u5176\u7528\u9014\u548c\u7279\u6027\u8fdb\u884c\u4e13\u95e8\u914d\u7f6e\u3002\u8fd9\u79cd\u9694\u79bb\u5177\u6709\u4ee5\u4e0b\u91cd\u8981\u610f\u4e49\uff1a<\/p>\n<p><strong>\u597d\u5904\uff1a<\/strong><\/p>\n<ul>\n<li><strong>\u63d0\u9ad8\u6027\u80fd\uff1a<\/strong>\u4e3a\u4e0d\u540c\u7c7b\u578b\u7684\u4efb\u52a1\u5206\u914d\u4e13\u95e8\u7684\u7ebf\u7a0b\u6c60\u53ef\u4ee5\u4f18\u5316\u8d44\u6e90\u5229\u7528\u5e76\u6700\u5927\u5316\u541e\u5410\u91cf\u3002<\/li>\n<li><strong>\u7b80\u5316\u8d44\u6e90\u7ba1\u7406\uff1a<\/strong>\u6bcf\u4e2a\u7ebf\u7a0b\u6c60\u90fd\u6709\u72ec\u7acb\u7684\u8d44\u6e90\u9650\u5236\u548c\u914d\u7f6e\uff0c\u4fbf\u4e8e\u63a7\u5236\u548c\u7ba1\u7406\u3002<\/li>\n<li><strong>\u589e\u5f3a\u53ef\u9760\u6027\uff1a<\/strong>\u9694\u79bb\u7ebf\u7a0b\u6c60\u53ef\u4ee5\u9632\u6b62\u4e0d\u540c\u7c7b\u578b\u4efb\u52a1\u4e4b\u95f4\u7684\u5e72\u6270\u548c\u51b2\u7a81\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u6574\u4f53\u7a33\u5b9a\u6027\u3002<\/li>\n<li><strong>\u53ef\u4f38\u7f29\u6027\uff1a<\/strong>\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u6216\u5220\u9664\u7ebf\u7a0b\u6c60\u6765\u6ee1\u8db3\u5e94\u7528\u7a0b\u5e8f\u7684\u4e0d\u65ad\u53d8\u5316\u7684\u9700\u6c42\uff0c\u63d0\u9ad8\u53ef\u4f38\u7f29\u6027\u3002<\/li>\n<\/ul>\n<p><strong>spring boot \u4e2d\u7684\u7ebf\u7a0b\u6c60\u9694\u79bb\uff1a<\/strong><\/p>\n<p>spring boot \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 &#8216;@async&#8217; \u6ce8\u89e3\u5c06\u65b9\u6cd5\u6807\u8bb0\u4e3a\u5f02\u6b65\uff0c\u5e76\u5c06\u5b83\u4eec\u5206\u914d\u5230\u7279\u5b9a\u7684\u7ebf\u7a0b\u6c60\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>@Async(value = \"myCustomThreadPool\")\npublic void processTask() {\n    \/\/ \u5728 \"myCustomThreadPool\" \u7ebf\u7a0b\u6c60\u4e2d\u6267\u884c\u4efb\u52a1\n}<\/pre>\n<p><strong>java \u7a0b\u5e8f\u4e2d\u7684\u6700\u5927\u7ebf\u7a0b\u6c60\u6570\u91cf\uff1a<\/strong><\/p>\n<p>\u5c3d\u7ba1\u7406\u8bba\u4e0a\u6ca1\u6709\u9650\u5236\uff0c\u4f46\u5b9e\u9645\u4e0a\u4e00\u4e2a java \u7a0b\u5e8f\uff08jvm\uff09\u53ef\u4ee5\u652f\u6301\u7684\u6700\u5927\u7ebf\u7a0b\u6c60\u6570\u91cf\u53d7\u5230\u4ee5\u4e0b\u56e0\u7d20\u7684\u5f71\u54cd\uff1a<\/p>\n<ul>\n<li><strong>\u53ef\u7528\u5185\u5b58\uff1a<\/strong>\u7ebf\u7a0b\u6c60\u9700\u8981\u5360\u7528\u5185\u5b58\u7a7a\u95f4\uff0c\u56e0\u6b64\u53d7\u53ef\u7528\u5185\u5b58\u9650\u5236\u3002<\/li>\n<li><strong>\u64cd\u4f5c\u7cfb\u7edf\u9650\u5236\uff1a<\/strong>\u64cd\u4f5c\u7cfb\u7edf\u5bf9\u4e8e\u6bcf\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u521b\u5efa\u7684\u7ebf\u7a0b\u6570\u6709\u81ea\u5df1\u7684\u9650\u5236\u3002<\/li>\n<li><strong>cpu \u6027\u80fd\uff1a<\/strong>\u7ebf\u7a0b\u5207\u6362\u8017\u8d39\u8d44\u6e90\uff0c\u8fc7\u591a\u7ebf\u7a0b\u4f1a\u964d\u4f4e\u7cfb\u7edf\u6027\u80fd\u5e76\u5bfc\u81f4\u5047\u6b7b\u3002<\/li>\n<\/ul>\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u4e00\u4e2a jvm \u4e2d\u5b9e\u9645\u53ef\u7528\u7684\u7ebf\u7a0b\u6c60\u6570\u91cf\u5728 2000 \u5230 5000 \u4e4b\u95f4\u3002\u8fd9\u4e2a\u6570\u5b57\u5e76\u4e0d\u662f\u7edd\u5bf9\u7684\uff0c\u5e76\u4e14\u6839\u636e\u5e94\u7528\u7a0b\u5e8f\u7684\u7279\u5b9a\u9700\u6c42\u800c\u6709\u6240\u4e0d\u540c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u7ebf\u7a0b\u6c60\u9694\u79bb\uff1a\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f\u5982\u4f55\u7528\u5b83\u4f18\u5316\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ebf\u7a0b\u6c60\u9694\u79bb\uff1a\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f\u5982\u4f55\u7528&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-203658","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=203658"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/203658\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=203658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=203658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=203658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}