{"id":18852,"date":"2025-08-07T20:01:59","date_gmt":"2025-08-07T12:01:59","guid":{"rendered":"https:\/\/92it.top\/?p=18852"},"modified":"2025-08-07T20:01:59","modified_gmt":"2025-08-07T12:01:59","slug":"java%e7%ba%bf%e4%b8%8a%e6%8e%a5%e5%8f%a3%e5%93%8d%e5%ba%94%e6%85%a2%e5%a6%82%e4%bd%95%e6%8e%92%e6%9f%a5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=18852","title":{"rendered":"Java\u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u5982\u4f55\u6392\u67e5\uff1f"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a<a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html\">Java\u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u5982\u4f55\u6392\u67e5\uff1f<\/a><\/p>\n\n\n\n<p>\u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u53ef\u4ee5\u8bf4\u662f\u6bd4\u8fdb\u7a0b\u7a81\u7136\u6302\u6389\u66f4\u5e38\u89c1\u7684\u95ee\u9898\u4e86\uff0c\u5728\u5f71\u54cd\u4e0a\u5b83\u53ef\u80fd\u4e0d\u4f1a\u50cf\u8fdb\u7a0b\u4e2d\u65ad\u90a3\u6837\u4e25\u91cd\uff0c\u5bfc\u81f4\u6574\u4e2a\u670d\u52a1\u4e0d\u53ef\u7528\u3002\u867d\u7136\u5f71\u54cd\u9762\u5c0f\uff0c\u4f46\u662f\u7531\u4e8e\u5927\u91cf\u7684\u8bf7\u6c42\u5ef6\u8fdf\uff0c\u4f1a\u7ed9\u7528\u6237\u7684\u4f53\u9a8c\u5e26\u6765\u4e25\u91cd\u7684\u5f71\u54cd\u3002\u6240\u4ee5\uff0c\u9488\u5bf9\u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u95ee\u9898\u7684\u6392\u67e5\u4e0e\u5904\u7406\u4e5f\u662f\u6211\u4eec\u9700\u8981\u91cd\u70b9\u638c\u63e1\u7684\u3002\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4f1a\u7cfb\u7edf\u4ecb\u7ecd\u4e00\u4e9b\u5e38\u89c1\u7684\u5bfc\u81f4\u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u7684\u539f\u56e0\u53ca\u6392\u67e5\u624b\u6bb5<\/p>\n\n\n\n<p><strong>1. \u63a5\u53e3\u6027\u80fd\u95ee\u9898\u6392\u67e5\u8def\u5f84<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u63a5\u53e3\u7684\u6027\u80fd\u53d7\u5f88\u591a\u56e0\u7d20\u7684\u5f71\u54cd\uff0c\u629b\u5f00\u7cfb\u7edf\u95ee\u9898\u4e0d\u8c08\uff0c\u6bd4\u5982\u5355\u7eaf\u7684\u6d41\u91cf\u6fc0\u589e\uff0c\u8bf7\u6c42\u8fc7\u591a\u90fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\uff0c\u63a5\u53e3\u54cd\u5e94\u53d8\u6162\u3002\u53e6\u5916\u6570\u636e\u5e93\u5c42\u9762\u7684\u6162\u67e5\u8be2\uff0c\u4e1a\u52a1\u5c42\u9762\u7684\u4ee3\u7801\u903b\u8f91\u9519\u8bef\u4ee5\u53ca\u670d\u52a1\u5668\u8d44\u6e90\u95ee\u9898\u90fd\u4f1a\u5bfc\u81f4\u63a5\u53e3\u54cd\u5e94\u6162\u3002\u5bf9\u4e8e\u6162\u63a5\u53e3\u5e38\u89c1\u7684\u6392\u67e5\u70b9\u5982\u4e0b\u56fe\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"754\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-1024x754.png\" alt=\"\" class=\"wp-image-18853\" style=\"width:532px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-1024x754.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-300x221.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-768x565.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-830x611.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-230x169.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-350x258.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164-480x353.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-164.png 1410w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>2. \u4e1a\u52a1\u4ee3\u7801\u6392\u67e5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4e1a\u52a1\u4ee3\u7801\u7684\u5b9e\u73b0\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u4e5f\u51b3\u5b9a\u7740\u7a0b\u5e8f\u7684\u6027\u80fd\u95ee\u9898\uff0c\u4e00\u4efd\u4f18\u96c5\u7684\u4e1a\u52a1\u4ee3\u7801\uff0c\u5176\u6027\u80fd\u81ea\u7136\u4f1a\u9ad8\u4e0d\u5c11\u3002\u5bf9\u4e8e\u6bd4\u8f83\u590d\u6742\u7684\u4e1a\u52a1\u903b\u8f91\uff0c\u7531\u4e8e\u6d41\u7a0b\u975e\u5e38\u591a\uff0c\u5728\u4e1a\u52a1\u4ee3\u7801\u4e2d\u5f80\u5f80\u4f1a\u51fa\u73b0\u5faa\u73af\u8c03\u7528\u548c\u987a\u5e8f\u8c03\u7528\u7684\u60c5\u51b5\uff0c\u8fd9\u4e24\u79cd\u5b9e\u73b0\u518d\u5f88\u5927\u7a0b\u5ea6\u4e0a\u4f1a\u5f71\u54cd\u7a0b\u5e8f\u7684\u6027\u80fd\uff0c\u5e76\u4e14\u8fd9\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f\u662f\u53ef\u4ee5\u4f18\u5316\u7684<\/p>\n\n\n\n<p><strong>2.1 \u5faa\u73af\u8c03\u7528<\/strong><\/p>\n\n\n\n<p>\u5faa\u73af\u8c03\u7528\u4e0d\u662f\u8bf4\u4ee3\u7801\u4e2d\u6240\u6709\u5faa\u73af\u91cc\u7684\u903b\u8f91\u90fd\u6709\u95ee\u9898\uff0c\u800c\u662f\u8bf4\u5bf9\u4e8e\u5faa\u73af\u91cc\u6bcf\u6b21\u8c03\u7528\u7684\u903b\u8f91\u51e0\u4e4e\u4e00\u6837\uff0c\u524d\u540e\u53c8\u6beb\u65e0\u5173\u8054\u7684\u903b\u8f91\u5f80\u5f80\u662f\u53ef\u4ee5\u4f18\u5316\u7684\uff0c\u6bd4\u5982\u4e0b\u5217\u4ee3\u7801\u903b\u8f91\uff0c\u9700\u8981\u5faa\u73af\u8c03\u7528<code>processData<\/code>\u51fd\u6570\u5904\u751f\u621030\u4e2a<code>Data<\/code>\u7c7b\u578b\u7684\u6570\u636e\u7136\u540e\u6dfb\u52a0\u5230<code>list<\/code>\u6570\u7ec4\u4e2d<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">List&lt;Data> list = new ArrayList&lt;>();\nfor(int i = 0 ; i &lt; 30 ; i ++) {\n    Data date = processData(i); \/\/ \u8ba1\u7b9730\u4e2aData\u7c7b\u578b\u7684\u6570\u636e\uff0c\u6dfb\u52a0\u5230list\u6570\u7ec4\u4e2d\n    list.add(date);\n}<\/pre>\n\n\n\n<p>\u5f88\u660e\u663e\uff0c\u8fd9\u91cc\u6bcf\u4e2a\u6570\u636e\u7684\u751f\u6210\u90fd\u662f\u76f8\u4e92\u72ec\u7acb\u7684\uff0c\u5b8c\u5168\u53ef\u4ee5\u91c7\u7528\u591a\u7ebf\u7a0b\u65b9\u5f0f\u8fdb\u884c\u4f18\u5316<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5efa\u7acb\u4e00\u4e2a\u7ebf\u7a0b\u6c60\uff0c\u5e76\u884c\u5904\u7406\u4e0a\u8ff0process\u903b\u8f91\npublic static ExecutorService commonThreadPool = new ThreadPoolExecutor(6, 6, 300L,\n    TimeUnit.SECONDS, new LinkedBlockingQueue&lt;>(10), commonThreadFactory, new ThreadPoolExecutor.DiscardPolicy());\n\n\/\/ \u5f00\u59cb\u591a\u7ebf\u7a0b\u8c03\u7528\nList&lt;Future&lt;Data>> futures = new ArrayList&lt;>();\nfor(int i = 0 ; i &lt; 30 ; i ++) {\n    Future&lt;Data> future = commonThreadPool.submit(() -> processData(i));\n    futures.add(future);\n}\n\n\/\/ \u4ecefutures\u83b7\u53d6\u7ed3\u679c\u6dfb\u52a0\u5230list\u4e2d\nList&lt;Data> list = new ArrayList&lt;>();\ntry {\n    for (int i = 0 ; i &lt; futures.size() ; i ++) {\n        list.add(futures.get(i).get());\n    }\n} catch (Exception e) {\n    log.error(\"error\uff1a\", e);\n}<\/pre>\n\n\n\n<p><strong>2.2 \u987a\u5e8f\u8c03\u7528<\/strong><\/p>\n\n\n\n<p>\u9664\u4e86\u5faa\u73af\u8c03\u7528\u4e4b\u5916\uff0c\u6709\u7684\u4e1a\u52a1\u903b\u8f91\u672c\u8eab\u5f88\u590d\u6742\uff0c\u9700\u8981\u6d89\u53ca\u591a\u4e2a\u8c03\u7528\u8fc7\u7a0b\uff0c\u5982\u679c\u6bcf\u4e2a\u63a5\u53e3\u90fd\u4e32\u884c\u7684\u987a\u5e8f\u8c03\u7528\u7684\u8bdd\uff0c\u6027\u80fd\u5fc5\u7136\u4e0d\u597d\uff0c\u5176\u5b9e\u8fd9\u79cd\u60c5\u51b5\u4e0b\u94b1\u4e5f\u53ef\u4ee5\u7528\u591a\u7ebf\u7a0b\u7684\u65b9\u5f0f\u8fdb\u884c\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"1024\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-783x1024.png\" alt=\"\" class=\"wp-image-18854\" style=\"width:343px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-783x1024.png 783w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-229x300.png 229w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-768x1005.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-830x1086.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-230x301.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-350x458.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165-480x628.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-165.png 922w\" sizes=\"(max-width: 783px) 100vw, 783px\" \/><\/figure><\/div>\n\n\n<p>\u4ee3\u7801\u903b\u8f91\u53ef\u4ee5\u7b80\u5355\u8868\u793a\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">A a = funcA();\nB b = funcB();\n\nC c = funcC(a, b);\n\nD d = funcD(c);\nE e = funcE(c);\n\nreturn funcResult(d, e);<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u7684\u903b\u8f91\u5176\u5b9e\u53ef\u4ee5\u7528<code>CompletableFuture<\/code>\u6765\u8fdb\u884c\u4f18\u5316\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CompletableFuture&lt;A> futureA = CompletableFuture.supplyAsync(() -> funcA());\nCompletableFuture&lt;B> futureB = CompletableFuture.supplyAsync(() -> funcB());\nCompletableFuture.allOf(futureA,futureB) \/\/ \u7b49funcA()\u548cfuncB()\u4e24\u4e2a\u5e76\u884c\u4efb\u52a1\u90fd\u6267\u884c\u5b8c\u6210\uff0c\n\nC c = funcC(futureA.join(), futureB.join());\n\nCompletableFuture&lt;D> futureD = CompletableFuture.supplyAsync(() -> funcD(c));\nCompletableFuture&lt;E> futureE = CompletableFuture.supplyAsync(() -> funcE(c));\nCompletableFuture.allOf(futureD,futureE) \/\/ \u7b49funcD()\u548cfunE()\u4e24\u4e2a\u5e76\u884c\u4efb\u52a1\u90fd\u6267\u884c\u5b8c\u6210\uff0c\n\nreturn doResult(futureD.join(),futureE.join());<\/pre>\n\n\n\n<p>\u5728\u539f\u6765\u7684\u903b\u8f91\u4e2d\uff0c<code>funcA()<\/code>\u548c<code>funcB()<\/code>\u662f\u4e32\u884c\u6267\u884c\u7684\uff0c<code>funcD()<\/code>\u548c<code>funE()<\/code>\u4e5f\u662f\u4e32\u884c\u6267\u884c\u7684\uff0c\u4f18\u5316\u4e4b\u540e\uff0c<code>funcA()<\/code>\u548c<code>funcB()<\/code>\u53d8\u6210\u5e76\u884c\u6267\u884c\u7684\uff0c<code>funcD()<\/code>\u548c<code>funE()<\/code>\u4e5f\u662f\u5e76\u884c\u7684\u3002\u6700\u5927\u6267\u884c\u65f6\u95f4\u5c31\u53ea\u53d6\u51b3\u4e8e\u5e76\u884c\u7684\u54ea\u4e2a\u903b\u8f91\u66f4\u6162\u4e86\uff0c\u800c\u4e0d\u4f1a\u662f\u8fd0\u884c\u65f6\u95f4\u7684\u53e0\u52a0\u4e86<\/p>\n\n\n\n<p><strong>2.3 \u7ebf\u7a0b\u6c60\u8bbe\u8ba1\u4e0d\u5408\u7406<\/strong><\/p>\n\n\n\n<p>\u7ebf\u7a0b\u6c60\u4e00\u822c\u88ab\u6211\u4eec\u7528\u4f5c\u903b\u8f91\u5e76\u884c\u4f18\u5316\u7684\u4e3b\u8981\u624b\u6bb5\uff0c\u4f46\u662f\u7ebf\u7a0b\u6c60\u7684\u8bbe\u8ba1\u4e0d\u5408\u7406\u540c\u6837\u4f1a\u4f7f\u7a0b\u5e8f\u7684\u6267\u884c\u6548\u7387\u5f88\u6162\u3002\u7ebf\u7a0b\u6c60\u6709\u4e09\u4e2a\u91cd\u8981\u53c2\u6570\uff1a\u6838\u5fc3\u7ebf\u7a0b\u6570\u3001\u6700\u5927\u7ebf\u7a0b\u6570\u3001\u7b49\u5f85\u961f\u5217\u3002\u56de\u987e\u4e00\u4e0b\u7ebf\u7a0b\u6c60\u7684\u5904\u7406\u903b\u8f91\uff1a<\/p>\n\n\n\n<p>\u7ebf\u7a0b\u6c60\u521d\u59cb\u521b\u5efa\u540e\uff0c\u91cc\u9762\u7684\u7ebf\u7a0b\u6570\u4e3a0\uff0c\u5f53\u6709\u4efb\u52a1\u63d0\u4ea4\u7684\u65f6\u5019\uff0c\u5f00\u59cb\u521b\u5efa\u548c\u6838\u5fc3\u7ebf\u7a0b<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-1024x608.png\" alt=\"\" class=\"wp-image-18855\" style=\"width:404px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-1024x608.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-300x178.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-768x456.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-830x493.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-230x137.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-350x208.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166-480x285.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-166.png 1240w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u5982\u679c\u6838\u5fc3\u7ebf\u7a0b\u6ee1\u4e86\uff0c\u53ea\u6709\u4efb\u52a1\u63d0\u4ea4\u7684\u8bdd\uff0c\u5219\u4efb\u52a1\u4f1a\u8fdb\u5165\u5230\u7b49\u5f85\u961f\u5217<a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_2-3-\u7ebf\u7a0b\u6c60\u8bbe\u8ba1\u4e0d\u5408\u7406\"><\/a><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"644\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-1024x644.png\" alt=\"\" class=\"wp-image-18856\" style=\"width:396px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-1024x644.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-300x189.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-768x483.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-830x522.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-230x145.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-350x220.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167-480x302.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-167.png 1176w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u5982\u679c\u7b49\u5f85\u961f\u5217\u4e5f\u6ee1\u4e86\uff0c\u7ebf\u7a0b\u6c60\u5f00\u59cb\u521b\u5efa\u975e\u6838\u5fc3\u7ebf\u7a0b<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"623\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-1024x623.png\" alt=\"\" class=\"wp-image-18857\" style=\"width:430px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-1024x623.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-300x183.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-768x468.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-830x505.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-230x140.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-350x213.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168-480x292.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-168.png 1186w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u5982\u679c\u7ebf\u7a0b\u6c60\u91cc\u7684\u7ebf\u7a0b\u603b\u6570\u8fbe\u5230\u4e86\u6700\u5927\u7ebf\u7a0b\u6570\uff0c\u8fd8\u6709\u4efb\u52a1\u7ee7\u7eed\u63d0\u4ea4\u7684\u8bdd\uff0c\u4efb\u52a1\u4f1a\u963b\u585e<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"548\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-1024x548.png\" alt=\"\" class=\"wp-image-18858\" style=\"width:420px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-1024x548.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-300x161.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-768x411.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-830x444.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-230x123.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-350x187.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169-480x257.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-169.png 1218w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u7ebf\u7a0b\u6c60\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\u60c5\u51b5\uff1a<\/p>\n\n\n\n<ul>\n<li>\u6838\u5fc3\u7ebf\u7a0b\u8bbe\u7f6e\u8fc7\u5c0f\uff0c\u6ca1\u6709\u8fbe\u5230\u5e76\u884c\u7684\u6548\u679c<\/li>\n\n\n\n<li>\u4e00\u4e2a\u7ebf\u7a0b\u6c60\u6709\u591a\u4e2a\u4e1a\u52a1\u516c\u7528\uff0c\u975e\u6838\u5fc3\u4e1a\u52a1\u5360\u636e\u4e86\u5927\u91cf\u7684\u7ebf\u7a0b\uff0c\u5bfc\u81f4\u4e3b\u7ebf\u4efb\u52a1\u5de5\u4f5c\u7ebf\u7a0b\u4e0d\u8db3<\/li>\n\n\n\n<li>\u4efb\u52a1\u8fc7\u591a\uff0c\u7ebf\u7a0b\u6c60\u91cc\u7684\u7ebf\u7a0b\u88ab\u5360\u6ee1\uff0c\u5927\u91cf\u4efb\u52a1\u963b\u585e<\/li>\n<\/ul>\n\n\n\n<p><strong>2.4 \u9501\u8bbe\u8ba1\u4e0d\u5408\u7406<\/strong><\/p>\n\n\n\n<p>\u7a0b\u5e8f\u4e2d\u7684\u9501\u8bbe\u8ba1\u4e0d\u5408\u7406\u540c\u6837\u4f1a\u5bfc\u81f4\u6027\u80fd\u4f4e\u4e0b\uff0c\u8bbe\u8ba1\u4e0d\u5408\u7406\u7684\u9501\u4e00\u822c\u662f\u4ee5\u4e0b\u4e24\u79cd\u60c5\u51b5\uff1a<\/p>\n\n\n\n<p><strong>2.4.1 \u9501\u7c7b\u578b\u4e0d\u5408\u7406<\/strong><\/p>\n\n\n\n<p>\u5728\u4e00\u822c\u7684\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u63d0\u4f9b\u7684\u9501\u4e00\u822c\u90fd\u6709\u4e92\u65a5\u9501\u548c\u8bfb\u5199\u9501\u4e24\u79cd\uff0c\u8bfb\u5199\u9501\u5c31\u662f\u8bfb\u53ef\u4ee5\u5171\u4eab\uff0c\u800c\u5199\u4e92\u65a5\uff0c\u4e92\u65a5\u9501\u5c31\u662f\u5728\u4efb\u4f55\u573a\u666f\u4e0b\u90fd\u662f\u4e92\u65a5\u7684\uff0c\u6240\u4ee5\u52a0\u4e92\u65a5\u9501\u7684\u6027\u80fd\u4f1a\u66f4\u5dee\u3002\u6240\u4ee5\u5728\u53ef\u4ee5\u52a0\u8bfb\u5199\u9501\u7684\u65f6\u5019\uff0c\u5982\u679c\u6211\u4eec\u52a0\u6210\u4e86\u4e92\u65a5\u9501\uff0c\u90a3\u4e48\u5728\u8bfb\u8fdc\u8fdc\u591a\u4e8e\u5199\u7684\u573a\u666f\u4e0b\uff0c\u6548\u7387\u4f1a\u6781\u5927\u964d\u4f4e\u7a0b\u5e8f\u8fd0\u884c\u6548\u7387\u3002<\/p>\n\n\n\n<p><strong>2.4.2 \u9501\u7c92\u5ea6\u592a\u7c97<\/strong><\/p>\n\n\n\n<p>\u9501\u7c92\u5ea6\u8fc7\u7c97\u662f\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u9501\u8bbe\u8ba1\u4e0d\u5408\u7406\u5bfc\u81f4\u7a0b\u5e8f\u6027\u80fd\u5dee\u7684\u60c5\u51b5\uff0c\u901a\u5e38\u628a\u9501\u5305\u88f9\u7684\u8303\u56f4\u8fc7\u5927\uff0c\u4f7f\u5f97\u52a0\u9501\u65f6\u95f4\u4f1a\u8fc7\u957f\uff0c\u6bd4\u5982\u4e00\u4e0b\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public synchronized void doJob() {\n    File f = processlData();\n    copyFile(f);\n    sendMessage();\n}<\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u903b\u8f91\u6709\u4e09\u4e2a\u4e3b\u8981\u7684\u9636\u6bb5\u4efb\u52a1\uff0c\u8ba1\u7b97\u6570\u636e\uff0c\u62f7\u8d1d\u6587\u4ef6\uff0c\u6700\u540e\u53d1\u9001\u6d88\u606f\u3002\u76f4\u89c2\u4e0a\u6765\u8bf4\uff0c\u5904\u7406\u6570\u636e\u8fd9\u91cc\u53ef\u80fd\u6d89\u53ca\u5230\u5e76\u53d1\u95ee\u9898\uff0c\u800c\u62f7\u8d1d\u6587\u4ef6\u4ee5\u53ca\u53d1\u9001\u6d88\u606f\u90fd\u662f\u540e\u7eed\u5de5\u4f5c\u4e86\uff0c\u5b8c\u5168\u53ef\u4ee5\u4e0d\u52a0\u9501\u3002\u8fd9\u91cc\u7684\u67b7\u9501\u8303\u56f4\u5c31\u53ef\u4ee5\u4f18\u5316\uff0c\u5b8c\u5168\u53ef\u4ee5\u6539\u6210\uff1a<a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_2-4-\u9501\u8bbe\u8ba1\u4e0d\u5408\u7406\"><\/a><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public void doSome() {\n    File f = null;\n    synchronized(this) {\n        f = processlData();\n    }\n    copyFile(f);\n    sendMessage();\n}<\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>3. \u6570\u636e\u5e93\u6392\u67e5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u9664\u4e86\u4e1a\u52a1\u4ee3\u7801\u5916\uff0c\u53e6\u4e00\u4e2a\u975e\u5e38\u5e38\u89c1\u7684\u5f71\u54cd\u540e\u7aef\u63a5\u53e3\u6027\u80fd\u7684\u95ee\u9898\u5c31\u662f\u6570\u636e\u5e93\u95ee\u9898\u4e86\u3002\u6d89\u53ca\u5230\u6570\u636e\u5e93\u5bfc\u81f4\u7684\u6027\u80fd\u95ee\u9898\uff0c\u6709\u5f88\u591a\u4e2a\u65b9\u9762\uff0c\u4e0b\u9762\u5927\u81f4\u505a\u4e86\u4e2a\u4e0d\u5b8c\u5168\u603b\u7ed3<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"915\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-1024x915.png\" alt=\"\" class=\"wp-image-18859\" style=\"width:398px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-1024x915.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-300x268.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-768x686.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-830x742.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-230x206.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-350x313.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170-480x429.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-170.png 1242w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p><strong>3.1 \u6df1\u5206\u9875\u95ee\u9898<\/strong><\/p>\n\n\n\n<p>mysql\u7684\u5206\u9875\u67e5\u8be2\u4e00\u822c\u4f7f\u7528<code>limit<\/code>\u67e5\u8be2\u8bed\u53e5\u6765\u5b8c\u6210\uff0c\u6bd4\u5982\u67e5\u8be2\u4e00\u5f20<code>student<\/code>\u8868\u91cc\u67e5<code>100<\/code>\u5230<code>120<\/code>\u8fd9<code>20<\/code>\u6761\u6570\u636e<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">select * from student limit 100,20<\/pre>\n\n\n\n<p>mysql\u4f1a\u628a\u524d<code>120<\/code>\u6761\u6570\u636e\u90fd\u67e5\u51fa\u6765\uff0c\u629b\u5f03\u524d<code>100<\/code>\u6761\uff0c\u8fd4\u56de<code>2<\/code>0\u6761\uff0c\u8fd9\u91cc\u67e5\u8be2<code>120<\/code>\u6761\u6570\u636e\uff0cmysql\u6027\u80fd\u4e0d\u4f1a\u6709\u4ec0\u4e48\u95ee\u9898\uff0c\u4f46\u662f\u5f53\u5206\u9875\u6df1\u5ea6\u53d8\u5f97\u8d8a\u6765\u8d8a\u5927\uff0c\u6bd4\u5982\u8fbe\u5230<code>100w<\/code>\u7684\u65f6\u5019\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">select * from student limit 1000000,20<\/pre>\n\n\n\n<p>\u8fd9\u6837mysql\u4f1a\u67e5\u51fa\u6765<code>1000020<\/code>\u6761\u6570\u636e\uff0c\u629b\u5f03<code>1000000<\/code>\u6761\uff0c\u901f\u5ea6\u5fc5\u7136\u5f88\u6162\u3002\u8fd9\u91cc\u53ef\u4ee5\u505a\u4e00\u4e2a\u4f18\u5316\uff0c\u76f4\u63a5\u67e5\u8be2<code>id>1000000<\/code>\u7684\u6570\u636e\uff0c\u7136\u540e\u53d6<code>20<\/code>\u6761\u5373\u53ef<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">select * from student where id > 1000000 limit 20<\/pre>\n\n\n\n<p>\u8fd9\u6837\uff0cmysql\u4f1a\u8d70\u4e3b\u952e\u7d22\u5f15\uff0c\u76f4\u63a5\u627e\u5230<code>1000000<\/code>\u5904\uff0c\u7136\u540e\u67e5\u51fa\u6765<code>20<\/code>\u6761\u6570\u636e\uff0c\u6548\u7387\u4f1a\u9ad8\u5f97\u591a<\/p>\n\n\n\n<p><strong>3.2 \u672a\u52a0\u7d22\u5f15<\/strong><\/p>\n\n\n\n<p>\u8fd9\u4e2a\u53ef\u4ee5\u501f\u52a9mysql\u63d0\u4f9b\u7684<code>explain<\/code>\u5de5\u5177\u6765\u6392\u67e5\uff0c\u770b\u4e0b\u63a5\u53e3\u8bbe\u8ba1\u7684\u5230sql\u8bed\u53e5\u67e5\u8be2\u6709\u6ca1\u6709\u8d70\u7d22\u5f15\uff0c\u5173\u4e8e<code>explain<\/code>\u7684\u5206\u6790\uff0c\u8fd9\u91cc\u5c31\u4e0d\u518d\u8d58\u8ff0\u3002<\/p>\n\n\n\n<p><strong>3.3 \u7d22\u5f15\u5931\u6548<\/strong><\/p>\n\n\n\n<p>\u6bd4\u8d77\u672a\u52a0\u7d22\u5f15\uff0c\u7d22\u5f15\u5931\u6548\u7684\u7684\u60c5\u51b5\u66f4\u52a0\u590d\u6742\uff0c\u6392\u67e5\u8d77\u6765\u4e5f\u66f4\u56f0\u96be\u4e00\u4e9b\u3002\u540c\u6837\u53ef\u4ee5\u901a\u8fc7<code>explain<\/code>\u6765\u67e5\u770b\u7d22\u5f15\u662f\u5426\u751f\u6548\uff0c\u7136\u540e\u91c7\u53d6\u5bf9\u5e94\u63aa\u65bd\uff0c\u4e0b\u9762\u603b\u7ed3\u4e86\u4e00\u4e9b\u5e38\u89c1\u7684\u7d22\u5f15\u5931\u6548\u7684\u573a\u666f<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-1024x316.png\" alt=\"\" class=\"wp-image-18860\" style=\"width:502px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-1024x316.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-300x93.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-768x237.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-830x256.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-230x71.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-350x108.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171-480x148.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/08\/image-171.png 1244w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u5173\u4e8e\u5177\u4f53\u7684\u7d22\u5f15\u5931\u6548\u7684sql\u8fd9\u91cc\u5c31\u4e0d\u518d\u8d58\u8ff0\uff0c\u8fd9\u91cc\u4e3b\u8981\u8bb2\u4e00\u4e0b\u7d22\u5f15\u5931\u6548\u7684\u7b2c\u4e00\u4e2a\u70b9\uff0c\u5c31\u662f\u5b57\u6bb5\u533a\u5206\u6027\u5dee\uff0c\u4ec0\u4e48\u662f\u5b57\u6bb5\u533a\u5206\u6027\u5dee\u5462\uff1f\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b3\u79cd\u60c5\u51b5\u6765\u7406\u89e3<\/p>\n\n\n\n<ol>\n<li>\u5b57\u6bb5\u503c\u5c11\uff0c\u6bd4\u5982\u4e00\u4e2a\u6027\u522b\u5b57\u6bb5\uff0c\u603b\u5171\u53ea\u6709\u4e24\u4e2a\u503c\uff0c\u90a3\u8fd9\u4e2a\u5b57\u6bb5\u7684\u7d22\u5f15\u533a\u5206\u5ea6\u5c31\u5f88\u4f4e<\/li>\n\n\n\n<li>\u67d0\u4e2a\u5b57\u6bb5\u5927\u91cf\u4e3a\u7a7a\uff0c\u53ea\u6709\u5c11\u91cf\u6709\u503c\uff0c\u8fd9\u4e2a\u5b57\u6bb5\u7684\u533a\u5206\u5ea6\u4e5f\u5f88\u4f4e<\/li>\n\n\n\n<li>\u5b57\u6bb5\u503c\u592a\u96c6\u4e2d\uff0c\u6bd4\u5982\u4e00\u4e2a\u5b57\u6bb5\u503c90%\u90fd\u662f1\uff0c\u5269\u4e0b10%\u53ef\u80fd\u662f\u5176\u4ed6\u503c\uff0c\u533a\u5206\u5ea6\u4e5f\u5f88\u4f4e<\/li>\n<\/ol>\n\n\n\n<p>\u6240\u4ee5\u5728\u5efa\u7acb\u7d22\u5f15\u7684\u65f6\u5019\uff0c\u6700\u597d\u4e0d\u8981\u5efa\u7acb\u5728\u533a\u5206\u5ea6\u4f4e\u7684\u5b57\u6bb5\u4e0a\uff0c\u8fd9\u6837\u4f1a\u5bfc\u81f4\u7d22\u5f15\u5931\u6548<\/p>\n\n\n\n<p><strong>3.4 join\u67e5\u8be2\u8fc7\u591a<\/strong><\/p>\n\n\n\n<p><code>join<\/code>\u67e5\u8be2\u5176\u5b9e\u53ef\u4ee5\u7528\u6765\u4f18\u5316\u5b50\u67e5\u8be2\uff0c\u4e00\u822c\u6765\u8bf4\uff0c\u5728sql\u4e2d\u5927\u91cf\u4f7f\u7528\u5b50\u67e5\u8be2\u662f\u4e0d\u63a8\u8350\u7684\uff0c\u56e0\u4e3a\u6267\u884c\u5b50\u67e5\u8be2\u65f6\uff0cMySQL \u9700\u8981\u4e3a\u5185\u5c42\u67e5\u8be2\u8bed\u53e5\u7684\u67e5\u8be2\u7ed3\u679c\u5efa\u7acb\u4e00\u4e2a\u4e34\u65f6\u8868\uff0c\u7136\u540e\u5916\u5c42\u67e5\u8be2\u8bed\u53e5\u4ece\u4e34\u65f6\u8868\u4e2d\u67e5\u8be2\u8bb0\u5f55\u3002 \u67e5\u8be2\u5b8c\u6bd5\u540e\uff0c\u518d\u64a4\u9500\u8fd9\u4e9b\u4e34\u65f6\u8868\u3002 \u8fd9\u6837\u4f1a\u6d88\u8017\u8fc7\u591a\u7684CPU \u548cIO\u8d44\u6e90\u3002\u6240\u4ee5\u5b50\u67e5\u8be2\u4e00\u822c\u90fd\u5efa\u8bae\u4f18\u5316\u6210<code>join<\/code>\u6765\u67e5\u8be2<br>\u5373\u4fbf\u4f18\u5316\u6210<code>join<\/code>\u67e5\u8be2\u4e86\uff0c<code>join<\/code>\u5173\u8054\u7684\u8868\u4e5f\u4e0d\u5b9c\u8fc7\u591a\uff0c\u5982\u679c\u8868\u7684\u6570\u636e\u91cf\u5f88\u5927\uff0c\u4e00\u822c\u6765\u8bf42-3\u5f20\u8868\u5c31\u53ef\u4ee5\u4e86\u3002<code>join<\/code>\u64cd\u4f5c\u5176\u5b9e\u4e5f\u662f\u5728\u5185\u5b58\u53bb\u505a\u7684\uff0c\u6240\u4ee5\u5173\u8054\u7684\u6570\u636e\u91cf\u4e0d\u5b9c\u8fc7\u5927\uff0c\u540c\u65f6<code>join_buffer<\/code>\u4e5f\u8981\u9002\u5f53\u8bbe\u7f6e\u7684\u5927\u4e00\u4e9b\uff0c\u8fd9\u6837\u6548\u7387\u5c31\u9ad8\u4e00\u4e9b\u3002\u76f8\u53cd\uff0c\u5982\u679c<code>join<\/code>\u7684\u6570\u636e\u91cf\u592a\u5927\uff0cmysql\u4f1a\u91c7\u7528\u5728\u786c\u76d8\u4e0a\u521b\u5efa\u4e34\u65f6\u8868\u7684\u65b9\u5f0f\u8fdb\u884c\u591a\u5f20\u8868\u7684\u5173\u8054\u5339\u914d\uff0c\u663e\u7136\u8fd9\u5c31\u6d89\u53ca\u5230\u78c1\u76d8IO\u4e86\uff0c\u6548\u7387\u5c31\u4f1a\u4f4e\u7684\u591a<br>\u5982\u679c\u5728\u4e1a\u52a1\u4e2d\u7684\u67e5\u8be2\u4e00\u5b9a\u8981\u6d89\u53ca\u5230\u591a\u4e2a\u8868\uff0c\u800c\u4e14\u6570\u636e\u91cf\u5f88\u5927\uff0c\u90a3\u4e48\u6700\u597d\u7684\u65b9\u5f0f\u5c31\u662f\u5728\u4e1a\u52a1\u5c42\u628a\u67e5\u8be2\u62c6\u6210\u4e2a\u5b50\u67e5\u8be2\uff0c\u7136\u540e\u5728\u4e1a\u52a1\u5c42\u53d6\u505a\u805a\u5408\u62fc\u88c5\uff0c\u8fd9\u6837\u6548\u7387\u53cd\u800c\u66f4\u9ad8<\/p>\n\n\n\n<p><strong>3.5 \u8868\u6570\u636e\u91cf\u8fc7\u5927<\/strong><\/p>\n\n\n\n<p>\u518d\u7d22\u5f15\u4ee5\u53casql\u90fd\u6ca1\u6709\u660e\u663e\u95ee\u9898\u7684\u60c5\u51b5\u4e0b\uff0c\u67e5\u8be2\u8fd8\u662f\u5f88\u6162\u7684\u8bdd\uff0c\u90a3\u6709\u53ef\u80fd\u5c31\u662f\u8868\u7684\u6570\u636e\u91cf\u672c\u8eab\u5c31\u592a\u5927\u4e86\uff0c\u5bfc\u81f4\u7684\u6570\u636e\u5e93\u6027\u80fd\u964d\u4f4e\u3002\u8fd9\u4e2a\u65f6\u5019\u5355\u8868\u5df2\u7ecf\u4e0d\u8db3\u4ee5\u652f\u6491\u8d77\u8fd9\u4e48\u5927\u7684\u6570\u636e\u91cf\u4e86\uff0c\u6211\u4eec\u8981\u4e48\u505a\u6570\u636e\u8fc1\u79fb\uff0c\u5c06\u6570\u636e\u8fc1\u79fb\u5230\u5206\u5e03\u5f0f\u7684\u6570\u636e\u5e93\u4e2d\uff0c\u8981\u4e48\u5c31\u9700\u8981\u505a\u5206\u5e93\u5206\u8868\u4e86\u3002\u5173\u4e8e\u5206\u5e93\u5206\u8868\u7684\u5177\u4f53\u65b9\u6848\u9009\u62e9\u8fd9\u91cc\u4e0d\u505a\u8d58\u8ff0<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>4. \u7cfb\u7edf\u8d44\u6e90\u95ee\u9898<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u9664\u4e86\u7a0b\u5e8f\u672c\u8eab\u4ee5\u53ca\u6570\u636e\u5e93\u7684\u5f71\u54cd\u5916\uff0c\u53e6\u5916\uff0c\u673a\u5668\u672c\u8eab\u7684\u8d44\u6e90\u74f6\u9888\u4e5f\u662f\u5bfc\u81f4\u6211\u4eec\u7a0b\u5e8f\u6027\u80fd\u4f4e\u4e0b\u7684\u4e00\u4e2a\u91cd\u8981\u56e0\u7d20\u3002\u6bd4\u5982java\u7a0b\u5e8f\u4e2d\u7531\u4e8e\u4ee3\u7801\u95ee\u9898\u5bfc\u81f4\u9648\u65ed\u9891\u7e41\u7684\u53d1\u751ffullGC\uff0c\u6216\u8005\u662f\u4ee3\u7801\u5b58\u5728\u7ebf\u7a0b\u6cc4\u9732\u5f15\u8d77RSS\u5185\u5b58\u5360\u7528\u8fc7\u9ad8\u8fdb\u800c\u5f15\u8d77\u673a\u5668\u53cd\u5e94\u6162\uff0c\u53c8\u6216\u8005\u662f\u7531\u4e8e\u7f51\u7edc\u5ef6\u8fdf\u5bfc\u81f4rpc\u8c03\u7528\u4e00\u81f4\u5904\u4e8e\u7b49\u5f85\uff0c\u7b49\u5f85\u8bf8\u591a\u539f\u56e0\u90fd\u53ef\u80fd\u5bfc\u81f4\u63a5\u53e3\u54cd\u5e94\u53d8\u6162\u3002\u8fd9\u4e9b\u90fd\u9700\u8981\u501f\u52a9\u76d1\u63a7\u4ee5\u53ca\u65e5\u5fd7\u6765\u8fdb\u884c\u9010\u4e00\u6392\u67e5\uff0c\u5177\u4f53\u95ee\u9898\u5177\u4f53\u5206\u6790<a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_3-5-\u8868\u6570\u636e\u91cf\u8fc7\u5927\"><\/a><\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>5. \u901a\u7528\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4e0a\u9762\u8bb2\u4e86\u8fd9\u4e48\u591a\u5bfc\u81f4\u63a5\u53e3\u54cd\u5e94\u53d8\u6162\u7684\u5177\u4f53\u539f\u56e0\uff0c\u9664\u4e86\u5177\u4f53\u95ee\u9898\u5177\u4f53\u5206\u6790\u5916\uff0c\u90a3\u6709\u6ca1\u6709\u4e00\u4e9b\u901a\u7528\u7684\u53ef\u4ee5\u8003\u8651\u5230\u7684\u89e3\u51b3\u65b9\u6848\u80fd\u591f\u89e3\u51b3\u5927\u90e8\u5206\u7684\u4e1a\u52a1\u63a5\u53e3\u6162\u7684\u65b9\u6cd5\u5462\uff1f\u5176\u5b9e\u662f\u6709\u7684\uff0c\u6392\u9664\u4e86\u5177\u4f53\u7684\u95ee\u9898\u4ee5\u5916\uff0c\u6ca1\u6709\u7a0b\u5e8f\u4ee5\u53ca\u6570\u636e\u5e93\u6545\u969c\uff0c\u5355\u7eaf\u7684\u6570\u636e\u91cf\u5927\u5bfc\u81f4\u7684\u63a5\u53e3\u54cd\u5e94\u6162\u4f9d\u65e7\u662f\u6211\u4eec\u9700\u8981\u4f18\u5316\u7684\u91cd\u70b9\uff0c\u8fd9\u91cc\u6709\u4e24\u4e2a\u901a\u7528\u7684\u65b9\u6cd5<a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_3-4-join\u67e5\u8be2\u8fc7\u591a\"><\/a><\/p>\n\n\n\n<p><strong>5.1 \u52a0\u7f13\u5b58<\/strong><\/p>\n\n\n\n<p>\u5728\u8bfb\u63a5\u53e3\u7684\u4f18\u5316\u4e0a\u6765\u8bf4\uff0c\u7f13\u5b58\u662f\u4f18\u5316\u8bfb\u63a5\u53e3\u7684\u4e00\u4e2a\u4e07\u91d1\u6cb9\u65b9\u6cd5\u3002\u7f13\u5b58\u53c8\u53ef\u4ee5\u505a\u4e2d\u95f4\u4ef6\u7f13\u5b58\u548c\u672c\u5730\u7f13\u5b58\uff0c\u6240\u6709\u7684\u8bfb\u538b\u529b\u5927\uff0c\u90fd\u53ef\u4ee5\u501f\u52a9\u7f13\u5b58\u6765\u4f18\u5316\uff0c\u4e00\u7ea7\u4e0d\u591f\uff0c\u53ef\u4ee5\u505a\u591a\u7ea7\u4f18\u5316\uff0c\u5148\u7528redis\u505a\u4e00\u5c42db\u7eac\u5ea6\u7684\u4f18\u5316\uff0c\u5982\u679c\u6027\u80fd\u8fd8\u662f\u4e0d\u591f\uff0c\u53ef\u4ee5\u5728\u672c\u5730\u518d\u505a\u4e00\u5c42\u672c\u5730\u7f13\u5b58\uff0c\u7ee7\u7eed\u52a0\u5feb\u8bfb\u53d6\u901f\u5ea6<\/p>\n\n\n\n<p><strong>5.2 \u5f02\u6b65\u5316<\/strong><\/p>\n\n\n\n<p>\u901a\u5e38\u6211\u4eec\u7684\u4e1a\u52a1\u63a5\u53e3\u53ef\u80fd\u4f1a\u5305\u542b\u591a\u4e2a\u6d41\u7a0b\uff0c\u5982\u679c\u662f\u540c\u6b65\u7684\u65b9\u5f0f\uff0c\u6211\u4eec\u9700\u8981\u7b49\u5230\u6700\u540e\u6570\u636e\u5199\u5165\u6210\u529f\u540e\u624d\u4f1a\u8fd4\u56de\u7ed3\u679c\uff0c\u5982\u679c\u6d41\u91cf\u538b\u529b\u5f88\u5927\u5e76\u4e14\u6d41\u7a0b\u5f88\u957f\u7684\u60c5\u51b5\u4e0b\u5f88\u5b9a\u4f1a\u5bfc\u81f4\u5199\u5165\u6027\u80fd\u975e\u5e38\u5dee\uff0c\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u5c06\u5199\u8fc7\u7a0b\u505a\u5f02\u6b65\u5316\u5904\u7406\u3002\u5230\u4e86\u5199\u6d41\u7a0b\u8fd9\u91cc\u5148\u8fd4\u56de\u54cd\u5e94\uff0c\u7136\u540e\u901a\u8fc7\u5f02\u6b65\u65b9\u5f0f\u5199\u5165\uff0c\u5982\u679c\u6709\u5fc5\u8981\u77e5\u9053\u7ed3\u679c\u7684\u8bdd\uff0c\u53ef\u4ee5\u505a\u4e2a\u56de\u8c03\u901a\u77e5<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>6. \u5c0f\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u63a5\u53e3\u54cd\u5e94\u6162\u4e5f\u662f\u4e00\u4e2a\u8f83\u4e3a\u5bbd\u6cdb\u7684\u95ee\u9898\uff0c\u6392\u67e5\u8d77\u6765\u4e5f\u8981\u6d89\u53ca\u591a\u4e2a\u65b9\u9762\uff0c\u6bd4\u5982\u6570\u636e\u5e93\u95ee\u9898\uff0c\u7a0b\u5e8f\u4ee3\u7801\u95ee\u9898\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8d44\u6e90\u74f6\u9888\u7b49\u7b49\u90fd\u8981\u8003\u8651\u5230\u3002\u4e5f\u6709\u53ef\u80fd\u53ea\u662f\u5355\u7eaf\u7684\u6570\u636e\u91cf\u8fc7\u5927\u5bfc\u81f4\u7684\u63a5\u53e3\u54cd\u5e94\u6162\uff0c\u603b\u4e4b\uff0c\u5728\u5177\u4f53\u7684\u63a5\u53e3\u95ee\u9898\u9762\u524d\u8981\u5177\u4f53\u5206\u6790\uff0c\u627e\u5230\u5bf9\u5e94\u7684\u4f18\u5316\u624b\u6bb5<a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_6-\u5c0f\u7ed3\"><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_5-2-\u5f02\u6b65\u5316\"><a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_5-2-\u5f02\u6b65\u5316\"><\/a><\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_3-3-\u7d22\u5f15\u5931\u6548\"><a href=\"https:\/\/golangstar.cn\/backend_series\/advanced_interview\/java_request_slow.html#_3-3-\u7d22\u5f15\u5931\u6548\"><\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1aJava\u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u5982\u4f55\u6392\u67e5\uff1f \u7ebf\u4e0a\u63a5\u53e3\u54cd\u5e94\u6162\u53ef\u4ee5\u8bf4\u662f\u6bd4\u8fdb\u7a0b\u7a81\u7136\u6302\u6389\u66f4\u5e38\u89c1\u7684\u95ee\u9898\u4e86\uff0c\u5728\u5f71\u54cd\u4e0a\u5b83\u53ef\u80fd\u4e0d\u4f1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18852"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18852"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18852\/revisions"}],"predecessor-version":[{"id":18862,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18852\/revisions\/18862"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}