{"id":10436,"date":"2021-06-14T01:15:59","date_gmt":"2021-06-13T17:15:59","guid":{"rendered":"https:\/\/ihower.tw\/blog\/?p=10436"},"modified":"2025-07-04T08:07:45","modified_gmt":"2025-07-04T00:07:45","slug":"release-it","status":"publish","type":"post","link":"https:\/\/ihower.tw\/blog\/10436-release-it","title":{"rendered":"Release It! \u8b80\u66f8\u6458\u8981"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"424\" height=\"520\" data-attachment-id=\"10722\" data-permalink=\"https:\/\/ihower.tw\/blog\/10436-release-it\/2021-06-14-at-1-16-am\" data-orig-file=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM.png\" data-orig-size=\"424,520\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"2021-06-14-at-1.16-AM\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM-245x300.png\" data-large-file=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM.png\" src=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM.png\" alt=\"\" class=\"wp-image-10722\" srcset=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM.png 424w, https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2021\/06\/2021-06-14-at-1.16-AM-245x300.png 245w\" sizes=\"auto, (max-width: 424px) 100vw, 424px\" \/><\/a><\/figure>\n\n\n<p><a href=\"https:\/\/www.tenlong.com.tw\/products\/9781680502398\">Release It!<\/a> \u7b2c\u4e00\u7248\u51fa\u7248\u65bc 2007\uff0c\u7372\u5f97\u4e86 2008 \u5e74\u7684 Jolt Awards \u734e\u3002\u7b2c<span style=\"font-size: inherit;\">\u4e8c\u7248\u662f 2019 \u5e74\u51fa\u7684\uff0c\u8ddf\u7b2c\u4e00\u7248\u5dee\u4e8611\u5e74\uff0c\u4e8c\u7248\u524d\u534a\u6bb5\u8b1b Stability \u7684\u5167\u5bb9\u4e00\u6a23\uff0c\u9019\u4e5f\u662f\u6211\u8a8d\u70ba\u9019\u672c\u66f8\u6700\u7cbe\u5f69\u7684\u90e8\u5206\u3002\u800c\u4e8c\u7248\u6574\u500b\u5f8c\u534a\u7ae0\u7bc0\u5e7e\u4e4e\u7528\u5168\u65b0\u7684 DevOps \u5167\u5bb9\u6539\u5beb\u4e86\uff0c\u5341\u5e74\u9593\u7684\u8b8a\u5316\u9084\u662f\u5f88\u5927\u7684 :&gt;<\/span><\/p>\n<p>\u9019\u88e1\u6458\u8981\u7b2c\u4e00\u7248 + \u7b2c\u4e8c\u7248\u4e0a\u534a\u7684\u4e00\u4e9b\u5fc3\u5f97\u91cd\u9ede\uff0c\u7b2c\u4e8c\u7248\u4e0b\u534a\u6bb5\u8b1b DevOps \u9019\u5e7e\u5e74\u8b1b\u5f88\u591a\u4e86\uff0c\u5f88\u591a\u77e5\u8b58\u9ede\u9019\u5e7e\u5e74\u5f88\u71b1\u9580\u90fd\u77e5\u9053\u4e86\uff0c\u5c31\u6c92\u6709\u7d30\u770b\u4e86\u3002<\/p>\n<h2>\u4f55\u8b02 Stability<\/h2>\n<p>Resilient system \u5728\u7576\u6709\u7a81\u767c\u6d41\u91cf\u6216\u6301\u7e8c\u58d3\u529b\u6642\uff0c\u7528\u6236\u4ecd\u80fd\u5b8c\u6210\u4efb\u52d9\u4e0d\u6703\u5168\u9762\u5d29\u6f70\u3002<\/p>\n<p><!--more--><\/p>\n<h2>Stability Anti-patterns<\/h2>\n<p><strong>1. Integration Points \u662f\u982d\u865f\u6bba\u624b<\/strong><\/p>\n<p>Socket \u767c\u73fe\u9023\u4e0d\u4e0a\uff0c\u53ef\u80fd\u6703\u82b1\u5f88\u9577\u6642\u9593\u5361\u4f4f<br \/>\u6848\u4f8b\u662f\u56e0\u70ba\u6d41\u91cf\u5c0f\u9592\u7f6e\u88ab\u9632\u706b\u7246 drop packets\uff0c\u52a0\u4e0a\u6c92\u6709 timeout\uff0c\u9020\u6210 connection pool \u6eff\u4e86\u5361\u4f4f<\/p>\n<p>Integration Points \u53ef\u80fd\u5354\u8b70\u4e0d\u6b63\u5e38\u3001\u6162\u97ff\u61c9\u6216\u4e2d\u6b62\u904b\u4f5c\uff0c\u5982\u679c\u4f60\u6c92\u6709\u505a\u9632\u79a6\uff0c\u9023\u7d50\u9ede\u7684\u6545\u969c\u53ef\u80fd\u9023\u5e36\u8b93\u6574\u500b\u7cfb\u7d71\u4e00\u8d77\u9023\u9396\u6545\u969c<\/p>\n<p>\u89e3\u6cd5: Circuit breaker, Timeouts, Decoupling middleware<\/p>\n<p><strong>2. Chain Reactions \u5c0f\u5fc3\u9023\u9396\u53cd\u61c9\u73fe\u8c61<\/strong><\/p>\n<p>\u4e00\u53f0\u6b7b\uff0c\u5176\u4ed6\u53f0\u8ddf\u8457\u8ca0\u64d4\u4e0d\u4e86\u9020\u6210\u9023\u9396\u6545\u969c\u3002\u5176\u4ed6\u53f0\u5fc5\u9808\u6709\u4fdd\u8b77\u6a5f\u5236\u3002<\/p>\n<p>\u89e3\u6cd5: \u53ef\u7528 Bulkheads patterns<\/p>\n<p><strong>3. Cascading Failures<\/strong><\/p>\n<p>\u7576 Caller \u56e0\u70ba resource pool \u6545\u969c\u800c\u8ddf\u8457\u6545\u969c\u7684\u73fe\u8c61<br \/>\u7528 Circuit breaker, Timeouts \u907f\u514d\u5176\u4ed6\u7cfb\u7d71GG\u6642\uff0c\u4f60\u4e0d\u6703\u8ddf\u8457\u4e00\u8d77GG<\/p>\n<p><strong>4. Users<\/strong><\/p>\n<p>\u6d41\u91cf\u5c31\u4ee3\u8868\u6703\u4f7f\u7528 memory\uff0c\u722c\u87f2\u6703\u9020\u6210 session \u4f54\u7528<br \/>\u9019\u500b\u4e3b\u8981\u98a8\u96aa\u662f DDoS\u3002\u8981\u505a\u58d3\u529b\u6e2c\u8a66\u56c9<\/p>\n<p><strong>5. Blocked Threads<\/strong><\/p>\n<p>\u8b1b\u57f7\u884c\u7dd2\u958b\u767c\u7684 synchronized thread \u6703\u9020\u6210 blocked<br \/>\u4e0d\u8981\u81ea\u5df1\u5beb connection pool \u9019\u5f88\u96e3<br \/>\u5c0f\u5fc3 vendor client \u4e0d\u4e00\u5b9a\u5beb\u5f97\u597d<\/p>\n<p><strong>6. Attacks of Self-Denial<\/strong><\/p>\n<p>\u6307\u81ea\u50b7\u4e8b\u6545: \u4f8b\u5982\u516c\u53f8\u7684\u71df\u92b7\u4e8b\u4ef6<br \/>\u4f60\u61c9\u8a72\u63d0\u524d\u77e5\u9053\u71df\u92b7\u4e8b\u4ef6\uff0c\u6e96\u5099\u975c\u614b\u7684 landing page \u751a\u81f3\u662f\u5c08\u9580\u7684server\uff0c\u800c\u4e0d\u662f\u9032\u5230\u6df1\u5c64\u7684\u9801\u9762\u8017\u8cbb\u8cc7\u6e90<br \/>\u907f\u514d\u4e00\u500b\u5171\u4eab\u8cc7\u6e90GG\u9020\u6210\u5168\u90e8GG\uff0c\u7528 Shared-nothing architecture \u6216 fail fast \u7b56\u7565<\/p>\n<p><strong>7. Scaling Effects<\/strong><\/p>\n<p>\u5c0f\u5fc3 Peer-to-Peer \u5728\u591a\u670d\u52d9\u5668\u7684\u60c5\u6cc1\uff0c\u53ef\u7528 Pub\/Sub \u6216 Message Queues\u3002\u5c0f\u5fc3 Shared Resources \u7684\u74f6\u9838\uff0c\u9700\u8981\u58d3\u529b\u6e2c\u8a66\u3002\u9019\u4e9b\u5728\u6e2c\u8a66\u74b0\u5883\u5f88\u5c11\u6aa2\u67e5\u5230\u3002<\/p>\n<p><strong>8. Unbalanced Capacities<\/strong><\/p>\n<p>\u5728\u77ed\u671f\u9593\u5167\uff0c\u786c\u4ef6\u5bb9\u91cf\u662f\u56fa\u5b9a\u7684\u3002\u524d\u5f8c\u7aef\u7684\u80fd\u529b\u8981\u80fd\u96a8\u6642\u5339\u914d\u662f\u4e0d\u53ef\u80fd\u7684\u3002\u9019\u5728\u6e2c\u8a66\u74b0\u5883\u5f88\u5c11\u6aa2\u67e5\u5230\uff0c\u4f8b\u5982\u524d\u7aef10\u53f0\u3001\u5f8c\u7aef1\u53f0\u7684\u60c5\u6cc1<\/p>\n<p><strong><span style=\"font-size: inherit;\">9. Slow Responses<\/span><\/strong><\/p>\n<p>\u6162\u56de\u61c9\u6bd4\u62d2\u7d55\u9023\u7d50\u66f4\u7cdf\u7cd5\uff0cFail Fast \u9084\u6bd4\u8f03\u597d\uff0c\u4e0d\u6703\u4f54\u7528\u8cc7\u6e90\u3002<br \/>\u539f\u56e0\u53ef\u80fd\u662f memory lead \u6216\u7db2\u8def\u554f\u984c\u3002\u6162\u56de\u61c9\u4e5f\u6703\u7522\u751f\u7db2\u7ad9\u66f4\u591a\u6d41\u91cf\uff0c\u7528\u6236\u6703\u4e0d\u65b7\u5237\u65b0\u3002<\/p>\n<p><strong>10. SLA Inversion<\/strong><\/p>\n<p>\u4f60\u7684SLA\u53ea\u6703\u662f\u6240\u6709\u6574\u5408\u670d\u52d9\u4e2d\u6700\u5dee\u7684\u4e00\u500b\uff0c\u4efb\u4f55\u8abf\u7528\u7b2c\u4e09\u65b9\u670d\u52d9\uff0cSLA \u53ea\u6703\u4e0b\u964d\u3002\u4f60\u9700\u8981\u78ba\u4fdd\u4f60\u4e0d\u61c9\u4f9d\u8cf4 SLA \u6bd4\u4f60\u9084\u4f4e\u7684\u670d\u52d9<\/p>\n<p><strong>11. Unbounded Result Sets<\/strong><\/p>\n<p>\u958b\u767c\u74b0\u5883\u8cc7\u6599\u5c11\u6c92\u4e8b\uff0c\u4f46\u662f\u4e0a production \u5f8c\uff0c\u6709\u4e9b\u67e5\u8a62\u56e0\u70ba\u6c92\u6709\u9650\u5236\u6578\u91cf\uff0c\u56de\u50b3\u4e86\u904e\u591a\u7684\u8cc7\u6599\u3002\u9020\u6210 memory \u7528\u5149&#8230;. \u4e5f\u9020\u6210 slow responses\u3002<\/p>\n<p>Caller API \u61c9\u8a72\u8981\u80fd\u6307\u5b9a\u53ea\u63a5\u53d7\u591a\u5c11\u56de\u50b3\u91cf\u3002<\/p>\n<p><strong>12. Dogpile (\u4e8c\u7248\u624d\u6709)<\/strong><\/p>\n<p>\u4e00\u7fa4 servers \u4e00\u8d77 transient load \u77ac\u9593\u8f09\u5165\uff0c\u4f8b\u5982\u65b7\u96fb\u5f8c\u5168\u90e8\u6a5f\u5668\u4e00\u8d77\u958b\u6a5f\uff0c\u7136\u5f8c\u53c8\u5012\u4e86\u3002<br \/>\u53c8\u4f8b\u5982 cron job \u4e00\u8d77\u8dd1\u3001\u914d\u7f6e\u4e00\u8d77\u6539\uff0c\u9019\u6703\u8b93\u4f60 peak \u9700\u8981\u7684\u5bb9\u91cf\u4e0d\u5fc5\u8981\u589e\u52a0\uff0c\u61c9\u907f\u514d\u9019\u7a2e\u60c5\u6cc1\u3002<br \/>\u89e3\u6cd5: Retry \u9593\u9694\u6642\u9593\u8a2d\u5b9a\u4e0d\u540c\u3001cron jobs \u6642\u9593\u932f\u958b\u7b49\u7b49\u65b9\u5f0f<\/p>\n<p><strong>13. Force Multiplier (\u4e8c\u7248\u624d\u6709)<\/strong><\/p>\n<p>\u5c0f\u5fc3\u904b\u7528 Infrastructure Mangement \u5de5\u5177\u554a!<\/p>\n<p>\u4f8b\u5982 <a href=\"http:\/\/Reditt.com\" class=\"autohyperlink\">Reditt.com<\/a> \u5728 2016\/8\/11 \u7684\u6848\u4f8b:<br \/>\u8981\u5347\u7d1a Zookeeper\uff0c\u95dc\u6389 autoscaler\uff0c\u5347\u7d1a\u904e\u7a0b package management system \u91cd\u958b autoscaler<br \/>Autoscaler \u8b80\u5230\u4e0d\u6b63\u78ba\u7684 zookeeper \u8a2d\u5b9a\uff0c\u6c7a\u5b9a\u95dc\u6a5f\u5668&#8230;.. \u5c31\u5012\u7ad9\u4e86\u3002\u65bc\u662f\u4eba\u53bb\u958b\u6a5f\u5668\uff0c\u4f46 cache \u662f\u7a7a\u7684\uff0c\u6d41\u91cf\u6253\u5230\u8cc7\u6599\u5eab dogfile\u2026\u2026 \u53c8\u5012\u4e86<\/p>\n<p>Discovery service \u56e0\u70ba\u90e8\u5206\u7dda\u8def\u4e0d\u6b63\u5e38\uff0c\u9020\u6210 service \u7121\u6cd5\u5224\u65b7\u662f\u5012\u7ad9\u9084\u662f\u4ed6\u778e\u4e86\u3002\u5982\u679c\u4f9d\u8cf4\u9019\u7a2e\u932f\u8aa4\u8cc7\u8a0a\uff0c\u800c\u81ea\u52d5\u505a\u4e00\u4e9b\u958b\u6a5f\u5668\u6216\u95dc\u6a5f\u5668\u7684\u64cd\u4f5c\uff0c\u5c31\u5f88\u5371\u96aa\u4e86\u3002<\/p>\n<p>\u89e3\u6cd5: \u9700\u8981\u6642\u505a\u4e00\u4e9b safeguard \u4fdd\u8b77\u6a5f\u5236\uff0c\u4f8b\u5982\u5982\u679c\u56de\u5831 80%\u6a5f\u5668\u90fd\u58de\u4e86\uff0c\u53ef\u80fd\u76e3\u63a7\u81ea\u5df1\u58de\u6389\u7684\u6a5f\u7387\u9084\u6bd4\u8f03\u5927\u3002\u9810\u671f\u8ddf\u89c0\u5bdf\u60c5\u6cc1\u5dee\u592a\u591a\uff0c\u8981\u6709\u901a\u77e5\u8b93\u4eba\u4f86\u78ba\u8a8d\u3002<\/p>\n<h2>Stability Patterns<\/h2>\n<p>\u90fd\u4e0d\u662f\u5e6b\u52a9\u4f60\u901a\u904eQA\u7684\uff0c\u800c\u662f\u5e6b\u52a9\u4f60\u665a\u4e0a\u7761\u597d\u89ba\u7684\u3002<\/p>\n<p>\u8acb\u4e0d\u8981\u9810\u671f\u7cfb\u7d71\u4e0d\u6703\u5931\u6548\uff0c\u800c\u662f\u9019\u4e9b\u6a21\u5f0f\u53ef\u4ee5\u5e6b\u52a9\u4f60\u6e1b\u8f15\u55ae\u500b\u5931\u6548\u5e36\u4f86\u7684\u7834\u58de<\/p>\n<p><strong>1. Use Timeouts<\/strong><\/p>\n<p>\u7db2\u8def\u662f\u4e0d\u53ef\u9760\u7684\uff0c\u7528 Timouts \u53ef\u4ee5\u9694\u96e2\u6545\u969c\uff0c\u8b93\u5225\u4eba\u7684\u554f\u984c\u4e0d\u6703\u5bb3\u6b7b\u4f60\u3002Integration points, blocked threads, slow responses \u7b49\u554f\u984c\u90fd\u53ef\u7528\u9019\u62db\u3002\u95dc\u65bc\u91cd\u8a66\u4e5f\u8981\u8003\u616e retry \u6642\u9593\u548c\u983b\u7387\uff0c\u56e0\u7232\u4ed6\u6545\u969c\u53ef\u80fd\u6703\u6301\u7e8c\u4e00\u9663\u5b50\u3002<\/p>\n<p><strong>2. Circuit Breaker \u65b7\u8def\u5668<\/strong><\/p>\n<p>\u5982\u679c\u5931\u6557\u592a\u591a\u6b21\uff0c\u5c31\u5148\u95dc\u6389\u3002\u7528\u5728 Integration points\u3002<br \/>\u53e6\u5916\u8981\u7d00\u9304\u958b\u95dc\u72c0\u614b\u7d66 Operation team \u770b\u3002<br \/>\u642d\u914d Timeouts \u4f7f\u7528<\/p>\n<p><strong>3. Bulkheads<\/strong><\/p>\n<p>\u5c07\u7cfb\u7d71\u5206\u9694\uff0c\u5207\u958b\u4fdd\u7559\u4e00\u90e8\u5206\u7684\u8cc7\u6e90\u7d66\u95dc\u9375\u7684\u9700\u6c42\u3002\u4f8b\u5982 Virtual server \u662f\u500b\u65b9\u6cd5\u3002<\/p>\n<p><strong>4. Steady State<\/strong><\/p>\n<p>\u7cfb\u7d71\u61c9\u53ef\u4ee5\u7368\u7acb\u904b\u4f5c\uff0c\u4e0d\u9700\u8981\u4eba\u70ba\u5e72\u9810\u3002<br \/>\u5176\u4e2d\u6700\u5e38\u898b\u7684\u4eba\u70ba\u5e72\u9810\u5c31\u662f\u53bb\u8655\u7406 data purging \u8cc7\u6e90\u6eff\u4e86 (\u786c\u789f log, database, \u5167\u5b58 caching)\u3002\u800c\u4e14 data purging \u6e05\u9664\u7121\u7528\u7684\u6578\u64da\u7684\u529f\u80fd\u901a\u5e38\u5728\u8edf\u9ad4\u7b2c\u4e00\u7248\u4e0d\u6703\u958b\u767c\u3002<\/p>\n<p>Log \u4e0d\u61c9\u7559\u5728 production\uff0c\u4f9d\u8a72\u642c\u5230\u53e6\u5916\u7684\u5730\u65b9\u505a\u5206\u6790<br \/>\u7de9\u5b58\u8981\u9650\u5236\u5927\u5c0f<\/p>\n<p><strong>5. Fail Fast<\/strong><\/p>\n<p>\u6162\u97ff\u61c9\u6bd4\u6c92\u6709\u97ff\u61c9\u66f4\u7cdf\uff0c\u800c\u5931\u6557\u7684\u6162\u97ff\u61c9\u662f\u6700\u7cdf\u7cd5\u7684\u3002\u5118\u65e9\u5224\u65b7\u6703\u4e0d\u6703\u5931\u6557\u3002<br \/>\u5927\u90e8\u5206\u5931\u6557\u7684\u554f\u984c\u662f \u8cc7\u6e90\u4e0d\u53ef\u7528 resource availability \u7684\u554f\u984c\u3002<br \/>\u5728\u6b64\u5728\u4ea4\u6613\u524d\u53ef\u4ee5\u5148\u78ba\u4fdd\u6240\u6709\u9700\u8981\u7684\u8cc7\u6e90\uff0c\u4e26\u5148\u505a\u597d\u8f38\u5165\u9a57\u8b49\uff0c\u82e5\u6709\u4e00\u500b\u4e0d\u53ef\u7528\u5c31\u56de\u61c9\u5931\u6557\u4e86\uff0c\u4e0d\u8981\u6d6a\u8cbb\u6642\u9593\u505a\u4e00\u534a<\/p>\n<p><strong>6. Handshaking<\/strong><\/p>\n<p>\u5e95\u5c64\u5e38\u7528\u7684\u63e1\u624b\u5354\u8b70\uff0c\u5728\u61c9\u7528\u5c64\u537b\u5f88\u5c11\u4eba\u505a\u3002\u63e1\u624b\u53ef\u4ee5\u5be6\u73fe client &lt;-&gt; server \u7684\u9650\u5236\u6a5f\u5236\u3002\u82e5\u6c92\u6709\u63e1\u624b\u5354\u8b70\uff0c\u4e5f\u53ef\u4ee5\u8003\u616e\u505a health check \u6a5f\u5236\u4f86\u88dc\u6551\u3002<\/p>\n<p><strong>7. Test Harness<\/strong><\/p>\n<p>\u5206\u5e03\u5f0f\u7cfb\u7d71\u7684\u5931\u6548\u5f88\u96e3\u5728\u672c\u6a5f\u89f8\u767c\u3002\u6574\u5408\u6e2c\u8a66 Integration Tests \u4e5f\u53ea\u662f\u6e2c\u8a66\u4e00\u7a2e\u6210\u529f\u60c5\u5883\uff0c\u4f60\u9700\u8981\u5efa\u69cb\u6e2c\u8a66\u6a5f\u5236\u53bb\u6a21\u64ec\u6bcf\u500b integration point \u5931\u6548\u7684\u60c5\u5883\u3002\u4f8b\u5982\u7522\u751f\u6162\u56de\u61c9\u3001\u4e0d\u56de\u61c9\u3001\u5783\u573e\u56de\u61c9\u7b49\u7b49\u3002\u53ef\u4ee5\u5171\u7528\u6e2c\u8a66\u88dd\u7f6e\u3002<\/p>\n<p><strong>8. Decoupling Middleware<\/strong><\/p>\n<p>\u540c\u6b65\u7684 middleware \u908f\u8f2f\u6bd4\u8f03\u7c21\u55ae\uff0c\u4f46\u5931\u6548\u6642\u6703\u5f15\u8d77\u653e\u5927\u885d\u64ca\uff0ccoupling \u9ad8\u3002\u800c\u7570\u6b65\u7684 middleware \u4e0d\u6703\u5f15\u8d77 cascading failure\uff0ccoupling \u4f4e\uff0c\u4f46\u662f\u5be6\u4f5c\u6bd4\u8f03\u96e3\uff0c\u6574\u9ad4\u67b6\u69cb\u90fd\u6703\u4e0d\u540c\u3002\u8ddf\u672c\u7ae0\u5176\u4ed6\u89e3\u6cd5\u4e0d\u540c\uff0c\u9019\u62db\u6210\u672c\u6bd4\u8f03\u9ad8\u3002<\/p>\n<p><strong>9. Let It Crash (\u4e8c\u7248\u624d\u6709)<\/strong><\/p>\n<p>\u50cf Erlang \u54f2\u5b78\uff0c\u8a2d\u8a08 supervision \u6709\u80fd\u529b\u53ef\u4ee5\u653e\u68c4\u7368\u7acb\u7684 component\uff0c\u53ef\u80fd\u662f process \u6216\u4e00\u500b\u4e00\u53f0\u6a5f\u5668 \u91cd\u958b\u4f86\u6551\u6574\u500b system\u3002\u5982\u679c\u662f monoliths \u7cfb\u7d71\u9019\u62db\u5c31\u4e0d\u9069\u7528\u4e86\uff0c\u56e0\u70ba\u91cd\u958b\u6703\u592a\u4e45\u3002<\/p>\n<p><strong>10 .Shed Load (\u4e8c\u7248\u624d\u6709)<\/strong><\/p>\n<p>\u7cfb\u7d71\u5916\u90e8\u4f86\u7684\u6d41\u91cf\u592a\u9ad8\u6642\uff0c\u6709\u9632\u79a6\u6a5f\u5236\u53ef\u4ee5\u56de\u61c9 503 \u4f86\u963b\u64cb\u904e\u591a\u7684\u9023\u7dda\uff0c\u907f\u514d slow responses\u3002\u7cfb\u7d71\u5167\u90e8\u6d41\u91cf\uff0c\u7528\u4e0b\u4e00\u62db\u4f86\u505a flow control\u6a5f\u5236<\/p>\n<p><strong>11.\u00a0 Create Back Pressure (\u4e8c\u7248\u624d\u6709)<\/strong><\/p>\n<p>Flow control \u6d41\u91cf\u63a7\u5236(\u9700\u8981\u591a\u5c11\uff0c\u5c31\u751f\u7522\u591a\u5c11)\u4f86\u5e73\u8861 producuer \u548c consumer\u3002Queue \u8981\u9650\u5236\u5927\u5c0f\uff0c\u80fd\u8655\u7406 queue \u6eff\u8f09\u60c5\u6cc1\uff0c\u4f8b\u5982 block \u6389\u3002\u53c3\u8003 TCP flow control\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4f60\u7684 API service \u7684\u8655\u7406\u901f\u5ea6\u662f\u6709\u4e0a\u9650\u7684\uff0c\u5982\u679c\u8d85\u904e\u9019\u500b\u901f\u5ea6\uff0c\u600e\u9ebc\u8fa6? \u53ef\u7528 Rate limit \u66ab\u6642 block HTTP 503 \u6389 client<br \/>\u6216\u662f\u6709\u500b queue \u5148\u66ab\u5b58\u56de\u50b3 HTTP 202\uff0c\u8b8a\u6210 async<\/p>\n<p><strong>12. Governor (\u4e8c\u7248\u624d\u6709)<\/strong><\/p>\n<p>\u81ea\u52d5\u5316\u5982\u679c\u51fa\u932f\u4e86\uff0c\u6703\u932f\u5f97\u975e\u5e38\u5febXD<br \/>\u5371\u96aa\u64cd\u4f5c(\u95dc\u6a5f\u5668\u3001\u522a\u9664\u8cc7\u6599)\u4e0d\u8981\u81ea\u52d5\u5730\u592a\u5feb\uff0c\u8981\u6709\u901a\u77e5\u8ddf\u5f48\u6027\u8b93\u4eba\u5de5\u53ef\u4ee5\u6709\u6a5f\u6703\u4ecb\u5165\u3002\u4f8b\u5982\u81ea\u52d5\u958b\u6a5f\u5f88\u5feb\uff0c\u4f46\u81ea\u52d5\u95dc\u6a5f\u8981\u6162\uff0c\u53ea\u80fd\u8b93\u7a0b\u5f0f\u81ea\u52d5\u4e00\u6b21\u95dc\u591a\u5c11\u6bd4\u4f8b\u7684\u6a5f\u5668\u3002<\/p>\n<h2>Capacity<\/h2>\n<p>Performance != Throughput(or capacity) \u8001\u95c6\u95dc\u5fc3\u5f8c\u8005\u3001\u4f46\u7528\u6236\u95dc\u5fc3\u524d\u8005\u3002<\/p>\n<p>Capacity \u4e0d\u662f\u7dda\u6027\u7684\uff0c\u4f8b\u5982 CPU 50% -&gt; 100% \u4e0d\u4ee3\u8868\u53ef\u4ee5\u8655\u7406\u5169\u500d\u7528\u6236\u3002<\/p>\n<p>\u9650\u5236\u7406\u8ad6: \u9996\u5148\u9054\u5230\u6975\u9650\u7684\u9650\u5236\u6c7a\u5b9a\u4e86\u7cfb\u7d71\u5bb9\u91cf\u3002\u56e0\u6b64\u8981\u8b58\u5225\u51fa\u95dc\u9375\u9650\u5236\u3002<\/p>\n<p>Scalability \u6c34\u5e73\u64f4\u5c55\u8ddf\u5782\u76f4\u64f4\u5c55: \u524d\u8005\u4f8b\u5982 shared-nothing \u7684 web servers\uff0c\u5f8c\u8005\u4f8b\u5982 database server\u3002<\/p>\n<p>\u53e6\u5916\u9084\u6709\u4e00\u7a2e cluster server\uff0c\u96d6\u7136\u4e5f\u7b97\u6c34\u5e73\u64f4\u5c55\u4f46\u4e0d\u662f\u7dda\u6027\u7684\uff0c\u56e0\u70ba\u6709\u6975\u7fa4\u7ba1\u7406\u8ca0\u64d4\u3002<\/p>\n<p>Application server \u7684 CPU usages \u662f\u6703\u5f71\u97ff memory usages \u7684\u3002<\/p>\n<h2>Capacity Anti-patterns<\/h2>\n<p>\u4e00\u7248\u7684\u9019\u7ae0\u5f88\u591a\u5167\u5bb9\u6709\u9ede\u904e\u6642\u592a\u4fdd\u5b88\u4e86 XD \u5c31\u4e0d\u7b46\u8a18\u4e86<\/p>\n<p>\u53ea\u6709\u4e00\u689d\u503c\u5f97\u4e00\u8a18: Transaction \u4ea4\u6613\u7528\u9014\u548c Reporting \u5831\u8868\u7528\u9014\u7684\u8cc7\u6599\u5eab\u4e0d\u8981\u653e\u5728\u4e00\u8d77\u3002<\/p>\n<h2>Capacity Patterns<\/h2>\n<ol>\n<li>\u904e\u65e9\u6700\u4f73\u5316\u662f\u4e00\u5207\u7f6a\u60e1\u7684\u6839\u6e90\uff0c\u9019\u53e5\u8a71\u8b8a\u6210\u721b\u8a2d\u8a08\u7684\u85c9\u53e3&#8230; XD \u5e38\u5e38\u5c31\u8b8a\u6210\u6c92\u6709\u4efb\u4f55\u512a\u5316\u3002<\/li>\n<li>\n<p>Pool connections \u9023\u7d50\u6c60\u5fc5\u7528\u7684\u57fa\u672c\u6280\u8853\uff0c\u8981\u6ce8\u610f\u5927\u5c0f\u76e3\u63a7\u9023\u7dda\u6642\u9593\u8ddf\u6578\u91cf\u3002<\/p>\n<\/li>\n<li>\n<p>Caching \u8981\u9650\u5236\u7de9\u5b58\u5927\u5c0f\u3001\u76e3\u63a7\u547d\u4e2d\u7387\u6c7a\u5b9a\u5927\u5c0f\u3002<\/p>\n<\/li>\n<li>\n<p>Precompute Content \u9810\u8a08\u7b97 render HTML\uff0c\u7279\u5225\u662f\u6d41\u91cf\u9ad8\u7684\u9801\u9762 (\u9664\u4e86\u500b\u4eba\u5316\u5167\u5bb9)\uff0c\u4fee\u6539\u983b\u7387\u9060\u4f4e\u65bc\u986f\u793a\u983b\u7387\u3002\u9019\u8ddf caching \u4e0d\u4e00\u6a23\uff0c\u9019\u662f\u5148\u7b97\u597d\u7684\u4e0d\u9700\u8981\u9810\u71b1\u3002<\/p>\n<\/li>\n<li>\n<p>Tune GC \u6839\u64da\u7528\u6236\u6a21\u5f0f\uff0c\u6700\u512a\u8a2d\u7f6e\u6703\u6709\u4e0d\u540c\uff0c\u56e0\u6b64\u8981\u5728 production \u4e0a\u8abf\u6574\u3002\u91cd\u5927\u66f4\u65b0\u5f8c\u4e5f\u8981\u8abf\u6574\u3002<\/p>\n<\/li>\n<\/ol>\n<h2>Security<\/h2>\n<p>\u6700\u5c11\u7279\u6b0a\u539f\u5247: process \u53ea\u9700\u8981\u5b83\u9700\u8981\u7684\u6700\u5c11\u7684\u6b0a\u9650\u3001\u6bcf\u500b\u91cd\u8981\u7684 app \u6709\u81ea\u5df1\u7684 user\u3002<\/p>\n<p>\u4fdd\u8b77\u597d\u5bc6\u78bc: \u7279\u5225\u662f\u8cc7\u6599\u5eab\u5bc6\u78bc\u3001\u5bc6\u78bc\u53ea\u6709\u9700\u8981\u7684\u7528\u6236\u53ef\u8b80\u3002<\/p>\n<h2>Availability<\/h2>\n<p>\u8981\u4fdd\u8b49\u53ef\u7528\u6027\u5c31\u4e00\u5b9a\u6703\u63d0\u9ad8\u6210\u672c\u3002<\/p>\n<p>\u6bcf\u63d0\u9ad8\u4e00\u500b9\uff0c\u6703\u63d0\u9ad8 10%\u958b\u767c\u6210\u672c\uff0c\u548c\u6bcf\u5e7420%\u904b\u71df\u6210\u672c\u3002\u4f60\u53ef\u4ee5\u62ff\u4f86\u548c\u505c\u6a5f\u5e36\u4f86\u7684\u640d\u5931\u76f8\u6bd4\u3002<\/p>\n<p>SLA \u8981\u5b9a\u7fa9\u6e05\u695a\u662f\u54ea\u4e9b\u529f\u80fd\u53ef\u7528\u624d\u7b97\uff0c\u9084\u8981\u6392\u9664\u5916\u90e8\u7cfb\u7d71\uff0c\u9084\u8981\u6709\u500b\u76e3\u63a7\u7cfb\u7d71\u3002<\/p>\n<p>\u6c34\u5e73\u64f4\u5c55\u6703\u7528\u5230 Load balancing:<\/p>\n<p>DNS round-robin \u4e0d\u597d\uff0c\u5ba2\u6236\u53ef\u80fd\u6703\u5feb\u53d6 DNS\uff0c\u9020\u6210\u4e0d\u5920\u5e73\u8861\u548c\u5f48\u6027<br \/>Reverse Proxy \u4f8b\u5982 Apache mod_proxy, Squid, Akamai \u4e5f\u7b97\uff0c\u53ef\u4ee5\u9806\u4fbf\u505a static caching<br \/>Hardware Load Balancer \u6700\u53b2\u5bb3\uff0c\u4f46\u662f\u4e00\u53f0\u5f88\u8cb4<\/p>\n<p>Clustering \u4e5f\u53ef\u4ee5\u7528\u4f86 load balancing, \u4f8b\u5982 active-active clusters\uff0c\u6216\u662f\u652f\u63f4 redundancy \u53eb\u505a active-passive clusters\u3002<br \/>\u96c6\u7fa4\u5bb9\u91cf\u4f4e\u65bc\u7dda\u6027\u64f4\u5c55\uff0c\u56e0\u70ba\u6709\u63a7\u5236\u7bc0\u9ede\u662f\u5f31\u9ede\u3002\u4f46\u914d\u7f6e\u96c6\u7fa4\u6bd4\u8f03\u8907\u96dc\uff0c\u5f88\u53ef\u80fd\u5728 active-passive \u6642\u96d6\u7136\u53ef\u4ee5\u505a\u5230 redundancy \u4f46\u662f availability \u6703\u5931\u6557\u3002<\/p>\n<h2>Administration<\/h2>\n<p>\u9019\u7ae0\u8ac7\u5982\u4f55\u8b93\u7cfb\u7d71\u8ddf administrators \u914d\u5408\u597d\uff0c\u5c0d\u4ed6\u597d\u7528\u7cfb\u7d71\u624d\u6703\u904b\u884c\u826f\u597d\u3002<\/p>\n<p>QA \u74b0\u5883\u548c Production \u74b0\u5883\u4e0d\u540c\u7684\u554f\u984c:<\/p>\n<p>\u6700\u5e38\u898b\u51fa\u932f\u7684\u5730\u65b9\u4e0d\u662f\u914d\u7f6e configurations \u5dee\u7570\uff0c\u800c\u662f servers topology \u4e0d\u540c\uff0c\u4f8b\u5982 QA \u6642\u6240\u6709\u7a0b\u5f0f\u5171\u7528\u4e00\u53f0\u4e3b\u6a5f\uff0c\u4e0a\u7dda\u6642\u624d\u62c6\u958b servers \u904b\u884c\u3002<\/p>\n<p>\u89e3\u6cd5: \u5982\u679c QA \u6642 sevrer \u4e0d\u80fd\u62c6\u958b\uff0c\u81f3\u5c11\u4e5f\u7528 VM \u62c6\u958b\u3002<\/p>\n<p>0, 1 \u8ddf many \u6709\u672c\u8cea\u4e0a\u7684\u5340\u5225: QA \u6642\u53ea\u958b\u4e00\u53f0\uff0c\u800c Production \u6709\u5f88\u591a\u53f0\u3002<\/p>\n<p>\u4f60\u4e0d\u4e00\u5b9a\u9700\u8981\u8ddf Production \u4e00\u6a23\u591a\u53f0\uff0c\u4f46\u81f3\u5c11\u8981\u4e0d\u53ea\u4e00\u53f0\u3002<br \/>Production \u6703\u7528\u5230\u8a2d\u5099\u4e5f\u9700\u8981\uff0c\u4e0d\u4e00\u5b9a\u9700\u8981\u4e00\u6a23\uff0c\u4f46\u81f3\u5c11\u53ef\u4ee5\u8cb7\u540c\u4e00\u5bb6\u5ee0\u5546\u548c\u7522\u54c1\u7dda\u7684\u7522\u54c1\u4f86\u505a QA\u3002<\/p>\n<p>\u914d\u7f6e\u8ddf\u7a0b\u5f0f\u8981\u5206\u958b\uff0c\u4e5f\u4e0d\u8981\u8ddf\u7a0b\u5f0f\u653e\u4e00\u8d77\uff0c\u4e0d\u7136\u6015 admin \u4e0d\u5c0f\u5fc3\u6539\u58de\u6703\u8986\u84cb\u6389\uff0c\u914d\u7f6e\u6587\u4ef6\u4e5f\u5efa\u8b70\u7528\u7248\u672c\u63a7\u5236\u3002<\/p>\n<blockquote>\n<p>\u7b2c\u4e00\u7248\u9019\u7ae0\u8b1b\u7684\u6709\u9ede\u7c21\u7565\u843d\u4f0d\u4e86\uff0c\u65b0\u6642\u4ee3\u7684 DevOps \u5728\u9019\u584a\u7422\u78e8\u66f4\u591a\u3002<\/p>\n<\/blockquote>\n<h2>Operations<\/h2>\n<p>Instrumentation\u3001\u7cfb\u7d71\u76e3\u63a7\u3001Log\u3001Dashboard (\u5b9a\u7fa9\u7d05\u71c8\u3001\u9ec3\u71c8\u3001\u7da0\u71c8)\u3001\u5831\u544a\u901a\u77e5 \u7b49\u544a\u8a34\u6211\u5011\u7cfb\u7d71\u767c\u751f\u4e86\u4ec0\u9ebc\u4e8b\uff0c\u6709\u900f\u660e\u6027\u7684\u7cfb\u7d71\u624d\u597d\u8abf\u6559\u3002<\/p>\n<p>\u7cfb\u7d71\u7b2c\u4e00\u6b21\u767c\u5e03\u5f8c\uff0c\u6703\u767c\u751f\u7684\u6210\u672c\u4f54\u5168\u90e8\u6210\u672c\u7684 40%~90%\uff0c\u9019\u53ef\u80fd\u662f\u7dad\u8b77\u6216\u65b0\u529f\u80fd\u958b\u767c\u3002\u56e0\u70ba\u6539\u8b8a\u7cfb\u7d71\u5c31\u6703\u6709\u6210\u672c\uff0c\u5982\u679c\u592a\u96e3\u6539\u5c31\u6703\u4e0d\u53bb\u6539\u3002\u800c\u4e00\u500b\u5177\u6709\u9069\u61c9\u6027\u7684\u8edf\u9ad4\u8a2d\u8a08\uff0c\u6703\u7528\u5230 1.DI 2. OO 3. XP, Refactors, Unit Test 4. Agile DB (schema \u7248\u63a7) \u7b49\u7b49\u6280\u5de7\uff0c\u80fd\u66f4\u597d\u97ff\u61c9\u5ba2\u6236\u9700\u6c42\uff0c\u5c31\u662f\u4e00\u500b\u6709\u9069\u61c9\u6027\u7684\u67b6\u69cb\u3002<\/p>\n<h2>\u7b2c\u4e8c\u7248\u5f8c\u534a<\/h2>\n<p>\u7b2c\u4e8c\u7248\u7684\u5f8c\u534a\u6539\u5beb\u597d\u591a\uff0c\u6709\u66f4\u591a\u7684 DevOps \u5be6\u52d9\u3002\u53c3\u8003\u66f8\u76ee\u591a\u4e86 Continuous delivery \u8ddf The DevOps Handbook\u3002<\/p>\n<p>\u5f8c\u534a\u5167\u5bb9\u5927\u81f4\u6709<\/p>\n<ol>\n<li>Foundations: Container, 12-Factor App<\/li>\n<li>Processes on Machines: Deploy Pipeline, Immutable and Disposable Infrastructure<\/li>\n<li>Interconnect: DNS, Load Balancing, Routing<\/li>\n<li>Control Plane: Log, Metrics, Configuration service, Autoscaler\u2026.<\/li>\n<li>Security: \u6bd4\u7b2c\u4e00\u7248\u591a\u8b1b\u4e86 OWASP<\/li>\n<li>Design for Deployment: Automated\/Continuous Deployments<\/li>\n<li>Handling Versions: \u5347\u7d1a\u3001API \u5347\u7d1a<\/li>\n<li>Chaos Engineering \u548c Netflix \u7684 Chaos Monkey<\/li>\n<\/ol>\n<p>\u5982\u679c\u4f60\u6709\u8ddf\u4e0a\u4e86\u89e3 2014 \u5e74\u958b\u59cb\u7684 DevOps \u548c SRE \u5de5\u5177\u77e5\u8b58\uff0c\u6211\u60f3\u9019\u4e9b\u4f60\u90fd\u77e5\u9053\u4e86\u3002<\/p>\n<h1>\u00a0<\/h1>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Release It! \u7b2c\u4e00\u7248\u51fa\u7248\u65bc 2007\uff0c\u7372\u5f97\u4e86 2008 \u5e74\u7684 Jolt Awards \u734e\u3002\u7b2c\u4e8c\u7248\u662f  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ihower.tw\/blog\/10436-release-it\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Release It! \u8b80\u66f8\u6458\u8981\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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}},"categories":[51,2],"tags":[],"class_list":["post-10436","post","type-post","status-publish","format-standard","hentry","category-agile","category-software-development","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1q6tG-2Ik","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/10436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/comments?post=10436"}],"version-history":[{"count":20,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/10436\/revisions"}],"predecessor-version":[{"id":10739,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/10436\/revisions\/10739"}],"wp:attachment":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/media?parent=10436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/categories?post=10436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/tags?post=10436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}