{"id":1023,"date":"2021-08-14T23:01:58","date_gmt":"2021-08-14T15:01:58","guid":{"rendered":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023"},"modified":"2021-08-26T13:51:23","modified_gmt":"2021-08-26T05:51:23","slug":"%e6%b2%92thread-pool%ef%bc%8climiter%e4%b9%9f%e5%a5%bd%ef%bc%9f%e7%9c%9f%e7%9a%84%e5%97%8e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023","title":{"rendered":"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u773e\u6240\u7686\u77e5Go\u662f\u6c92\u6709\u539f\u751f\u7684<code>Thread Pool<\/code>\u9019\u7a2e\u6771\u897f\uff0c\u9019\u5728\u5bebCrawler\u7684\u6642\u5019\u6703\u9020\u6210\u4e00\u4e9b\u5c0f\u5c0f\u7684\u4e0d\u4fbf\u3002\u6bd4\u65b9\u8aaa\u4f60\u60f3\u8981crawl PTT\uff0c\u9019\u6a23\u6253\u4e00\u6253\u5927\u69822\u79d2\u5167DDoS protection\u5c31\u628a\u4f60\u64cb\u8d77\u4f86\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go line-numbers\">docUrlList, _ := GetDocUrlList() \/\/\u62ff\u5230\u67d0\u500b\u7248\u7684\u6587\u7ae0\u5217\u8868\nfor _, docUrl := range docUrlList {\n\tgo func() {\n\t\tdocUrl := docUrl\n\t\tp, _ := ParseSingleRawDocument(docUrl)\n\t\tparseChannel &lt;- p\n\t}()\n}<\/code><\/pre>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">\u6bd4\u8f03\u591a\u4eba\u6703\u958b\u59cb\u5c0b\u6c42\u9650\u5236go concurrency\u6578\u91cf\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u5c31\u6211\u6240\u77e5<a href=\"https:\/\/github.com\/korovkin\/limiter\" target=\"_blank\" rel=\"noreferrer noopener\">Concurrency Limiter<\/a>\u662f\u4e00\u500b\u6eff\u591a\u4eba\u7528\u7684\u65b9\u6848\uff0c\u7c21\u55ae\u512a\u96c5\u597d\u7528\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go line-numbers\">limit := limiter.NewConcurrencyLimiter(5)\nfor _, docUrl := range docUrlList {\n\tlimit.Execute(func() {\n\t\tdocUrl := docUrl\n\t\tp, _ := ParseSingleRawDocument(docUrl)\n\t\tparseChannel &lt;- p\n\t})\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u9019\u505a\u6cd5\u5176\u5be6\u6eff\u7c21\u55ae\u66b4\u529b\u7684\uff0c\u770b\u4ed6\u7684\u7a0b\u5f0f\u78bc\u5c31\u53ef\u4ee5\u767c\u73fe\uff0c\u4ed6\u5176\u5be6\u5c31\u662f\u5229\u7528\u4e00\u500b\u5927\u5c0f\u7b49\u540c\u65bc\u9650\u5236\u6578\u91cf\u7684buffered channel\uff0c<strong><em>\u5229\u7528Buffered Channel\u5df2\u7d93\u6eff\u7684\u60c5\u6cc1\u4e0b\u518d\u5f80\u5167\u585e\u5c31\u6703\u5835\u585e\u7684\u7279\u6027\uff0c\u9054\u6210limit\u7684\u505a\u6cd5<\/em><\/strong>\u3002\u9019\u505a\u6cd5\u5176\u5be6\u4e00\u9ede\u554f\u984c\u90fd\u6c92\u6709\uff0climiter\u672c\u4f86\u5b9a\u7fa9\u4e0a\u5c31\u662f\u9019\u6a23\u5de5\u4f5c\u7684\uff0c\u4f46\u662flimiter\u5176\u5be6\u6709\u500b\u5f88\u5927\u7684\u7f3a\u9ede\uff0c\u5c31\u662f\u9020\u6210\u6574\u500b\u6d41\u7a0b\u585e\u5728\u4e0a\u9762\u7684\u7b2c\u4e09\u884c\uff0c\u540c\u6642\u4e5f\u6703\u4f7f\u5f97Print Log\u6216\u8005UI\u7b49\u7b49\u90fd\u5f88\u96e3\u5de5\u4f5c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\uff0c\u7562\u7adfLimiter\u4e0d\u662fthread pool\uff0c\u4ed6\u6703\u5361\u5728<code>limit.Execute<\/code> \uff0c\u800c\u4e14\u4ed6\u7684wait\u4e5f\u6709\u4e00\u4e9b\u554f\u984c\uff0c\u4ee5\u4e0b\u662flimiter \u7684\u539f\u59cb\u78bc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">\/\/ Wait will block all the previously Executed jobs completed running.\n\/\/\n\/\/ IMPORTANT: calling the Wait function while keep calling Execute leads to\n\/\/            un-desired race conditions\nfunc (c *ConcurrencyLimiter) Wait() {\n\tfor i := 0; i &lt; c.limit; i++ {\n\t\t_ = &lt;-c.tickets\n\t}\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u5be6\u9019\u500bWait\u554f\u984c\u4e5f\u5f88\u5927\uff0c\u9996\u5148\u662f\u4ed6\u81ea\u5df1\u8a3b\u89e3\u5c31\u6709\u63d0\u5230\u7684data race\u7684\u98a8\u96aa\uff0c\u518d\u4f86\u5c31\u662f\u524d\u9762\u5c31\u6709\u63d0\u904e\uff0c <code>limit.Execute()<\/code> \u672c\u8eab\u5c31\u6703blocking\uff0c\u9019\u4e5f\u5c31\u662f\u8aaa\u9019\u500b <code>Wait<\/code> \u5047\u8a2d\u653e\u5230\u4e0a\u9762\u7bc4\u4f8bcode\u7b2c8\u884c\u4ee5\u5f8c\uff0c\u4ed6\u9032\u5165\u7684\u6642\u9593\u9ede\u5176\u5be6\u662f \u7576limit.Execute()\u5df2\u7d93\u4e0d\u6703\u963b\u64cb\u6642\uff08\u5269\u9918\u5de5\u4f5c\u91cf &lt; limit\uff09\uff0c\u624d\u6703\u57f7\u884c\u5230Wait\u3002\u6240\u4ee5Wait()\u5230\u7b2c8\u884c\u4e2d\u9593\u8981\u662f\u9084\u9700\u8981\u505a\u4ec0\u9ebc\u4e8b\u60c5\uff0c\u4ed6\u88ab\u57f7\u884c\u7684\u6642\u6a5f\u53ef\u80fd\u6703\u51fa\u4e4e\u4f60\u610f\u6599\u4e4b\u5916\u3002\u4e0b\u9762\u6211\u5c31\u8209\u500b\u4f8b\u5b50\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go line-numbers\">limit := limiter.NewConcurrencyLimiter(5)\nfor _, docUrl := range docUrlList {\n\tlimit.Execute(func() {\n\t\tdocUrl := docUrl\n\t\tp, _ := ParseSingleRawDocument(docUrl)\n\t\tparseChannel &lt;- p\n\t})\n}\nDoSomething() \/\/\u5047\u8a2dlen(docUrlList) == 200\uff0cDoSomething\u8981\u7b49\u5230Parse 195\u689d\u4ee5\u5f8c\u624d\u6703\u88abcall\u8d77\u4f86\u3002\nlimit.Wait()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5047\u8a2ddocUrl\u6709200\u7b46\uff0c\u90a3\u8acb\u554fDoSomething()\u5565\u6642\u6703\u88ab\u57f7\u884c\u5462\uff1f\u7b54\u6848\u662fDoc\u88abParse195\u7b46\u4ee5\u5f8c\uff0c\u6211\u5011\u624d\u6703\u57f7\u884c\u5230\u9019\u500b\u3002\u9019\u7a2e\u554f\u984c\u591a\u534a\u662f\u5c0d\u65bclimiter\u7528\u9014\u6c92\u6709\u5168\u9762\u4e86\u89e3\u5c31\u628a\u4ed6\u7576thread pool\u7528\u7684\u5e38\u898b\u7684\u554f\u984c\uff0c\u5c24\u5176\u662f\u5047\u8a2d\u672c\u4f86\u7528\u4e0b\u9762\u7684code\uff0c\u5f88\u7121\u8166\u7684\u628a\u4ed6\u6539\u6210Limiter\u7684\u8a71\uff0c\u66f4\u662f\u5982\u6b64:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">for _, docUrl := range docUrlList {\n\tgo func() {\n\t\tdocUrl := docUrl\n\t\tp, _ := ParseSingleRawDocument(docUrl)\n\t\tparseChannel &lt;- p\n\t}() \n}\nDoSomething() \/\/\u5728\u9019\u88cf\uff0cDoSomething\u6703\u88ab\u99ac\u4e0acall\u8d77\u4f86\u3002<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u5176\u5be6\uff0c\u5728\u5f88\u591a\u7684\u60c5\u6cc1\u4e0b\uff0cLimiter\u4e26\u4e0d\u662f\u4e00\u500b\u5f88\u597d\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u6211\u5011\u6703\u5728\u4e0b\u4e00\u7ae0\u804a\u804a\u600e\u9ebc\u7528\u56fa\u5b9a\u6578\u91cf\u7684Worker\u4f86\u512a\u96c5\u7684\u89e3\u6c7a\u9019\u554f\u984c \uff1a<a href=\"https:\/\/www.rayer.idv.tw\/blog\/?p=1038\">\u6c92\u539f\u751fThread Pool\uff0c\u90a3\u6211\u5011\u81ea\u88fdWorker Group<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u773e\u6240\u7686\u77e5Go\u662f\u6c92\u6709\u539f\u751f\u7684Thread Pool\u9019\u7a2e\u6771\u897f\uff0c\u9019\u5728\u5bebCrawler\u7684\u6642\u5019\u6703\u9020\u6210\u4e00\u4e9b\u5c0f\u5c0f\u7684\u4e0d\u4fbf\u3002\u6bd4\u65b9\u8aaa\u4f60\u60f3\u8981crawl PTT\uff0c\u9019\u6a23\u6253\u4e00\u6253\u5927\u69822\u79d2\u5167DDoS protection\u5c31\u628a\u4f60\u64cb\u8d77\u4f86\u4e86\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"link","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[38,84],"tags":[156,157,86,158,159],"class_list":["post-1023","post","type-post","status-publish","format-link","hentry","category-code","category-84","tag-concurrency","tag-coroutine","tag-golang","tag-limiter","tag-thread-pool","post_format-post-format-link"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f - Fox Nest<\/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.rayer.idv.tw\/blog\/?p=1023\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f - Fox Nest\" \/>\n<meta property=\"og:description\" content=\"\u773e\u6240\u7686\u77e5Go\u662f\u6c92\u6709\u539f\u751f\u7684Thread Pool\u9019\u7a2e\u6771\u897f\uff0c\u9019\u5728\u5bebCrawler\u7684\u6642\u5019\u6703\u9020\u6210\u4e00\u4e9b\u5c0f\u5c0f\u7684\u4e0d\u4fbf\u3002\u6bd4\u65b9\u8aaa\u4f60\u60f3\u8981crawl PTT\uff0c\u9019\u6a23\u6253\u4e00\u6253\u5927\u69822\u79d2\u5167DDoS protection\u5c31\u628a\u4f60\u64cb\u8d77\u4f86\u4e86\uff1a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rayer.idv.tw\/blog\/?p=1023\" \/>\n<meta property=\"og:site_name\" content=\"Fox Nest\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-14T15:01:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-26T05:51:23+00:00\" \/>\n<meta name=\"author\" content=\"Rayer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Rayer\" \/>\n<meta name=\"twitter:site\" content=\"@Rayer\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rayer\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023\"},\"author\":{\"name\":\"Rayer\",\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/#\\\/schema\\\/person\\\/498379badb270198fef0edd6b06a5bd7\"},\"headline\":\"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f\",\"datePublished\":\"2021-08-14T15:01:58+00:00\",\"dateModified\":\"2021-08-26T05:51:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023\"},\"wordCount\":54,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/#\\\/schema\\\/person\\\/498379badb270198fef0edd6b06a5bd7\"},\"keywords\":[\"concurrency\",\"coroutine\",\"golang\",\"limiter\",\"thread pool\"],\"articleSection\":[\"\u5beb\u5bebCode\",\"\u6280\u8853\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023\",\"url\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023\",\"name\":\"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f - Fox Nest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/#website\"},\"datePublished\":\"2021-08-14T15:01:58+00:00\",\"dateModified\":\"2021-08-26T05:51:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?p=1023#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/\",\"name\":\"Fox Nest\",\"description\":\"\u6709\u6642\u5019\u7e3d\u60f3\u6709\u500b\u5730\u65b9\u653e\u653e\u96a8\u624b\u4e82\u5beb\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/#\\\/schema\\\/person\\\/498379badb270198fef0edd6b06a5bd7\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.rayer.idv.tw\\\/blog\\\/#\\\/schema\\\/person\\\/498379badb270198fef0edd6b06a5bd7\",\"name\":\"Rayer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/www.rayer.idv.tw\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.rayer.idv.tw\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.rayer.idv.tw\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1\",\"width\":800,\"height\":600,\"caption\":\"Rayer\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/www.rayer.idv.tw\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1\"},\"sameAs\":[\"https:\\\/\\\/www.rayer.idv.tw\",\"https:\\\/\\\/x.com\\\/Rayer\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f - Fox Nest","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.rayer.idv.tw\/blog\/?p=1023","og_locale":"zh_TW","og_type":"article","og_title":"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f - Fox Nest","og_description":"\u773e\u6240\u7686\u77e5Go\u662f\u6c92\u6709\u539f\u751f\u7684Thread Pool\u9019\u7a2e\u6771\u897f\uff0c\u9019\u5728\u5bebCrawler\u7684\u6642\u5019\u6703\u9020\u6210\u4e00\u4e9b\u5c0f\u5c0f\u7684\u4e0d\u4fbf\u3002\u6bd4\u65b9\u8aaa\u4f60\u60f3\u8981crawl PTT\uff0c\u9019\u6a23\u6253\u4e00\u6253\u5927\u69822\u79d2\u5167DDoS protection\u5c31\u628a\u4f60\u64cb\u8d77\u4f86\u4e86\uff1a","og_url":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023","og_site_name":"Fox Nest","article_published_time":"2021-08-14T15:01:58+00:00","article_modified_time":"2021-08-26T05:51:23+00:00","author":"Rayer","twitter_card":"summary_large_image","twitter_creator":"@Rayer","twitter_site":"@Rayer","twitter_misc":{"\u4f5c\u8005:":"Rayer","\u9810\u4f30\u95b1\u8b80\u6642\u9593":"1 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023#article","isPartOf":{"@id":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023"},"author":{"name":"Rayer","@id":"https:\/\/www.rayer.idv.tw\/blog\/#\/schema\/person\/498379badb270198fef0edd6b06a5bd7"},"headline":"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f","datePublished":"2021-08-14T15:01:58+00:00","dateModified":"2021-08-26T05:51:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023"},"wordCount":54,"commentCount":2,"publisher":{"@id":"https:\/\/www.rayer.idv.tw\/blog\/#\/schema\/person\/498379badb270198fef0edd6b06a5bd7"},"keywords":["concurrency","coroutine","golang","limiter","thread pool"],"articleSection":["\u5beb\u5bebCode","\u6280\u8853"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rayer.idv.tw\/blog\/?p=1023#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023","url":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023","name":"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f - Fox Nest","isPartOf":{"@id":"https:\/\/www.rayer.idv.tw\/blog\/#website"},"datePublished":"2021-08-14T15:01:58+00:00","dateModified":"2021-08-26T05:51:23+00:00","breadcrumb":{"@id":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rayer.idv.tw\/blog\/?p=1023"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.rayer.idv.tw\/blog\/?p=1023#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/www.rayer.idv.tw\/blog"},{"@type":"ListItem","position":2,"name":"\u6c92Thread Pool\uff0cLimiter\u4e5f\u597d\uff1f\u771f\u7684\u55ce\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.rayer.idv.tw\/blog\/#website","url":"https:\/\/www.rayer.idv.tw\/blog\/","name":"Fox Nest","description":"\u6709\u6642\u5019\u7e3d\u60f3\u6709\u500b\u5730\u65b9\u653e\u653e\u96a8\u624b\u4e82\u5beb","publisher":{"@id":"https:\/\/www.rayer.idv.tw\/blog\/#\/schema\/person\/498379badb270198fef0edd6b06a5bd7"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rayer.idv.tw\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":["Person","Organization"],"@id":"https:\/\/www.rayer.idv.tw\/blog\/#\/schema\/person\/498379badb270198fef0edd6b06a5bd7","name":"Rayer","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/i0.wp.com\/www.rayer.idv.tw\/blog\/wp-content\/uploads\/2022\/02\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1","url":"https:\/\/i0.wp.com\/www.rayer.idv.tw\/blog\/wp-content\/uploads\/2022\/02\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.rayer.idv.tw\/blog\/wp-content\/uploads\/2022\/02\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1","width":800,"height":600,"caption":"Rayer"},"logo":{"@id":"https:\/\/i0.wp.com\/www.rayer.idv.tw\/blog\/wp-content\/uploads\/2022\/02\/564120_490926324264770_332274456_n.jpg?fit=800%2C600&ssl=1"},"sameAs":["https:\/\/www.rayer.idv.tw","https:\/\/x.com\/Rayer"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pacpZ9-gv","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1023"}],"version-history":[{"count":13,"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":1055,"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1023\/revisions\/1055"}],"wp:attachment":[{"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rayer.idv.tw\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}