{"id":172034,"date":"2020-02-24T08:41:47","date_gmt":"2020-02-24T00:41:47","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=172034"},"modified":"2020-02-15T16:15:20","modified_gmt":"2020-02-15T08:15:20","slug":"maintenance-and-testing","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/maintenance-and-testing.html","title":{"rendered":"\u8fd0\u7ef4\u4e0e\u6d4b\u8bd5\u9886\u57df\u65b0\u6280\u672f\u4e00\u89c8"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u73b0\u5982\u4eca\u6211\u4eec\u7684\u7a0b\u5e8f\u548c\u670d\u52a1\u8d8a\u6765\u8d8a\u5e9e\u5927\uff0c\u5149\u662f\u5355\u5143\u6d4b\u8bd5 TDD \u4e4b\u7c7b\u7684\u5c31\u5df2\u7ecf\u5f88\u96be\u4fdd\u8bc1\u8d28\u91cf\uff0c\u4e0d\u8fc7\u8fd9\u4e9b\u90fd\u662f baseline\uff0c\u6240\u4ee5\u4eca\u5929\u804a\u70b9\u65b0\u7684\u8bdd\u9898\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u6211\u89c9\u5f97\u9762\u5bf9\u6d4b\u8bd5\u7684\u6001\u5ea6\u662f\u533a\u5206\u4e00\u4e2a\u666e\u901a\u7a0b\u5e8f\u5458\u548c\u4f18\u79c0\u7a0b\u5e8f\u5458\u7684\u91cd\u8981\u6807\u51c6\u3002<\/p>\n

\u73b0\u5982\u4eca\u6211\u4eec\u7684\u7a0b\u5e8f\u548c\u670d\u52a1\u8d8a\u6765\u8d8a\u5e9e\u5927\uff0c\u5149\u662f\u5355\u5143\u6d4b\u8bd5 TDD \u4e4b\u7c7b\u7684\u5c31\u5df2\u7ecf\u5f88\u96be\u4fdd\u8bc1\u8d28\u91cf\uff0c\u4e0d\u8fc7\u8fd9\u4e9b\u90fd\u662f baseline\uff0c\u6240\u4ee5\u4eca\u5929\u804a\u70b9\u65b0\u7684\u8bdd\u9898\u3002<\/p>\n

\u8bf4\u6d4b\u8bd5\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u95ee\u4e0b\u81ea\u5df1\uff0c\u4e3a\u4ec0\u4e48\u8981\u6d4b\u8bd5\uff1f\u5f53\u7136\u662f\u4e3a\u4e86\u627e Bug\u3002\u770b\u8d77\u6765\u8fd9\u662f\u53e5\u5e9f\u8bdd\uff0c\u4f46\u662f\u4ed4\u7ec6\u60f3\u60f3\uff0c\u5982\u679c\u6211\u4eec\u80fd\u5199\u51fa Bug-free \u7684\u7a0b\u5e8f\u4e0d\u5c31\u597d\u4e86\u5417\uff1f\u4f55\u5fc5\u90a3\u4e48\u9ebb\u70e6\u3002\u4e0d\u8fc7 100% \u7684 bug-free \u80af\u5b9a\u662f\u4e0d\u884c\u7684\uff0c\u90a3\u4e48\u6211\u4eec\u6709\u6ca1\u6709\u529e\u6cd5\u80fd\u591f\u5c3d\u53ef\u80fd\u5730\u63d0\u5347\u6211\u4eec\u7a0b\u5e8f\u7684\u8d28\u91cf\uff1f<\/p>\n

\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6211\u60f3\u5230\u4e00\u4e2a Raft \u7684\u4f18\u5316\u7b97\u6cd5\uff0c\u4e0e\u5176\u7b49\u5b9e\u73b0\u4e4b\u540e\u518d\u6d4b\u8bd5\uff0c\u80fd\u4e0d\u80fd\u5728\u5199\u4ee3\u7801\u524d\u5c31\u77e5\u9053\u8fd9\u4e2a\u7b97\u6cd5\u7406\u8bba\u4e0a\u6709\u6ca1\u6709\u95ee\u9898\uff1f\u529e\u6cd5\u5176\u5b9e\u662f\u6709\u7684\uff0c\u90a3\u5c31\u662f\u5f62\u5f0f\u5316\u8bc1\u660e\u6280\u672f\uff0c\u6bd4\u8f83\u5e38\u7528\u7684\u662f TLA+\u3002<\/p>\n

TLA+<\/strong><\/div>\n

TLA+ \u80cc\u540e\u7684\u601d\u60f3\u5f88\u7b80\u5355\uff0cTLA+ \u4f1a\u901a\u8fc7\u4e00\u5957\u81ea\u5df1\u7684 DSL\uff08\u7b26\u53f7\u5f88\u63a5\u8fd1\u6570\u5b66\u8bed\u8a00\uff09\u63cf\u8ff0\u7a0b\u5e8f\u7684\u521d\u59cb\u72b6\u6001\u4ee5\u53ca\u540e\u7eed\u72b6\u6001\u4e4b\u95f4\u7684\u8f6c\u6362\u5173\u7cfb\uff0c\u540c\u65f6\u6839\u636e\u4f60\u7684\u4e1a\u52a1\u903b\u8f91\u6765\u5b9a\u4e49\u5728\u8fd9\u4e9b\u72b6\u6001\u5207\u6362\u4e2d\u7684\u4e0d\u53d8\u91cf\uff0c\u7136\u540e TLA+ \u7684 TLC model checker \u5bf9\u72b6\u6001\u673a\u7684\u6240\u6709\u53ef\u8fbe\u72b6\u6001\u8fdb\u884c\u7a77\u4e3e\uff0c\u5728\u7a77\u4e3e\u8fc7\u7a0b\u4e2d\u4e0d\u65ad\u68c0\u9a8c\u4e0d\u53d8\u91cf\u7ea6\u675f\u662f\u5426\u88ab\u7834\u574f\u3002<\/p>\n

\u4e3e\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5206\u5e03\u5f0f\u4e8b\u52a1\u6700\u7b80\u5355\u7684\u4e24\u9636\u6bb5\u63d0\u4ea4\u7b97\u6cd5\uff0c\u5bf9\u4e8e TLA+ Spec \u6765\u8bf4\uff0c\u9700\u8981\u4f60\u5b9a\u4e49\u597d\u521d\u59cb\u72b6\u6001\uff08\u4f8b\u5982\u4e8b\u52a1\u8981\u64cd\u4f5c\u7684 keys\u3001\u6709\u51e0\u4e2a\u5e76\u53d1\u5ba2\u6237\u7aef\u7b49\uff09\uff0c\u7136\u540e\u5b9a\u4e49\u72b6\u6001\u95f4\u8df3\u8f6c\u7684\u64cd\u4f5c\uff08 Begin \/ Write \/ Read \/ Commit \u7b49\uff09\uff0c\u6700\u540e\u5b9a\u4e49\u4e0d\u53d8\u91cf\uff08\u4f8b\u5982\u4efb\u4f55\u5904\u4e8e Committed \u72b6\u6001\u7684 write ops \u4e00\u5b9a\u662f\u6309\u7167 commit timestamp \u6392\u5e8f\u7684\uff0c\u6216\u8005 Read \u7684\u64cd\u4f5c\u4e00\u5b9a\u4e0d\u4f1a\u8bfb\u5230\u810f\u6570\u636e\u4e4b\u7c7b\u7684\uff09\uff0c\u5199\u5b8c\u4ee5\u540e\u653e\u5230 TLC Checker \u91cc\u9762\u8fd0\u884c\uff0c\u7b49\u5f85\u7ed3\u679c\u5c31\u597d\u3002<\/p>\n

\u4f46\u662f\uff0c\u6211\u4eec\u6d3b\u5728\u4e00\u4e2a\u4e0d\u5b8c\u7f8e\u7684\u4e16\u754c\uff0c\u5373\u4f7f\u4f60\u5199\u51fa\u4e86\u5b8c\u7f8e\u7684\u8bc1\u660e\uff0c\u4e5f\u5f88\u96be\u4fdd\u8bc1\u4f60\u5c31\u662f\u5bf9\u7684\u3002\u7b2c\u4e00\uff0c Simulator \u5e76\u6ca1\u6709\u529e\u6cd5\u6a21\u62df\u51fa\u65e0\u9650\u591a\u7684 paticipants \u548c\u5e76\u53d1\u5ea6\uff0c \u4e00\u822c\u4e5f\u5c31\u662f\u4e09\u4e94\u4e2a\uff1b\u7b2c\u4e8c\uff0c\u806a\u660e\u7684\u4f60\u53ef\u80fd\u4e5f\u770b\u51fa\u6765\u4e86\uff0c\u4e00\u822c TLA+ \u7684\u63a8\u5e7f\u6587\u7ae0\u4e5f\u4e0d\u4f1a\u544a\u8bc9\u4f60 Spec \u7684\u5173\u952e\u662f\u5b9a\u4e49\u4e0d\u53d8\u91cf\uff0c\u5982\u679c\u4e0d\u53d8\u91cf\u5b9a\u4e49\u4e0d\u5b8c\u5907\uff0c\u6216\u8005\u5b9a\u4e49\u51fa\u9519\uff0c\u90a3\u4e48\u8bc1\u660e\u5c31\u662f\u65e0\u6548\u7684\u3002\u56e0\u6b64\uff0c\u6211\u8ba4\u4e3a\u5f62\u5f0f\u5316\u9a8c\u8bc1\u7684\u610f\u4e49\u5728\u4e8e\u8ba9\u5de5\u7a0b\u5e08\u5728\u5199\u4ee3\u7801\u4e4b\u524d\u63d0\u9ad8\u4fe1\u5fc3\uff0c\u5728\u5199\u8bc1\u660e\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u80fd\u66f4\u52a0\u6df1\u5bf9\u7b97\u6cd5\u7684\u7406\u89e3\uff0c\u6b64\u5916\uff0c\u5982\u679c\u5728 TLC Checker \u91cc\u5c31\u8dd1\u51fa\u5f02\u5e38\uff0c\u90a3\u5c31\u66f4\u597d\u4e86\u3002<\/p>\n

\u76ee\u524d PingCAP \u5e94\u8be5\u662f\u56fd\u5185\u552f\u4e00\u4e00\u4e2a\u4f7f\u7528 TLA+ \u8bc1\u660e\u5173\u952e\u7b97\u6cd5\uff0c\u5e76\u4e14\u5c06\u8bc1\u660e\u7684 Spec \u5f00\u6e90\u51fa\u6765\u7684\u516c\u53f8\uff0c\u5927\u5bb6\u53ef\u4ee5\u53c2\u8003 pingcap\/tla-plus \u8fd9\u4e2a Repo\u3002<\/p>\n

Chaos Engineering<\/strong><\/div>\n

\u5982\u679c\u5b8c\u7f8e\u7684\u8bc1\u660e\u4e0d\u5b58\u5728\uff0c\u90a3\u4e48 Deterministic \u7684\u6d4b\u8bd5\u5b58\u5728\u5417\uff1f\u6211\u8bb0\u5f97\u5927\u6982 2015 \u5e74\u5728 PingCAP \u6210\u7acb\u524d\uff0c\u6211\u770b\u5230\u4e86\u4e00\u4e2a FoundationDB \u5173\u4e8e\u4ed6\u4eec\u7684 Deterministic \u6d4b\u8bd5\u7684 \u6f14\u8bb2\u3002\u7b80\u5355\u6765\u8bf4\u4ed6\u4eec\u7528\u81ea\u5df1\u7684 IO \u5904\u7406\u548c\u591a\u4efb\u52a1\u5904\u7406\u6846\u67b6 Flow \u5c06\u4ee3\u7801\u903b\u8f91\u548c\u64cd\u4f5c\u7cfb\u7edf\u7684\u7ebf\u7a0b\u4ee5\u53ca IO \u64cd\u4f5c\u89e3\u8026\uff0c\u5e76\u901a\u8fc7\u96c6\u7fa4\u6a21\u62df\u5668\u505a\u5230\u4e86\u767e\u5206\u4e4b\u767e\u91cd\u73b0 Bug \u51fa\u73b0\u65f6\u7684\u4e8b\u4ef6\u987a\u5e8f\uff0c\u540c\u65f6\u53ef\u4ee5\u5728\u6a21\u62df\u5668\u4e2d\u7cbe\u786e\u6a21\u62df\u5404\u79cd\u5f02\u5e38\uff0c\u786e\u5b9e\u5f88\u5b8c\u7f8e\u3002\u4f46\u662f\u8003\u8651\u5230\u73b0\u5b9e\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u5f53\u65f6\u9009\u62e9\u4f7f\u7528\u7684\u7f16\u7a0b\u8bed\u8a00\u4e3b\u8981\u662f Go\uff0c\u5f88\u96be\u6216\u8005\u6ca1\u6709\u5fc5\u8981\u505a\u7c7b\u4f3c Flow \u7684\u4e8b\u60c5 \u3002\u6240\u4ee5\u6211\u4eec\u9009\u62e9\u4e86\u4ece\u53e6\u4e00\u4e2a\u65b9\u5411\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u63d0\u5347\u5206\u5e03\u5f0f\u73af\u5883\u4e0b Bug \u7684\u590d\u73b0\u7387\uff0c\u80fd\u65b9\u4fbf\u590d\u73b0\u7684 Bug \u5c31\u80fd\u597d\u89e3\u51b3\uff0c\u8fd9\u4e2a\u601d\u8def\u4e5f\u662f\u6700\u8fd1\u51e0\u5e74\u5f88\u706b\u7684 Chaos Engineering\u3002\u505a Chaos Engineering \u7684\u51e0\u4e2a\u5173\u952e\u70b9\uff1a<\/p>\n

\u5b9a\u4e49\u7a33\u6001\uff0c\u8bb0\u5f55\u6b63\u5e38\u73af\u5883\u4e0b\u7684 workload \u4ee5\u53ca\u5173\u6ce8\u7684\u91cd\u8981\u6307\u6807\u3002<\/p>\n

\u5b9a\u4e49\u7cfb\u7edf\u7a33\u6001\u540e\uff0c\u6211\u4eec\u5206\u4e3a\u5b9e\u9a8c\u7ec4\u548c\u5bf9\u7167\u7ec4\u8fdb\u884c\u5b9e\u9a8c\uff0c\u786e\u8ba4\u5728\u7406\u60f3\u7684\u786c\u4ef6\u60c5\u51b5\u4e0b\uff0c\u65e0\u8bba\u5982\u4f55\u64cd\u4f5c\u5b9e\u9a8c\u7ec4\uff0c\u6700\u540e\u90fd\u4f1a\u56de\u5f52\u7a33\u6001\u3002<\/p>\n

\u5f00\u59cb\u5bf9\u5e95\u5c42\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c\u7f51\u7edc\u8fdb\u884c\u7834\u574f\uff0c\u518d\u91cd\u590d\u5b9e\u9a8c\uff0c\u89c2\u5bdf\u5b9e\u9a8c\u7ec4\u4f1a\u4e0d\u4f1a\u56de\u5f52\u7a33\u6001\u3002<\/p>\n

\u9053\u7406\u5927\u5bb6\u90fd\u61c2\uff0c\u4f46\u662f\u5b9e\u9645\u505a\u8d77\u6765\u6700\u5927\u7684\u95ee\u9898\u5728\u4e8e\u5982\u4f55\u5c06\u6574\u4e2a\u6d41\u7a0b\u81ea\u52a8\u5316\u3002\u539f\u56e0\u5728\u4e8e\uff1a\u4e00\u662f\u9760\u624b\u52a8\u7684\u6548\u7387\u5f88\u4f4e\uff1b\u4e8c\u662f\u6b63\u7edf\u7684 Chaos Engineering \u5f3a\u8c03\u7684\u662f\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u64cd\u4f5c\uff0c\u5982\u4f55\u63a7\u5236\u7206\u70b8\u534a\u5f84\uff0c\u8fd9\u4e5f\u662f\u4e2a\u6bd4\u8f83\u91cd\u8981\u7684\u95ee\u9898\u3002<\/p>\n

\u5148\u8bf4\u7b2c\u4e00\u4e2a\u95ee\u9898\uff0cPingCAP \u5728\u5b9e\u8df5 Chaos Engineering \u7684\u521d\u671f\uff0c\u90fd\u662f\u5728\u7269\u7406\u673a\u4e0a\u901a\u8fc7\u811a\u672c\u542f\u505c\u670d\u52a1\uff0c\u6240\u6709\u5b9e\u9a8c\u90fd\u9700\u8981\u624b\u52a8\u5b8c\u6210\uff0c\u8017\u65f6\u4e14\u975e\u5e38\u4f4e\u6548\uff0c\u5728\u8d44\u6e90\u5229\u7528\u4e0a\u4e5f\u5341\u5206\u4e0d\u5408\u7406\u3002\u8fd9\u4e2a\u95ee\u9898\u6211\u4eec\u89c9\u5f97\u6b63\u597d\u662f K8s \u975e\u5e38\u64c5\u957f\u7684\uff0c\u4e8e\u662f\u6211\u4eec\u5f00\u53d1\u4e86\u4e00\u4e2a\u57fa\u4e8e K8s \u7684\uff0c\u5185\u90e8\u79f0\u4e3a Schrodinger \u7684\u81ea\u52a8\u5316\u6d4b\u8bd5\u5e73\u53f0\uff0c\u5c06 TiDB \u96c6\u7fa4\u7684\u542f\u505c\u955c\u50cf\u5316\uff0c\u53e6\u5916\u5c06 TiDB \u672c\u8eab\u7684 CI\/CD\uff0c\u81ea\u52a8\u5316\u6d4b\u8bd5\u7528\u4f8b\u7684\u7ba1\u7406\u3001Fault Injection \u90fd\u7edf\u4e00\u4e86\u8d77\u6765\u3002\u8fd9\u4e2a\u9879\u76ee\u8fd8\u50ac\u751f\u51fa\u4e00\u4e2a\u597d\u73a9\u7684\u5b50\u9879\u76ee Chaos Operator\uff1a\u6211\u4eec\u901a\u8fc7 CRD \u6765\u63cf\u8ff0 Chaos \u7684\u7c7b\u578b\uff0c\u7136\u540e\u5728\u4e0d\u540c\u7684\u7269\u7406\u8282\u70b9\u4e0a\u542f\u52a8\u4e00\u4e2a DaemonSets\uff0c\u8fd9\u4e2a DaemonSets \u5c31\u8d1f\u8d23\u5e72\u6270 Pod\uff0c\u5f80\u5bf9\u5e94\u7684 Pod \u91cc\u9762\u6ce8\u5165\u4e00\u4e2a Sidecar\uff0cSidecar \u5e2e\u6211\u4eec\u8fdb\u884c\u6ce8\u5165\u9519\u8bef\uff08\u4f8b\u5982\u4f7f\u7528 Fuse \u6765\u6a21\u62df IO \u5f02\u5e38\uff0c\u4fee\u6539 iptable \u5236\u9020\u7f51\u7edc\u9694\u79bb\u7b49\uff09\uff0c\u7834\u574f Pod\u3002\u8fd1\u671f\u6211\u4eec\u4e5f\u6709\u8ba1\u5212\u5c06 Chaos Operator \u5f00\u6e90\u3002<\/p>\n

\u7b2c\u4e8c\u4e2a\u95ee\u9898\uff0c\u5176\u5b9e\u5728\u6211\u770b\u6765\uff0c\u6709 Chaos Engineering \u4ecd\u7136\u8fd8\u662f\u4e0d\u591f\u7684\uff0c\u6211\u4eec\u5728\u957f\u65f6\u95f4\u7684\u5bf9\u6d4b\u8bd5\u548c\u8d28\u91cf\u7684\u7814\u7a76\u4e2d\u53d1\u73b0\u63d0\u5347\u6d4b\u8bd5\u8d28\u91cf\u7684\u5173\u952e\u662f\u5982\u4f55\u53d1\u73b0\u66f4\u591a\u7684\u6d4b\u8bd5 workload\u3002\u5728\u65e9\u671f\u6211\u4eec\u5927\u91cf\u4f9d\u8d56\u4e86 MySQL \u548c\u76f8\u5173\u793e\u533a\u7684\u96c6\u6210\u6d4b\u8bd5\uff0c\u6570\u91cf\u5927\u6982\u5343\u4e07\u7ea7\u522b\uff0c\u8fd9\u4e2a\u51b3\u5b9a\u8ba9\u6211\u4eec\u5728\u5feb\u901f\u8fed\u4ee3\u7684\u540c\u65f6\u4fdd\u8bc1\u8d28\u91cf\uff0c\u4f46\u662f\u5373\u4f7f\u8fd9\u6837\u8fd8\u662f\u4e0d\u591f\u7684\uff0c\u6211\u4eec\u4e5f\u5728\u4ece\u5b66\u672f\u754c\u5bfb\u6c42\u7b54\u6848. \u4f8b\u5982\u5f15\u5165\u5e76\u901a\u8fc7\u5b98\u65b9\u7684 Jepsen Test \uff0c\u518d\u4f8b\u5982\u901a\u8fc7 SQLfuzz \u81ea\u52a8\u751f\u6210\u5408\u6cd5 SQL \u7684\u8bed\u53e5\u52a0\u5165\u5230\u6d4b\u8bd5\u96c6\u4e2d\u3002<\/p>\n

\u603b\u4e4b\uff0c\u6bd4\u8d77\u5199\u4e1a\u52a1\u903b\u8f91\uff0c\u5728\u5206\u5e03\u5f0f\u73af\u5883\u4e0b\u5199\u6d4b\u8bd5 + \u5199\u6d4b\u8bd5\u6846\u67b6\u82b1\u8d39\u7684\u7cbe\u529b\u53ef\u80fd\u4e00\u70b9\u90fd\u4e0d\u5c11\uff0c\u751a\u81f3\u53ef\u80fd\u591a\u5f88\u591a\uff08\u5982\u679c\u5c31\u4ece\u4ee3\u7801\u91cf\u6765\u8bf4\uff0cTiDB \u7684\u6d4b\u8bd5\u76f8\u5173\u7684\u4ee3\u7801\u884c\u6570\u53ef\u80fd\u6bd4\u5185\u6838\u4ee3\u7801\u884c\u6570\u591a\u4e00\u4e2a\u6570\u91cf\u7ea7\uff09\uff0c\u800c\u4e14\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u503c\u5f97\u7814\u7a76\u548c\u6295\u8d44\u7684\u9886\u57df\u3002\u53e6\u5916\u4e00\u4e2a\u95ee\u9898\u662f\u5982\u4f55\u901a\u8fc7\u6d4b\u8bd5\u53d1\u73b0\u6027\u80fd\u56de\u9000\u3002\u6211\u4eec\u7684\u6d4b\u8bd5\u5e73\u53f0\u4e2d\u6bcf\u5929\u8fd0\u884c\u7740\u4e00\u4e2a\u540d\u4e3a benchbot \u7684\u673a\u5668\u4eba\uff0c\u6bcf\u5929\u7684\u56de\u5f52\u6d4b\u8bd5\u90fd\u4f1a\u81ea\u52a8\u8dd1\u6027\u80fd\u6d4b\u8bd5\uff0c\u5bf9\u6bd4\u6bcf\u65e5\u7684\u7ed3\u679c\u3002\u8fd9\u6837\u4e00\u6765\u6211\u4eec\u7684\u5de5\u7a0b\u5e08\u5c31\u80fd\u5f88\u5feb\u77e5\u9053\u54ea\u4e9b\u53d8\u66f4\u5bfc\u81f4\u4e86\u6027\u80fd\u4e0b\u964d\uff0c\u4ee5\u53ca\u5f97\u5230\u4e00\u4e2a\u957f\u671f\u6027\u80fd\u53d8\u5316\u8d8b\u52bf\u3002<\/p>\n

eBPF<\/strong><\/div>\n

\u8bf4\u5b8c\u6d4b\u8bd5\uff0c\u53e6\u5916\u4e00\u4e2a\u76f8\u5173\u7684\u8bdd\u9898\u662f profiling \u548c\u5206\u5e03\u5f0f tracing\u3002tracing \u770b\u770b Google \u7684 Dapper \u548c\u5f00\u6e90\u5b9e\u73b0 OpenTracing \u5c31\u5927\u6982\u80fd\u7406\u89e3\uff0c\u6240\u4ee5\uff0c\u6211\u91cd\u70b9\u804a\u804a profiling\u3002\u6700\u8fd1\u8fd9\u51e0\u5e74\u6211\u5173\u6ce8\u7684\u6bd4\u8f83\u591a\u7684\u662f eBPF (extended BPF) \u6280\u672f\u3002\u60f3\u8c61\u4e0b\uff0c\u8fc7\u53bb\u6211\u4eec\u5982\u679c\u8981\u5f00\u53d1\u4e00\u4e2a TCP filter\uff0c\u8981\u4e48\u5c31\u81ea\u5df1\u5199\u4e00\u4e2a\u5185\u6838\u9a71\u52a8\uff0c\u8981\u4e48\u5c31\u7528 libpcap \u4e4b\u7c7b\u7684\u57fa\u4e8e\u4f20\u7edf BPF \u7684\u5e93\uff0c\u800c\u4f20\u7edf BPF \u53ea\u662f\u9488\u5bf9\u5305\u8fc7\u6ee4\u8fd9\u4e2a\u573a\u666f\u8bbe\u8ba1\u7684\u865a\u62df\u673a\uff0c\u5f88\u96be\u5b9a\u5236\u548c\u6269\u5c55\u3002<\/p>\n

\"\"<\/p>\n

\"\"<\/p>\n

\u5728\u8fd9\u4e2a\u80cc\u666f\u4e0b\uff0ceBPF \u5e94\u8fd0\u800c\u751f\uff0ceBPF \u5f15\u5165\u4e86 JIT \u548c\u5bc4\u5b58\u5668\uff0c\u5c06 BPF \u7684\u529f\u80fd\u8fdb\u4e00\u6b65\u6269\u5145\uff0c\u8fd9\u80cc\u540e\u7684\u610f\u4e49\u662f\uff0c\u6211\u4eec\u5728\u5185\u6838\u4e2d\u6709\u4e00\u4e2a\u5b89\u5168\u7684\u3001\u9ad8\u6027\u80fd\u7684\u3001\u57fa\u4e8e\u4e8b\u4ef6\u7684\u3001\u652f\u6301 JIT \u7684\u5b57\u8282\u7801\u7684\u865a\u62df\u673a\uff01\u8fd9\u5176\u5b9e\u6781\u5927\u5730\u964d\u4f4e\u4e86\u62d3\u5c55\u5185\u6838\u80fd\u529b\u7684\u95e8\u69db\uff0c\u6211\u4eec\u53ef\u4ee5\u4e0d\u7528\u62c5\u5fc3\u5728\u9a71\u52a8\u4e2d\u5199\u4e2a\u5f02\u5e38\u628a\u5185\u6838\u641e\u5d29\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5c06\u7ed9 llvm \u7528\u7684 clang \u76f4\u63a5\u7f16\u8bd1\u6210 eBPF \u5bf9\u8c61\uff0c\u793e\u533a\u8fd8\u6709\u7c7b\u4f3c bcc \u8fd9\u6837\u7684\u57fa\u4e8e Python \u7684\u5b9e\u7528\u5de5\u5177\u96c6\u2026\u2026<\/p>\n

\u8fc7\u53bb\u5176\u5b9e\u5927\u5bb6\u662f\u4ece\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\u3001\u9632\u706b\u5899\u8fd9\u4e2a\u89d2\u5ea6\u8ba4\u8bc6 eBPF \u7684\u3002\u6ca1\u9519\uff0c\u6027\u80fd\u76d1\u63a7\u4ee5\u53ca\u9632\u706b\u5899\u786e\u5b9e\u662f\u76ee\u524d eBPF \u7684\u738b\u724c\u573a\u666f\uff0c\u4f46\u662f\u6211\u5927\u80c6\u5730\u9884\u6d4b\u672a\u6765\u4e0d\u6b62\u4e8e\u6b64\uff0c\u5c31\u50cf\u6700\u8fd1 Brendan Gregg \u5728\u4ed6\u7684 blog \u91cc\u558a\u51fa\u7684\u53e3\u53f7\uff1aBPF is a new type of software\u3002\u53ef\u80fd\u5728\u4e0d\u4e45\u7684\u672a\u6765\uff0ceBPF \u793e\u533a\u80fd\u8bde\u751f\u51fa\u66f4\u591a\u597d\u73a9\u7684\u4e1c\u897f\uff0c\u4f8b\u5982\u6211\u4eec\u80fd\u4e0d\u80fd\u7528 eBPF \u6765\u505a\u4e2a\u8d85\u9ad8\u6027\u80fd\u7684 web server\uff1f\u80fd\u4e0d\u80fd\u505a\u4e2a CDN \u52a0\u901f\u5668\uff1f\u80fd\u4e0d\u80fd\u7528 BPF \u6765\u91cd\u5b9a\u4e49\u64cd\u4f5c\u7cfb\u7edf\u7684\u8fdb\u7a0b\u8c03\u5ea6\uff1f\u6211\u559c\u6b22 eBPF \u7684\u53e6\u4e00\u4e2a\u91cd\u8981\u539f\u56e0\u662f\uff0c\u7b2c\u4e00\u6b21\u5185\u6838\u5e94\u7528\u5f00\u53d1\u8005\u53ef\u4ee5\u65e0\u89c6\u5185\u6838\u7684\u7c7b\u578b\u548c\u7248\u672c\uff0c\u53ea\u8981\u5185\u6838\u80fd\u591f\u8fd0\u884c eBPF bytecode \u5c31\u53ef\u4ee5\u4e86\uff0c\u771f\u6b63\u505a\u5230\u4e86\u4e00\u6b21\u7f16\u8bd1\uff0c\u5404\u4e2a\u5185\u6838\u8fd0\u884c\u3002\u6240\u4ee5\u6709\u4e00\u79cd\u8bf4\u6cd5\u662f BPF is eating Linux\uff0c\u4e5f\u4e0d\u662f\u6ca1\u6709\u9053\u7406 \u3002<\/p>\n

PingCAP \u4e5f\u5df2\u7ecf\u9ed8\u9ed8\u5730\u5728 BPF \u793e\u533a\u6295\u5165\u4e86\u5f88\u957f\u65f6\u95f4\uff0c\u6211\u4eec\u4e5f\u5c06\u81ea\u5df1\u505a\u7684\u4e00\u4e9b bcc \u5de5\u5177\u5f00\u6e90\u4e86\uff0c\u8be6\u60c5\u53ef\u4ee5\u53c2\u8003 pingcap\/kdt \u8fd9\u4e2a repo\u3002\u5176\u4e2d\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0c\u6211\u4eec\u7684 bcc \u5de5\u5177\u4e4b\u4e00 drsnoop \u88ab Brendan Gregg \u7684\u65b0\u4e66\u6536\u5f55\u4e86\uff0c\u4e5f\u7b97\u662f\u4e3a\u793e\u533a\u505a\u51fa\u4e86\u4e00\u70b9\u5fae\u5c0f\u7684\u8d21\u732e\u3002<\/p>\n

\u4e0a\u9762\u804a\u7684\u5f88\u591a\u4e1c\u897f\u90fd\u662f\u5177\u4f53\u7684\u6280\u672f\uff0c\u6280\u672f\u7684\u843d\u5730\u79bb\u4e0d\u5f00\u90e8\u7f72\u548c\u8fd0\u7ef4\uff0c\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u7279\u6027\u51b3\u5b9a\u4e86\u7ef4\u62a4\u7684\u590d\u6742\u5ea6\u6bd4\u5355\u673a\u7cfb\u7edf\u5927\u5f97\u591a\u3002\u5728\u8fd9\u4e2a\u80cc\u666f\u4e4b\u4e0b\uff0c\u6211\u8ba4\u4e3a\u89e3\u6cd5\u53ef\u80fd\u662f\uff1a\u4e0d\u53ef\u53d8\u57fa\u7840\u8bbe\u65bd\u3002<\/p>\n

\u4e91\u548c\u5bb9\u5668\u7684\u666e\u53ca\u8ba9 infrastructure as code \u7684\u7406\u5ff5\u5f97\u4ee5\u53d8\u6210\u73b0\u5b9e\uff0c\u901a\u8fc7\u63cf\u8ff0\u5f0f\u7684\u8bed\u8a00\u6765\u521b\u5efa\u53ef\u91cd\u590d\u7684\u90e8\u7f72\u4f53\u9a8c\uff0c\u8fd9\u6837\u53ef\u91cd\u7528\u7684\u63cf\u8ff0\u5176\u5b9e\u5f88\u65b9\u4fbf\u5728\u5f00\u6e90\u793e\u533a\u5171\u4eab\uff0c\u800c\u4e14\u7531\u4e8e\u8fd9\u4e9b\u63cf\u8ff0\u51e0\u4e4e\u662f\u548c\u5177\u4f53\u7684\u4e91\u7684\u5b9e\u73b0\u65e0\u5173\uff0c\u5bf9\u4e8e\u8de8\u4e91\u90e8\u7f72\u548c\u6df7\u5408\u6570\u636e\u4e2d\u5fc3\u90e8\u7f72\u7684\u573a\u666f\u5f88\u9002\u5408\u3002\u6709\u4e9b\u90e8\u7f72\u5de5\u5177\u751a\u81f3\u8bde\u751f\u51fa\u81ea\u5df1\u7684\u751f\u6001\u7cfb\u7edf\uff0c\u4f8b\u5982 Terraform \/ Chef \/ Ansible\u3002\u6709\u4e00\u79cd\u8bf4\u6cd5\u620f\u79f0\u73b0\u5728\u7684\u8fd0\u7ef4\u5de5\u7a0b\u5e08\u90fd\u662f yaml \u8bed\u8a00\u5de5\u7a0b\u5e08\uff0c\u5176\u5b9e\u5f88\u6709\u9053\u7406\u7684\uff1a\u4eba\u603b\u662f\u4f1a\u51fa\u9519\uff0c\u4e14\u4f20\u7edf\u7684\u57fa\u4e8e shell \u811a\u672c\u7684\u8fd0\u7ef4\u90e8\u7f72\u53d7\u73af\u5883\u5f71\u54cd\u592a\u5927\uff0cshell \u5929\u7136\u4e5f\u4e0d\u662f\u4e00\u4e2a\u975e\u5e38\u4e25\u8c28\u7684\u8bed\u8a00\u3002\u63cf\u8ff0\u610f\u56fe\uff0c\u8ba9\u673a\u5668\u53bb\u5e72\u4e8b\u60c5\uff0c\u624d\u662f\u80fd scale \u7684\u6b63\u9053\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6211\u89c9\u5f97\u9762\u5bf9\u6d4b\u8bd5\u7684\u6001\u5ea6\u662f\u533a\u5206\u4e00\u4e2a\u666e\u901a\u7a0b\u5e8f\u5458\u548c\u4f18\u79c0\u7a0b\u5e8f\u5458\u7684\u91cd\u8981\u6807\u51c6\u3002 \u73b0\u5982\u4eca\u6211\u4eec\u7684\u7a0b\u5e8f\u548c\u670d\u52a1\u8d8a\u6765\u8d8a\u5e9e\u5927\uff0c\u5149\u662f\u5355\u5143\u6d4b […]<\/p>\n","protected":false},"author":1479,"featured_media":172037,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-172034","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/172034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=172034"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/172034\/revisions"}],"predecessor-version":[{"id":172100,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/172034\/revisions\/172100"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/172037"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=172034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=172034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=172034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}