{"id":65939,"date":"2025-05-03T14:57:03","date_gmt":"2025-05-03T06:57:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/65939\/"},"modified":"2025-05-03T14:57:03","modified_gmt":"2025-05-03T06:57:03","slug":"%e7%ba%bf%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e4%bb%a5%e6%80%a7%e8%83%bd%e4%b8%ba%e7%9b%ae%e6%a0%87%e6%9d%a5%e5%ae%9a%e4%b9%89%e5%92%8c%e9%99%90%e5%88%b6%e6%89%a7%e8%a1%8c%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/65939\/","title":{"rendered":"\u7ebf\u7a0b\uff1a\u5982\u4f55\u4ee5\u6027\u80fd\u4e3a\u76ee\u6807\u6765\u5b9a\u4e49\u548c\u9650\u5236\u6267\u884c\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173148680159616.jpg\" class=\"aligncenter\" title=\"\u7ebf\u7a0b\uff1a\u5982\u4f55\u4ee5\u6027\u80fd\u4e3a\u76ee\u6807\u6765\u5b9a\u4e49\u548c\u9650\u5236\u6267\u884c\uff1f\u63d2\u56fe\" alt=\"\u7ebf\u7a0b\uff1a\u5982\u4f55\u4ee5\u6027\u80fd\u4e3a\u76ee\u6807\u6765\u5b9a\u4e49\u548c\u9650\u5236\u6267\u884c\uff1f\u63d2\u56fe\" \/><\/p>\n<p>\u7ebf\u7a0b\uff0c\u4e00\u79cd\u6709\u52a9\u4e8e\u5f00\u53d1\u73b0\u4ee3\u9ad8\u6027\u80fd\u89e3\u51b3\u65b9\u6848\u5e76\u6210\u4e3a\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\u3002\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u8bed\u8a00\uff0c\u5e76\u884c\u6267\u884c\u4efb\u52a1\u7684\u80fd\u529b\u90fd\u5177\u6709\u5f88\u5927\u7684\u5438\u5f15\u529b\u3002\u4f46\u663e\u7136\u6709\u672c\u53d4\u53d4\u7684\u540d\u8a00\uff1a\u201c\u80fd\u529b\u8d8a\u5927\uff0c\u8d23\u4efb\u8d8a\u5927\u3002\u201d\u5982\u4f55\u4ee5\u6700\u4f73\u65b9\u5f0f\u4f7f\u7528\u8be5\u89e3\u51b3\u65b9\u6848\uff0c\u4ee5\u5b9e\u73b0\u6027\u80fd\u3001\u66f4\u597d\u5730\u5229\u7528\u8d44\u6e90\u548c\u5e94\u7528\u7a0b\u5e8f\u5065\u5eb7\uff1f\u9996\u5148\uff0c\u6709\u5fc5\u8981\u4e86\u89e3\u672c\u4e3b\u9898\u7684\u57fa\u672c\u6982\u5ff5\u3002 <\/p>\n<h2> \u4ec0\u4e48\u662f\u201c\u7ebf\u7a0b\u201d\uff1f <\/h2>\n<p>\u7ebf\u7a0b\u662folor:#f60; text-decoration:underline;&#8217; href=&#8221;https:\/\/www.php.cn\/zt\/16016.html&#8221; target=&#8221;_blank&#8221;&gt;\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8fdb\u7a0b\u6267\u884c\u7684\u57fa\u672c\u5355\u4f4d\u3002\u5b83\u4eec\u5141\u8bb8\u7a0b\u5e8f\u5728\u540c\u4e00\u8fdb\u7a0b\u4e2d\u540c\u65f6\u6267\u884c\u591a\u4e2a\u64cd\u4f5c\u3002\u6bcf\u4e2a\u7ebf\u7a0b\u4e0e\u4e3b\u8fdb\u7a0b\u5171\u4eab\u76f8\u540c\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u4f46\u53ef\u4ee5\u72ec\u7acb\u6267\u884c\uff0c\u8fd9\u5bf9\u4e8e\u53ef\u4ee5\u5e76\u884c\u6267\u884c\u7684\u4efb\u52a1\u975e\u5e38\u6709\u7528\uff0c\u4f8b\u5982\u8f93\u5165\/\u8f93\u51fa\uff08i\/o\uff09\u64cd\u4f5c\u3001\u590d\u6742\u8ba1\u7b97\u6216\u6570\u636e\u7528\u6237\u754c\u9762\u3002 .<\/p>\n<p>\u5728\u8bb8\u591a\u7cfb\u7edf\u4e0a\uff0c\u7ebf\u7a0b\u7531\u64cd\u4f5c\u7cfb\u7edf\u7ba1\u7406\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u5206\u914d cpu \u65f6\u95f4\u5e76\u7ba1\u7406\u5b83\u4eec\u4e4b\u95f4\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u3002\u5728java\u3001\u3001c++\u7b49\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u90fd\u6709\u65b9\u4fbf\u521b\u5efa\u548c\u7ba1\u7406\u7ebf\u7a0b\u7684\u5e93\u548c\u6846\u67b6\u3002 <\/p>\n<h2> \u8981\u4f7f\u7528\u7ebf\u7a0b\uff1f <\/h2>\n<p>\u7ebf\u7a0b\u4e3b\u8981\u7528\u4e8e\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u548c\u54cd\u5e94\u80fd\u529b\u3002\u4f7f\u7528\u7ebf\u7a0b\uff0c\u5c24\u5176\u662f\u540e\u7aef\u7684\u539f\u56e0\u662f\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u5e76\u884c<\/strong>\uff1a\u7ebf\u7a0b\u5141\u8bb8\u60a8\u540c\u65f6\u6267\u884c\u591a\u4e2a\u64cd\u4f5c\uff0c\u4ece\u800c\u66f4\u597d\u5730\u5229\u7528\u53ef\u7528\u7684 cpu \u8d44\u6e90\uff0c\u7279\u522b\u662f\u5728\u5177\u6709\u591a\u4e2a\u5185\u6838\u7684\u7cfb\u7edf\u4e0a\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6027\u80fd<\/strong>\uff1a\u5728 i\/o \u64cd\u4f5c\u4e2d\uff0c\u4f8b\u5982\u8bfb\u5199\u6587\u4ef6\u6216\u7f51\u7edc\u901a\u4fe1\uff0c\u7ebf\u7a0b\u53ef\u4ee5\u901a\u8fc7\u5141\u8bb8\u7a0b\u5e8f\u5728\u7b49\u5f85\u8fd9\u4e9b\u4efb\u52a1\u5b8c\u6210\u7684\u540c\u65f6\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\u6765\u5e2e\u52a9\u63d0\u9ad8\u6027\u80fd\u64cd\u4f5c\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6a21\u5757\u5316<\/strong>\uff1a\u7ebf\u7a0b\u53ef\u7528\u4e8e\u5c06\u7a0b\u5e8f\u5212\u5206\u4e3a\u66f4\u5c0f\u3001\u66f4\u6613\u4e8e\u7ba1\u7406\u7684\u90e8\u5206\uff0c\u6bcf\u4e2a\u90e8\u5206\u6267\u884c\u7279\u5b9a\u7684\u4efb\u52a1\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u4f46\u662f\uff0c\u4ed4\u7ec6\u7ba1\u7406\u7ebf\u7a0b\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u4e0d\u6b63\u786e\u7684\u4f7f\u7528\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7ade\u4e89\u6761\u4ef6\u3001\u6b7b\u9501\u548c\u8c03\u8bd5\u56f0\u96be\u7b49\u95ee\u9898\u3002\u4e3a\u4e86\u66f4\u597d\u5730\u7ba1\u7406\u5b83\u4eec\uff0c\u4f7f\u7528\u4e86\u7ebf\u7a0b\u6c60\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<h2> \u4ec0\u4e48\u662f\u7ebf\u7a0b\u6c60\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f <\/h2>\n<p>\u7ebf\u7a0b\u6c60\u662f\u4e00\u79cd\u8f6f\u4ef6\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u6d89\u53ca\u521b\u5efa\u548c\u7ba1\u7406\u53ef\u91cd\u590d\u4f7f\u7528\u6765\u6267\u884c\u4efb\u52a1\u7684\u7ebf\u7a0b\u6c60\u3002\u7ebf\u7a0b\u6c60\u4e0d\u4f1a\u4e3a\u6bcf\u4e2a\u4efb\u52a1\u91cd\u590d\u521b\u5efa\u548c\u9500\u6bc1\u7ebf\u7a0b\uff0c\u800c\u662f\u7ef4\u62a4\u56fa\u5b9a\u6570\u91cf\u7684\u7ebf\u7a0b\uff0c\u51c6\u5907\u6839\u636e\u9700\u8981\u6267\u884c\u4efb\u52a1\u3002\u8fd9\u53ef\u4ee5\u663e\u7740\u63d0\u9ad8\u9700\u8981\u5904\u7406\u8bb8\u591a\u5e76\u53d1\u4efb\u52a1\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u3002\u4f7f\u7528\u7ebf\u7a0b\u6c60\u7684\u4f18\u70b9\u662f\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u63d0\u9ad8\u6027\u80fd\uff1a<\/strong>\u521b\u5efa\u548c\u9500\u6bc1\u7ebf\u7a0b\u5728\u8d44\u6e90\u65b9\u9762\u662f\u4e00\u9879\u6602\u8d35\u7684\u64cd\u4f5c\u3002\u7ebf\u7a0b\u6c60\u901a\u8fc7\u91cd\u7528\u73b0\u6709\u7ebf\u7a0b\u6765\u6700\u5c0f\u5316\u6b64\u6210\u672c\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u8d44\u6e90\u7ba1\u7406\uff1a<\/strong>\u63a7\u5236\u8fd0\u884c\u7684\u7ebf\u7a0b\u6570\u91cf\uff0c\u907f\u514d\u8fc7\u591a\u7684\u7ebf\u7a0b\u521b\u5efa\u5bfc\u81f4\u7cfb\u7edf\u8fc7\u8f7d\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6613\u4e8e\u4f7f\u7528\uff1a<\/strong>\u7b80\u5316\u7ebf\u7a0b\u7ba1\u7406\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u4e13\u6ce8\u4e8e\u5e94\u7528\u7a0b\u5e8f\u903b\u8f91\u800c\u4e0d\u662f\u7ebf\u7a0b\u7ba1\u7406\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u53ef\u6269\u5c55\u6027\uff1a<\/strong>\u5e2e\u52a9\u6269\u5c55\u5e94\u7528\u7a0b\u5e8f\u4ee5\u6709\u6548\u5730\u5904\u7406\u5927\u91cf\u5e76\u53d1\u4efb\u52a1\u3002<\/p>\n<\/li>\n<\/ul>\n<h2> \u5982\u4f55\u8bbe\u7f6e\u6c60\u4e2d\u7684\u7ebf\u7a0b\u9650\u5236 <\/h2>\n<p>\u597d\u5427\uff0c\u6211\u5f53\u7136\u5fc5\u987b\u521b\u5efa\u4e00\u4e2a\u7ebf\u7a0b\u6c60\u624d\u80fd\u66f4\u597d\u5730\u5229\u7528\u6b64\u529f\u80fd\uff0c\u4f46\u5f88\u5feb\u51fa\u73b0\u7684\u4e00\u4e2a\u95ee\u9898\u662f\uff1a\u201c\u6c60\u5e94\u8be5\u5305\u542b\u591a\u5c11\u4e2a\u7ebf\u7a0b\uff1f\u201d\u3002\u6309\u7167\u57fa\u672c\u903b\u8f91\uff0c\u8d8a\u591a\u8d8a\u597d\uff0c\u5bf9\u5417\uff1f\u5982\u679c\u6240\u6709\u4e8b\u60c5\u90fd\u53ef\u4ee5\u5e76\u884c\u5b8c\u6210\uff0c\u90a3\u4e48\u5f88\u5feb\u5c31\u4f1a\u5b8c\u6210\uff0c\u56e0\u4e3a\u901f\u5ea6\u4f1a\u66f4\u5feb\u3002\u56e0\u6b64\uff0c\u6700\u597d\u4e0d\u8981\u9650\u5236\u7ebf\u7a0b\u6570\u91cf\uff0c\u6216\u8005\u8bbe\u7f6e\u4e00\u4e2a\u8f83\u9ad8\u7684\u6570\u5b57\uff0c\u8fd9\u6837\u5c31\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u6b63\u786e\u5417\uff1f<br \/> \u8fd9\u662f\u4e00\u4e2a\u516c\u5e73\u7684\u8bf4\u6cd5\uff0c\u6240\u4ee5\u8ba9\u6211\u4eec\u6d4b\u8bd5\u4e00\u4e0b\u3002\u6b64\u6d4b\u8bd5\u7684\u4ee3\u7801\u662f\u7528 kotlin \u7f16\u5199\u7684\uff0c\u53ea\u662f\u4e3a\u4e86\u719f\u6089\u5e76\u6613\u4e8e\u7f16\u5199\u793a\u4f8b\u3002\u8fd9\u4e00\u70b9\u4e0e\u8bed\u8a00\u65e0\u5173\u3002 <br \/> \u901a\u8fc7 4 \u4e2a\u793a\u4f8b\u6765\u63a2\u7d22\u4e0d\u540c\u7684\u7cfb\u7edf\u6027\u8d28\u3002\u793a\u4f8b 1 \u548c\u793a\u4f8b 2 \u662f\u4e3a\u4e86\u4f7f\u7528 cpu \u8fdb\u884c\u5927\u91cf\u6570\u5b66\u8fd0\u7b97\uff0c\u5373\u8fdb\u884c\u5927\u91cf\u5904\u7406\u3002\u793a\u4f8b3\u91cd\u70b9\u5173\u6ce8i\/o\uff0c\u793a\u4f8b\u662f\u8bfb\u53d6\u6587\u4ef6\uff0c\u6700\u540e\uff0c\u793a\u4f8b4\u662f\u5e76\u884c\u7684\u60c5\u51b5\uff0c\u540c\u6837\u5173\u6ce8i\/o\u3002\u5b83\u4eec\u90fd\u4f7f\u7528\u4e0d\u540c\u5927\u5c0f\u7684\u6c60\uff0c\u5206\u522b\u5177\u6709 1\u30012\u30014\u30018\u300116\u300132\u300150\u3001100 \u548c 500 \u4e2a\u7ebf\u7a0b\u3002\u6240\u6709\u8fc7\u7a0b\u53d1\u751f\u8d85\u8fc7 500 \u6b21\u3002<\/p>\n<h4> \u793a\u4f8b 1 &#8211; \u8ba1\u7b97 1 \u5230 100000 \u4e4b\u95f4\u6709\u591a\u5c11\u4e2a\u7684\u4ee3\u7801 <\/h4>\n<pre>import kotlinx.coroutines.*\nimport kotlin.math.sqrt\nimport kotlin.system.measuretimemillis\n\nfun isprime(number: int): boolean {\n    if (number &lt;= 1) return false\n    for (i in 2..sqrt(number.todouble()).toint()) {\n        if (number % i == 0) return false\n    }\n    return true\n}\n\nfun countprimesinrange(start: int, end: int): int {\n    var count = 0\n    for (i in start..end) {\n        if (isprime(i)) {\n            count++\n        }\n    }\n    return count\n}\n\n@optin(delicatecoroutinesapi::class)\nfun main() = runblocking {\n    val rangestart = 1\n    val rangeend = 100_000\n    val numberofthreadslist = listof(1, 2, 4, 8, 16, 32, 50, 100, 500)\n\n    for (numberofthreads in numberofthreadslist) {\n        val customdispatcher = newfixedthreadpoolcontext(numberofthreads, \"custompool\")\n        val chunksize = (rangeend - rangestart + 1) \/ numberofthreads\n        val timetaken = measuretimemillis {\n            val jobs = mutablelistof&lt;deferred&lt;int&gt;&gt;()\n            for (i in 0 until numberofthreads) {\n                val start = rangestart + i * chunksize\n                val end = if (i == numberofthreads - 1) rangeend else start + chunksize - 1\n                jobs.add(async(customdispatcher) { countprimesinrange(start, end) })\n            }\n            val totalprimes = jobs.awaitall().sum()\n            println(\"total de n\u00fameros primos encontrados com $numberofthreads threads: $totalprimes\")\n        }\n        println(\"tempo levado com $numberofthreads threads: $timetaken ms\")\n        customdispatcher.close()\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h6> \u793a\u4f8b1 \u63a7\u5236\u53f0\u8f93\u51fa <\/h6>\n<pre>total de n\u00fameros primos encontrados com 1 threads: 9592\ntempo levado com 1 threads: 42 ms\ntotal de n\u00fameros primos encontrados com 2 threads: 9592\ntempo levado com 2 threads: 17 ms\ntotal de n\u00fameros primos encontrados com 4 threads: 9592\ntempo levado com 4 threads: 8 ms\ntotal de n\u00fameros primos encontrados com 8 threads: 9592\ntempo levado com 8 threads: 8 ms\ntotal de n\u00fameros primos encontrados com 16 threads: 9592\ntempo levado com 16 threads: 16 ms\ntotal de n\u00fameros primos encontrados com 32 threads: 9592\ntempo levado com 32 threads: 12 ms\ntotal de n\u00fameros primos encontrados com 50 threads: 9592\ntempo levado com 50 threads: 19 ms\ntotal de n\u00fameros primos encontrados com 100 threads: 9592\ntempo levado com 100 threads: 36 ms\ntotal de n\u00fameros primos encontrados com 500 threads: 9592\ntempo levado com 500 threads: 148 ms\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h4> \u793a\u4f8b 2 &#8211; \u8ba1\u7b97\u6590\u6ce2\u90a3\u5951\u6570\u5217\u4e0a\u7b2c 30 \u4e2a\u6570\u5b57\u7684\u4ee3\u7801 <\/h4>\n<pre>import kotlinx.coroutines.delicatecoroutinesapi\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.newfixedthreadpoolcontext\nimport kotlinx.coroutines.runblocking\nimport kotlin.system.measuretimemillis\n\nfun fibonacci(n: int): long {\n    return if (n &lt;= 1) n.tolong() else fibonacci(n - 1) + fibonacci(n - 2)\n}\n\n@optin(delicatecoroutinesapi::class)\nfun main() = runblocking {\n    val numberofthreadslist = listof(1, 2, 4, 8, 16, 32, 50, 100, 500)\n\n    for (numberofthreads in numberofthreadslist) {\n        val customdispatcher = newfixedthreadpoolcontext(numberofthreads, \"custompool\")\n        val numberstocalculate = mutablelistof&lt;int&gt;()\n        for (i in 1..1000) {\n            numberstocalculate.add(30)\n        }\n        val timetaken = measuretimemillis {\n            val jobs = numberstocalculate.map { number -&gt;\n                launch(customdispatcher) {\n                    fibonacci(number)\n                }\n            }\n            jobs.foreach { it.join() }\n        }\n        println(\"tempo levado com $numberofthreads threads: $timetaken ms\")\n        customdispatcher.close()\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h6> \u793a\u4f8b2 \u63a7\u5236\u53f0\u8f93\u51fa <\/h6>\n<pre>tempo levado com 1 threads: 4884 ms\ntempo levado com 2 threads: 2910 ms\ntempo levado com 4 threads: 1660 ms\ntempo levado com 8 threads: 1204 ms\ntempo levado com 16 threads: 1279 ms\ntempo levado com 32 threads: 1260 ms\ntempo levado com 50 threads: 1364 ms\ntempo levado com 100 threads: 1400 ms\ntempo levado com 500 threads: 1475 ms\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h4> \u793a\u4f8b 3 &#8211; \u8bfb\u53d6\u968f\u673a\u6570\u6587\u4ef6\u5e76\u5728\u8bfb\u53d6\u7ed3\u675f\u65f6\u6dfb\u52a0\u5b83\u4eec\u7684\u4ee3\u7801 <\/h4>\n<pre>import kotlinx.coroutines.*\nimport java.io.file\nimport kotlin.system.measuretimemillis\n\n@optin(delicatecoroutinesapi::class)\nfun main() = runblocking {\n    val file = file(\"numeros_aleatorios.txt\")\n\n    if (!file.exists()) {\n        println(\"arquivo n\u00e3o encontrado!\")\n        return@runblocking\n    }\n    val numberofthreadslist = listof(1, 2, 4, 8, 16, 32, 50, 100, 500)\n    for (numberofthreads in numberofthreadslist) {\n        val customdispatcher = newfixedthreadpoolcontext(numberofthreads, \"custompool\")\n        val timetaken = measuretimemillis {\n            val jobs = mutablelistof&lt;deferred&lt;int&gt;&gt;()\n            file.uselines { lines -&gt;\n                lines.foreach { line -&gt;\n                    jobs.add(async(customdispatcher) {\n                        processline(line)\n                    })\n                }\n            }\n            val totalsum = jobs.awaitall().sum()\n            println(\"total da soma com $numberofthreads threads: $totalsum\")\n        }\n        println(\"tempo levado com $numberofthreads threads: $timetaken ms\")\n        customdispatcher.close()\n    }\n\n}\n\nfun processline(line: string): int {\n    return line.toint() + 10\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h6> \u793a\u4f8b3 \u63a7\u5236\u53f0\u8f93\u51fa <\/h6>\n<pre>total da soma de 1201 linhas com 1 threads: 60192\ntempo levado com 1 threads: 97 ms\ntotal da soma de 1201 linhas com 2 threads: 60192\ntempo levado com 2 threads: 28 ms\ntotal da soma de 1201 linhas com 4 threads: 60192\ntempo levado com 4 threads: 30 ms\ntotal da soma de 1201 linhas com 8 threads: 60192\ntempo levado com 8 threads: 26 ms\ntotal da soma de 1201 linhas com 16 threads: 60192\ntempo levado com 16 threads: 33 ms\ntotal da soma de 1201 linhas com 32 threads: 60192\ntempo levado com 32 threads: 35 ms\ntotal da soma de 1201 linhas com 50 threads: 60192\ntempo levado com 50 threads: 44 ms\ntotal da soma de 1201 linhas com 100 threads: 60192\ntempo levado com 100 threads: 66 ms\ntotal da soma de 1201 linhas com 500 threads: 60192\ntempo levado com 500 threads: 297 ms\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h4> \u793a\u4f8b 4 &#8211; \u8c03\u7528 api 500 \u6b21\u7684\u4ee3\u7801 <\/h4>\n<pre>import io.ktor.client.*\nimport io.ktor.client.engine.cio.*\nimport io.ktor.client.request.*\nimport kotlinx.coroutines.delicatecoroutinesapi\nimport kotlinx.coroutines.launch\nimport kotlinx.coroutines.newfixedthreadpoolcontext\nimport kotlinx.coroutines.runblocking\nimport kotlin.system.measuretimemillis\n\n@optin(delicatecoroutinesapi::class)\nfun main() = runblocking {\n    val client = httpclient(cio)\n\n    try {\n        val numberofthreadslist = listof(1, 2, 4, 8, 16, 32, 50, 100, 500)\n        for (numberofthreads in numberofthreadslist) {\n            val customdispatcher = newfixedthreadpoolcontext(numberofthreads, \"custompool\")\n            val timetaken = measuretimemillis {\n                repeat(500) {\n                    val jobs = launch(customdispatcher) { client.get(\"http:\/\/127.0.0.1:5000\/example\") }\n                    jobs.join()\n                }\n            }\n            println(\"tempo levado com $numberofthreads threads: $timetaken ms\")\n            customdispatcher.close()\n        }\n    } catch (e: exception) {\n        println(\"erro ao conectar \u00e0 api: ${e.message}\")\n    } finally {\n        client.close()\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h6> \u793a\u4f8b4 \u63a7\u5236\u53f0\u8f93\u51fa <\/h6>\n<pre>Tempo levado com 1 threads: 7104 ms\nTempo levado com 2 threads: 4793 ms\nTempo levado com 4 threads: 4170 ms\nTempo levado com 8 threads: 4310 ms\nTempo levado com 16 threads: 4028 ms\nTempo levado com 32 threads: 4089 ms\nTempo levado com 50 threads: 4066 ms\nTempo levado com 100 threads: 3978 ms\nTempo levado com 500 threads: 3777 ms\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u793a\u4f8b 1 \u5230\u793a\u4f8b 3 \u6709\u4e00\u4e2a\u5171\u540c\u7684\u884c\u4e3a\uff0c\u5b83\u4eec\u5728\u8fbe\u5230 8 \u4e2a\u7ebf\u7a0b\u65f6\u6027\u80fd\u90fd\u53d8\u5f97\u66f4\u9ad8\uff0c\u7136\u540e\u5904\u7406\u65f6\u95f4\u518d\u6b21\u589e\u52a0\uff0c\u4f46\u793a\u4f8b 4 \u5374\u6ca1\u6709\uff0c\u8fd9\u8bf4\u660e\u4e86\u4ec0\u4e48\uff1f\u603b\u662f\u4f7f\u7528\u5c3d\u53ef\u80fd\u591a\u7684\u7ebf\u7a0b\u4e0d\u662f\u5f88\u6709\u8da3\u5417\uff1f<\/p>\n<p>\u7b80\u5355\u800c\u5feb\u901f\u7684\u7b54\u6848\u662f<strong>\u4e0d<\/strong>\u3002 <\/p>\n<p>\u6211\u7684\u673a\u5668\u7684\u6709 8 \u4e2a\u6838\u5fc3\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b83\u53ef\u4ee5\u540c\u65f6\u6267\u884c 8 \u4e2a\u4efb\u52a1\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u95f4\u4f1a\u968f\u7740\u7ba1\u7406\u6bcf\u4e2a\u7ebf\u7a0b\u72b6\u6001\u7684\u65f6\u95f4\u800c\u589e\u52a0\uff0c\u6700\u7ec8\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002<\/p>\n<p>\u597d\u7684\uff0c\u8fd9\u56de\u7b54\u4e86\u793a\u4f8b 1 \u5230 3\uff0c\u4f46\u662f\u793a\u4f8b 4 \u5462\uff1f\u4e3a\u4ec0\u4e48\u542f\u52a8\u7684\u7ebf\u7a0b\u8d8a\u591a\u6027\u80fd\u5c31\u4f1a\u63d0\u9ad8\uff1f <\/p>\n<p>\u7b80\u5355\uff0c\u56e0\u4e3a\u5b83\u662f\u4e00\u4e2a\u96c6\u6210\uff0c\u673a\u5668\u6ca1\u6709\u5904\u7406\uff0c\u5b83\u57fa\u672c\u4e0a\u7b49\u5f85\u54cd\u5e94\uff0c\u5b83\u4fdd\u6301\u201c\u7761\u7720\u201d\u76f4\u5230\u54cd\u5e94\u5230\u8fbe\uff0c\u6240\u4ee5\u662f\u7684\uff0c\u8fd9\u91cc\u7ebf\u7a0b\u7684\u6570\u91cf\u53ef\u4ee5\u66f4\u5927\u3002\u4f46\u8981\u5c0f\u5fc3\uff0c\u5e76\u4e0d\u610f\u5473\u7740\u53ef\u4ee5\u6709\u5c3d\u53ef\u80fd\u591a\u7684\u7ebf\u7a0b\uff0c\u7ebf\u7a0b\u4f1a\u5bfc\u81f4\u8d44\u6e90\u8017\u5c3d\uff0c\u4e0d\u52a0\u5730\u4f7f\u7528\u5b83\u4eec\u4f1a\u4ea7\u751f\u76f8\u53cd\u7684\u6548\u679c\uff0c\u4f1a\u5f71\u54cd\u670d\u52a1\u7684\u6574\u4f53\u5065\u5eb7\u72b6\u51b5\u3002 <br \/> \u56e0\u6b64\uff0c\u8981\u5b9a\u4e49\u6c60\u5c06\u62e5\u6709\u7684\u7ebf\u7a0b\u6570\uff0c\u6700\u7b80\u5355\u3001\u6700\u5b89\u5168\u7684\u65b9\u6cd5\u662f\u5206\u79bb\u5c06\u8981\u6267\u884c\u7684\u4efb\u52a1\u7684\u6027\u8d28\u3002\u5b83\u4eec\u5206\u4e3a\u4e24\u90e8\u5206\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u4e0d\u9700\u8981\u5904\u7406\u7684\u4efb\u52a1\uff1a<\/strong> <br \/> \u5f53\u4efb\u52a1\u7c7b\u578b\u4e0d\u9700\u8981\u5904\u7406\u65f6\uff0c\u53ef\u4ee5\u521b\u5efa\u6bd4\u673a\u5668\u4e0a\u7684\u5904\u7406\u5668\u6838\u5fc3\u66f4\u591a\u7684\u7ebf\u7a0b\u3002\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\u662f\u56e0\u4e3a\u4e0d\u9700\u8981\u5904\u7406\u4fe1\u606f\u6765\u5b8c\u6210\u7ebf\u7a0b\uff0c\u57fa\u672c\u4e0a\u8fd9\u79cd\u6027\u8d28\u7684\u7ebf\u7a0b\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u90fd\u671f\u671b\u6765\u81ea\u96c6\u6210\u7684\u54cd\u5e94\uff0c\u4f8b\u5982\u5199\u5165\u6570\u636e\u5e93\u6216\u6765\u81ea api \u7684\u54cd\u5e94\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u9700\u8981\u5904\u7406\u7684\u4efb\u52a1\uff1a<\/strong> <br \/> \u5f53\u89e3\u51b3\u65b9\u6848\u6709\u5904\u7406\u65f6\uff0c\u5373\u673a\u5668\u5b9e\u9645\u5728\u505a\u5de5\u4f5c\u65f6\uff0c\u6700\u5927\u7ebf\u7a0b\u6570\u5fc5\u987b\u662f\u673a\u5668\u5904\u7406\u5668\u7684\u6838\u5fc3\u6570\u3002\u8fd9\u662f\u56e0\u4e3a\u5904\u7406\u5668\u6838\u5fc3\u65e0\u6cd5\u540c\u65f6\u6267\u884c\u591a\u4e8e\u4e00\u4ef6\u4e8b\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8fd0\u884c\u8be5\u89e3\u51b3\u65b9\u6848\u7684\u5904\u7406\u5668\u6709 4 \u4e2a\u6838\u5fc3\uff0c\u90a3\u4e48\u5b83\u7684\u7ebf\u7a0b\u6c60\u5fc5\u987b\u662f\u60a8\u7684\u5904\u7406\u5668\u6838\u5fc3\u7684\u5927\u5c0f\uff0c\u5373 4 \u7ebf\u7a0b\u6c60\u3002<\/p>\n<\/li>\n<\/ul>\n<h2> \u7ed3\u8bba <\/h2>\n<p>\u5728\u8003\u8651\u7ebf\u7a0b\u6c60\u65f6\uff0c\u9996\u5148\u8981\u5b9a\u4e49\u7684\u4e00\u70b9\u4e0d\u4e00\u5b9a\u662f\u9650\u5236\u5176\u5927\u5c0f\u7684\u6570\u91cf\uff0c\u800c\u662f\u6240\u6267\u884c\u4efb\u52a1\u7684\u6027\u8d28\u3002\u7ebf\u7a0b\u5bf9\u670d\u52a1\u7684\u6027\u80fd\u6709\u5f88\u5927\u5e2e\u52a9\uff0c\u4f46\u5fc5\u987b\u4ee5\u6700\u4f73\u65b9\u5f0f\u4f7f\u7528\u5b83\u4eec\uff0c\u4ee5\u514d\u4ea7\u751f\u76f8\u53cd\u7684\u6548\u679c\u5e76\u964d\u4f4e\u6027\u80fd\uff0c\u751a\u81f3\u66f4\u7cdf\u7cd5\u7684\u662f\uff0c\u5bfc\u81f4\u6574\u4e2a\u670d\u52a1\u7684\u5065\u5eb7\u72b6\u51b5\u53d7\u5230\u5f71\u54cd\u3002\u5f88\u660e\u663e\uff0c\u8f83\u5c0f\u7684\u6c60\u6700\u7ec8\u66f4\u503e\u5411\u4e8e\u5904\u7406\u5927\u91cf\u4f7f\u7528\u7684\u4efb\u52a1\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u5373 cpu \u53d7\u9650\u7684\u4efb\u52a1\u3002\u5982\u679c\u60a8\u4e0d\u786e\u5b9a\u4f7f\u7528\u7ebf\u7a0b\u7684\u89e3\u51b3\u65b9\u6848\u662f\u5426\u5177\u6709\u5927\u91cf\u4f7f\u7528\u5904\u7406\u7684\u884c\u4e3a\uff0c\u8bf7\u8c28\u614e\u8d77\u89c1\uff0c\u5c06\u60a8\u7684\u6c60\u9650\u5236\u4e3a\u673a\u5668\u4e0a\u7684\u5904\u7406\u5668\u6570\u91cf\uff0c\u76f8\u4fe1\u6211\uff0c\u8fd9\u4f1a\u8282\u7701\u8ba9\u4f60\u5f88\u5934\u75bc\u3002 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7ebf\u7a0b\uff1a\u5982\u4f55\u4ee5\u6027\u80fd\u4e3a\u76ee\u6807\u6765\u5b9a\u4e49\u548c\u9650\u5236\u6267\u884c\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8IDCBABY\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ebf\u7a0b\uff0c\u4e00\u79cd\u6709\u52a9\u4e8e\u5f00\u53d1\u73b0\u4ee3\u9ad8\u6027\u80fd\u89e3\u51b3\u65b9\u6848\u5e76\u6210\u4e3a\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\u3002\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u8bed\u8a00\uff0c\u5e76\u884c\u6267\u884c\u4efb\u52a1\u7684\u80fd\u529b\u90fd\u5177\u6709\u5f88\u5927\u7684\u5438\u5f15\u529b\u3002\u4f46\u663e\u7136\u6709\u672c\u53d4\u53d4\u7684\u540d\u8a00\uff1a\u201c\u80fd\u529b\u8d8a\u5927\uff0c\u8d23\u4efb\u8d8a\u5927\u3002\u201d\u5982\u4f55\u4ee5\u6700\u4f73\u65b9\u5f0f\u4f7f\u7528\u8be5\u89e3\u51b3\u65b9\u6848\uff0c\u4ee5\u5b9e\u73b0\u6027\u80fd\u3001\u66f4\u597d\u5730\u5229\u7528\u8d44\u6e90\u548c\u5e94\u7528\u7a0b\u5e8f\u5065\u5eb7\uff1f\u9996\u5148\uff0c\u6709\u5fc5\u8981\u4e86\u89e3\u672c\u4e3b\u9898\u7684\u57fa\u672c\u6982\u5ff5\u3002 \u4ec0\u4e48\u662f\u201c\u7ebf\u7a0b\u201d\uff1f \u7ebf\u7a0b\u662folor:#f60; text-decoration:underline;&#8217; href=&#8221;https:\/\/www.php.cn\/zt\/16016.html&#8221; target=&#8221;_blank&#8221;&gt;\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8fdb\u7a0b\u6267\u884c\u7684\u57fa\u672c\u5355\u4f4d\u3002\u5b83\u4eec\u5141\u8bb8\u7a0b\u5e8f\u5728\u540c\u4e00\u8fdb\u7a0b\u4e2d\u540c\u65f6\u6267\u884c\u591a\u4e2a\u64cd\u4f5c\u3002\u6bcf\u4e2a\u7ebf\u7a0b\u4e0e\u4e3b\u8fdb\u7a0b\u5171\u4eab\u76f8\u540c\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u4f46\u53ef\u4ee5\u72ec\u7acb\u6267\u884c\uff0c\u8fd9\u5bf9\u4e8e\u53ef\u4ee5\u5e76\u884c\u6267\u884c\u7684\u4efb\u52a1\u975e\u5e38\u6709\u7528\uff0c\u4f8b\u5982\u8f93\u5165\/\u8f93\u51fa\uff08i\/o\uff09\u64cd\u4f5c\u3001\u590d\u6742\u8ba1\u7b97\u6216\u6570\u636e\u7528\u6237\u754c\u9762\u3002 . \u5728\u8bb8\u591a\u7cfb\u7edf\u4e0a\uff0c\u7ebf\u7a0b\u7531\u64cd\u4f5c\u7cfb\u7edf\u7ba1\u7406\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u5206\u914d cpu \u65f6\u95f4\u5e76\u7ba1\u7406\u5b83\u4eec\u4e4b\u95f4\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u3002\u5728java\u3001\u3001c++\u7b49\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u90fd\u6709\u65b9\u4fbf\u521b\u5efa\u548c\u7ba1\u7406\u7ebf\u7a0b\u7684\u5e93\u548c\u6846\u67b6\u3002 \u8981\u4f7f\u7528\u7ebf\u7a0b\uff1f \u7ebf\u7a0b\u4e3b\u8981\u7528\u4e8e\u63d0\u9ad8\u7a0b\u5e8f\u7684\u6548\u7387\u548c\u54cd\u5e94\u80fd\u529b\u3002\u4f7f\u7528\u7ebf\u7a0b\uff0c\u5c24\u5176\u662f\u540e\u7aef\u7684\u539f\u56e0\u662f\uff1a \u5e76\u884c\uff1a\u7ebf\u7a0b\u5141\u8bb8\u60a8\u540c\u65f6\u6267\u884c\u591a\u4e2a\u64cd\u4f5c\uff0c\u4ece\u800c\u66f4\u597d\u5730\u5229\u7528\u53ef\u7528\u7684 cpu \u8d44\u6e90\uff0c\u7279\u522b\u662f\u5728\u5177\u6709\u591a\u4e2a\u5185\u6838\u7684\u7cfb\u7edf\u4e0a\u3002 \u6027\u80fd\uff1a\u5728 i\/o \u64cd\u4f5c\u4e2d\uff0c\u4f8b\u5982\u8bfb\u5199\u6587\u4ef6\u6216\u7f51\u7edc\u901a\u4fe1\uff0c\u7ebf\u7a0b\u53ef\u4ee5\u901a\u8fc7\u5141\u8bb8\u7a0b\u5e8f\u5728\u7b49\u5f85\u8fd9\u4e9b\u4efb\u52a1\u5b8c\u6210\u7684\u540c\u65f6\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u4efb\u52a1\u6765\u5e2e\u52a9\u63d0\u9ad8\u6027\u80fd\u64cd\u4f5c\u3002 \u6a21\u5757\u5316\uff1a\u7ebf\u7a0b\u53ef\u7528\u4e8e\u5c06\u7a0b\u5e8f\u5212\u5206\u4e3a\u66f4\u5c0f\u3001\u66f4\u6613\u4e8e\u7ba1\u7406\u7684\u90e8\u5206\uff0c\u6bcf\u4e2a\u90e8\u5206\u6267\u884c\u7279\u5b9a\u7684\u4efb\u52a1\u3002 \u4f46\u662f\uff0c\u4ed4\u7ec6\u7ba1\u7406\u7ebf\u7a0b\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u4e0d\u6b63\u786e\u7684\u4f7f\u7528\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7ade\u4e89\u6761\u4ef6\u3001\u6b7b\u9501\u548c\u8c03\u8bd5\u56f0\u96be\u7b49\u95ee\u9898\u3002\u4e3a\u4e86\u66f4\u597d\u5730\u7ba1\u7406\u5b83\u4eec\uff0c\u4f7f\u7528\u4e86\u7ebf\u7a0b\u6c60\u89e3\u51b3\u65b9\u6848\u3002 \u4ec0\u4e48\u662f\u7ebf\u7a0b\u6c60\u4ee5\u53ca\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\uff1f \u7ebf\u7a0b\u6c60\u662f\u4e00\u79cd\u8f6f\u4ef6\u8bbe\u8ba1\u6a21\u5f0f\uff0c\u6d89\u53ca\u521b\u5efa\u548c\u7ba1\u7406\u53ef\u91cd\u590d\u4f7f\u7528\u6765\u6267\u884c\u4efb\u52a1\u7684\u7ebf\u7a0b\u6c60\u3002\u7ebf\u7a0b\u6c60\u4e0d\u4f1a\u4e3a\u6bcf\u4e2a\u4efb\u52a1\u91cd\u590d\u521b\u5efa\u548c\u9500\u6bc1\u7ebf\u7a0b\uff0c\u800c\u662f\u7ef4\u62a4\u56fa\u5b9a\u6570\u91cf\u7684\u7ebf\u7a0b\uff0c\u51c6\u5907\u6839\u636e\u9700\u8981\u6267\u884c\u4efb\u52a1\u3002\u8fd9\u53ef\u4ee5\u663e\u7740\u63d0\u9ad8\u9700\u8981\u5904\u7406\u8bb8\u591a\u5e76\u53d1\u4efb\u52a1\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u3002\u4f7f\u7528\u7ebf\u7a0b\u6c60\u7684\u4f18\u70b9\u662f\uff1a \u63d0\u9ad8\u6027\u80fd\uff1a\u521b\u5efa\u548c\u9500\u6bc1\u7ebf\u7a0b\u5728\u8d44\u6e90\u65b9\u9762\u662f\u4e00\u9879\u6602\u8d35\u7684\u64cd\u4f5c\u3002\u7ebf\u7a0b\u6c60\u901a\u8fc7\u91cd\u7528\u73b0\u6709\u7ebf\u7a0b\u6765\u6700\u5c0f\u5316\u6b64\u6210\u672c\u3002 \u8d44\u6e90\u7ba1\u7406\uff1a\u63a7\u5236\u8fd0\u884c\u7684\u7ebf\u7a0b\u6570\u91cf\uff0c\u907f\u514d\u8fc7\u591a\u7684\u7ebf\u7a0b\u521b\u5efa\u5bfc\u81f4\u7cfb\u7edf\u8fc7\u8f7d\u3002 \u6613\u4e8e\u4f7f\u7528\uff1a\u7b80\u5316\u7ebf\u7a0b\u7ba1\u7406\uff0c\u4f7f\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u4e13\u6ce8\u4e8e\u5e94\u7528\u7a0b\u5e8f\u903b\u8f91\u800c\u4e0d\u662f\u7ebf\u7a0b\u7ba1\u7406\u3002 \u53ef\u6269\u5c55\u6027\uff1a\u5e2e\u52a9\u6269\u5c55\u5e94\u7528\u7a0b\u5e8f\u4ee5\u6709\u6548\u5730\u5904\u7406\u5927\u91cf\u5e76\u53d1\u4efb\u52a1\u3002 \u5982\u4f55\u8bbe\u7f6e\u6c60\u4e2d\u7684\u7ebf\u7a0b\u9650\u5236 \u597d\u5427\uff0c\u6211\u5f53\u7136\u5fc5\u987b\u521b\u5efa\u4e00\u4e2a\u7ebf\u7a0b\u6c60\u624d\u80fd\u66f4\u597d\u5730\u5229\u7528\u6b64\u529f\u80fd\uff0c\u4f46\u5f88\u5feb\u51fa\u73b0\u7684\u4e00\u4e2a\u95ee\u9898\u662f\uff1a\u201c\u6c60\u5e94\u8be5\u5305\u542b\u591a\u5c11\u4e2a\u7ebf\u7a0b\uff1f\u201d\u3002\u6309\u7167\u57fa\u672c\u903b\u8f91\uff0c\u8d8a\u591a\u8d8a\u597d\uff0c\u5bf9\u5417\uff1f\u5982\u679c\u6240\u6709\u4e8b\u60c5\u90fd\u53ef\u4ee5\u5e76\u884c\u5b8c\u6210\uff0c\u90a3\u4e48\u5f88\u5feb\u5c31\u4f1a\u5b8c\u6210\uff0c\u56e0\u4e3a\u901f\u5ea6\u4f1a\u66f4\u5feb\u3002\u56e0\u6b64\uff0c\u6700\u597d\u4e0d\u8981\u9650\u5236\u7ebf\u7a0b\u6570\u91cf\uff0c\u6216\u8005\u8bbe\u7f6e\u4e00\u4e2a\u8f83\u9ad8\u7684\u6570\u5b57\uff0c\u8fd9\u6837\u5c31\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u6b63\u786e\u5417\uff1f \u8fd9\u662f\u4e00\u4e2a\u516c\u5e73\u7684\u8bf4\u6cd5\uff0c\u6240\u4ee5\u8ba9\u6211\u4eec\u6d4b\u8bd5\u4e00\u4e0b\u3002\u6b64\u6d4b\u8bd5\u7684\u4ee3\u7801\u662f\u7528 kotlin \u7f16\u5199\u7684\uff0c\u53ea\u662f\u4e3a\u4e86\u719f\u6089\u5e76\u6613\u4e8e\u7f16\u5199\u793a\u4f8b\u3002\u8fd9\u4e00\u70b9\u4e0e\u8bed\u8a00\u65e0\u5173\u3002 \u901a\u8fc7 4 \u4e2a\u793a\u4f8b\u6765\u63a2\u7d22\u4e0d\u540c\u7684\u7cfb\u7edf\u6027\u8d28\u3002\u793a\u4f8b 1 \u548c\u793a\u4f8b 2 \u662f\u4e3a\u4e86\u4f7f\u7528 cpu \u8fdb\u884c\u5927\u91cf\u6570\u5b66\u8fd0\u7b97\uff0c\u5373\u8fdb\u884c\u5927\u91cf\u5904\u7406\u3002\u793a\u4f8b3\u91cd\u70b9\u5173\u6ce8i\/o\uff0c\u793a\u4f8b\u662f\u8bfb\u53d6\u6587\u4ef6\uff0c\u6700\u540e\uff0c\u793a\u4f8b4\u662f\u5e76\u884c\u7684\u60c5\u51b5\uff0c\u540c\u6837\u5173\u6ce8i\/o\u3002\u5b83\u4eec\u90fd\u4f7f\u7528\u4e0d\u540c\u5927\u5c0f\u7684\u6c60\uff0c\u5206\u522b\u5177\u6709 1\u30012\u30014\u30018\u300116\u300132\u300150\u3001100 \u548c 500 \u4e2a\u7ebf\u7a0b\u3002\u6240\u6709\u8fc7\u7a0b\u53d1\u751f\u8d85\u8fc7 500 \u6b21\u3002 \u793a\u4f8b 1 &#8211; \u8ba1\u7b97 1 \u5230 100000 \u4e4b\u95f4\u6709\u591a\u5c11\u4e2a\u7684\u4ee3\u7801 import [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-65939","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/65939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=65939"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/65939\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=65939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=65939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=65939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}