{"id":335737,"date":"2023-10-12T09:58:26","date_gmt":"2023-10-12T01:58:26","guid":{"rendered":"https:\/\/www.idc.net\/help\/335737\/"},"modified":"2023-10-12T09:58:26","modified_gmt":"2023-10-12T01:58:26","slug":"%e6%80%a7%e8%83%bd%e6%8c%87%e6%a0%87%e7%9a%84%e4%bf%a1%e4%bb%b0%e5%8d%b1%e6%9c%ba","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/335737\/","title":{"rendered":"\u6027\u80fd\u6307\u6807\u7684\u4fe1\u4ef0\u5371\u673a"},"content":{"rendered":"<p>\u6b63\u5728\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\u7684\u4f60\uff0c\u6216\u591a\u6216\u8005\u63a5\u89e6\u8fc7\u524d\u7aef\u6027\u80fd\u4f18\u5316\uff0c\u8fd9\u6837\u7684\u63a5\u89e6\u53ef\u80fd\u662f\u6765\u81ea\u4f60\u7684\u9605\u8bfb\u4f53\u9a8c\u4e5f\u53ef\u80fd\u662f\u6765\u81ea\u5de5\u4f5c\u7ecf\u9a8c\u3002\u90a3\u6211\u4eec\u4e0d\u59a8\u4ece\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u601d\u60f3\u5b9e\u9a8c\u5f00\u59cb\uff0c\u8bf7\u4f60\u501f\u52a9\u4f60\u5bf9\u8fd9\u4e2a\u9886\u57df\u7684\u7406\u89e3\uff0c\u6765\u56de\u7b54\u4e0b\u9762\u7684\u51e0\u4e2a\u95ee\u9898\uff1a<\/p>\n<ul>\n<li>\u5047\u8bbe\u73b0\u5728\u7531\u4f60\u6765\u4e3b\u5bfc\u4e00\u9879\u4f18\u5316\u516c\u53f8\u7ad9\u70b9\u6027\u80fd\u7684\u5de5\u4f5c\uff0c\u4f60\u4f1a\u9009\u53d6\u54ea\u4e9b\u6307\u6807\u7528\u4e8e\u8861\u91cf\u6027\u80fd\uff1f<\/li>\n<li>\u5047\u8bbe\u4f60\u9009\u53d6\u4e86\u67d0\u4e2a\u6216\u8005\u67d0\u51e0\u4e2a\u6307\u6807\u7eb3\u5165\u5230\u76d1\u63a7\u7684\u8303\u7574\u5185\uff0c\u5f53\u9875\u9762\u6027\u80fd\u51fa\u73b0\u95ee\u9898\u65f6\uff0c\u4f60\u662f\u5426\u80fd\u901a\u8fc7\u5b83\u4eec\u53ca\u65f6\u53d1\u73b0\u95ee\u9898\uff1f<\/li>\n<li>\u5047\u8bbe\u4f60\u53d1\u73b0\u67d0\u4e2a\u9875\u9762\u7684\u6027\u80fd\u51fa\u73b0\u4e86\u95ee\u9898\u9700\u8981\u7acb\u523b\u4fee\u590d\uff0c\u8fd9\u51e0\u4e2a\u6307\u6807\u80fd\u5426\u5e2e\u52a9\u4f60\u5feb\u901f\u5b9a\u4f4d\u95ee\u9898\uff1f<\/li>\n<\/ul>\n<p>\u4e0d\u8981\u6709\u538b\u529b\uff0c\u4f60\u53ef\u4ee5\u6162\u6162\u601d\u8003\u5e76\u56de\u7b54\u8fd9\u51e0\u4e2a\u95ee\u9898\uff0c\u4f60\u5173\u4e8e\u7b2c\u4e00\u4e2a\u95ee\u9898\u7684\u7b54\u6848\u53ef\u80fd\u4f1a\u968f\u7740\u4e8c\u4e09\u95ee\u9898\u7684\u51fa\u73b0\u800c\u4e0d\u65ad\u7684\u8c03\u6574\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u7684\u76ee\u7684\u5c31\u662f\u5bf9\u4e0a\u9762\u4e09\u4e2a\u95ee\u9898\u7684\u63a2\u7d22\u548c\u5c1d\u8bd5\u6027\u7684\u89e3\u7b54\uff0c\u5e0c\u671b\u6211\u7684\u7b54\u6848\u80fd\u5e26\u7ed9\u4f60\u4e00\u4e9b\u542f\u53d1\u3002<\/p>\n<h3>\u4e00\u6b21\u590d\u76d8<\/h3>\n<p>\u76ee\u524d\u6211\u6240\u5728\u7684\u9879\u76ee\u4e0a\u957f\u65f6\u95f4\u90fd\u4f9d\u8d56\u90fd GA (Google Analytic) \u4f5c\u4e3a\u8861\u91cf\u9875\u9762\u6027\u80fd\u7684\u552f\u4e00\u5de5\u5177\uff0c\u5728 GA \u7684\u751f\u6001\u5708\u4e2d\uff0c\u6211\u4eec\u6700\u4e3a\u91cd\u89c6\u7684\u662f Avg Page Load Time (\u4ee5\u4e0b\u7b80\u79f0\u4e3a APLT)\uff0c\u901a\u8fc7\u5b83\u6765\u65ad\u5b9a\u6211\u4eec\u7ad9\u70b9\u5f53\u524d\u7684\u6027\u80fd\u72b6\u6001\u5982\u4f55\u3002<\/p>\n<p>\u4f46\u662f\u5728\u5b9a\u671f\u6536\u96c6\u8be5\u6307\u6807\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u53d1\u73b0\u7528\u6237\u7684\u611f\u53d7\u548c\u6570\u636e\u7684\u5c55\u793a\u53ef\u80fd\u5e76\u4e0d\u4e00\u81f4\uff0c\u5177\u4f53\u6765\u8bf4\u6570\u636e\u770b\u4e0a\u53bb\u6ce2\u6f9c\u4e0d\u60ca\uff0c\u4f46\u7528\u6237\u4f53\u9a8c\u5374\u76f4\u7ebf\u4e0b\u964d\u3002<\/p>\n<p>\u6240\u4ee5\u6211\u4eec\u4e0d\u5f97\u4e0d\u8981\u56de\u7b54\u4e00\u4e2a\u81f3\u5173\u91cd\u8981\u7684\u95ee\u9898\uff0cAPLT \u8861\u91cf\u7684\u7a76\u7adf\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>\u4ec0\u4e48\u8fd9\u4e2a\u95ee\u9898\u4e4b\u6240\u4ee5\u81f3\u5173\u91cd\u8981\uff0c\u662f\u56e0\u4e3a\u5b83\u7684\u7b54\u6848\u51b3\u5b9a\u6211\u4eec\u63a5\u4e0b\u6765\u8981\u89e3\u51b3\u7684\u95ee\u9898\u548c\u9700\u8981\u91c7\u53d6\u7684\u884c\u52a8\uff1a<\/p>\n<ul>\n<li>\u4e3a\u4ec0\u4e48 APLT \u8861\u91cf\u7684\u7ed3\u679c\u4e0e\u5ba2\u6237\u611f\u53d7\u5230\u7684\u4e0d\u4e00\u81f4\uff1f\u5dee\u8ddd\u5728\u54ea\u91cc\uff1f\u5dee\u8ddd\u6709\u591a\u5c11\uff1f<\/li>\n<li>\u6bcf\u5f53\u6570\u503c\u51fa\u73b0\u6ce2\u52a8\u65f6\uff0c\u6211\u4eec\u4f1a\u4e0b\u610f\u8bc6\u7684\u6000\u7591\u662f\u524d\u7aef\u811a\u672c\u62d6\u6162\u4e86\u6027\u80fd\uff0c\u4f46\u811a\u672c\u5bf9\u8fd9\u4e2a\u6307\u6807\u5f71\u54cd\u6709\u591a\u5c11\uff1f\u6211\u4eec\u7684\u6000\u7591\u662f\u5426\u6709\u9053\u7406\uff1f\u4ee5\u53ca\u662f\u5426\u5b58\u5728\u5176\u4ed6\u7684\u53ef\u80fd\u6027\uff1f<\/li>\n<li>\u5982\u679c APLT \u53d8\u6162\u4e86\uff1f\u6709\u54ea\u4e9b\u53ef\u80fd\u5bfc\u81f4 APLT \u53d8\u6162\uff1f\u8fd9\u51b3\u5b9a\u7740\u6211\u4eec\u6392\u67e5\u95ee\u9898\u7684\u65b9\u5411\u3002<\/li>\n<li>\u5982\u679c APLT \u4e0d\u591f\u51c6\u786e\uff0c\u6211\u4eec\u9700\u8981\u81ea\u5b9a\u4e49\u6307\u6807\u91cd\u65b0\u8861\u91cf\u6027\u80fd\u7ed3\u679c\uff0c\u6211\u4eec\u80fd\u4ece\u4e2d\u5438\u53d6\u4ec0\u4e48\u7ecf\u9a8c\uff1f\u6211\u4eec\u7684\u6307\u6807\u53ef\u5426\u4e0e APLT \u4ea7\u751f\u8054\u52a8\u4ea7\u751f\u4e00\u52a0\u4e00\u5927\u4e8e\u4e8c\u7684\u6548\u5e94\uff1f<\/li>\n<\/ul>\n<p>\u7136\u800c\u5b98\u65b9\u6587\u6863\u5bf9\u4e8e\u8fd9\u4e2a\u6307\u6807\u7684\u89e3\u91ca\u662f\u5f88\u66a7\u6627\u7684\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-bottom: 5px;padding-left: 1em;margin-left: 0px\">\n<p>Avg Page Load Time : The average amount of time (in seconds) it takes that page to load, from initiation of the pageview (e.g., click on a page link) to load completion in the browser.<\/p>\n<p>Avg. Page Load Time consists of two components: 1) network and server time, and 2) browser time. The Technical section of the Explorer tab provides details about the network and remaining time is the browser overhead for parsing and executing the JavaScript and rendering the page.<\/p>\n<\/blockquote>\n<p>\u5bf9\u4e8e\u5b83\u7684\u89e3\u91ca\uff0c\u6211\u4eec\u4ea7\u751f\u4e86\u51e0\u70b9\u7591\u95ee\uff1a<\/p>\n<ul>\n<li>\u201cload completion\u201d\u662f\u5982\u4f55\u88ab\u5b9a\u4e49\u7684\uff1f\u4e4b\u6240\u4ee5\u8981\u56de\u7b54\u8fd9\u4e2a\u95ee\u9898\u662f\u56e0\u4e3a\u5b83\u662f\u4f5c\u4e3a\u6307\u6807\u8861\u91cf\u7684\u7ec8\u70b9\u800c\u5b58\u5728\u3002<\/li>\n<li>server time \u4ec5\u4ec5\u5305\u542b\u4e00\u5207\u9759\u6001\u8d44\u6e90\u5417\uff1f\u5f02\u6b65\u8bf7\u6c42\u4f1a\u88ab\u8ba1\u7b97\u5728\u5185\u5417\uff1f<\/li>\n<\/ul>\n<h4>GA \u7684\u5b9e\u73b0<\/h4>\n<p>GA \u5e95\u5c42\u662f\u901a\u8fc7 Navigation Timing API \u5728\u91c7\u96c6\u6027\u80fd\u6570\u636e\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s6.\/oss\/202205\/02\/36d250d29145a5231dc236b4be79fe0cf95c31.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s8.\/oss\/202205\/02\/b99d95e06427e481fa68925866bc1e89ca61bb.png\" style=\"width: 420px;height: 251px\" class=\"aligncenter\"><\/p>\n<p>GA \u4e0d\u4f1a\u7edf\u8ba1\u6bcf\u4e00\u4e2a\u9636\u6bb5\u7684\u6570\u636e\uff0c\u5b83\u5c06\u67d0\u4e9b\u5408\u5e76\u540e\u91cd\u65b0\u547d\u540d\u6210\u65b0\u7684\u6307\u6807\uff0c\u800c\u5176\u4e2d\u7684\u67d0\u4e9b\u6307\u6807\u6bd4\u5982 Document Interactive Loaded \u5176\u5b9e\u662f\u67d0\u4e9b\u9636\u6bb5\u7684\u7edf\u8ba1\u4e4b\u548c\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s3.\/oss\/202205\/02\/97cd3f298af7bbdf60403354856f3be0585e2c.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s9.\/oss\/202205\/02\/94c9e3761c5554678fd619d04c8118eb21423d.png\" style=\"width: 420px;height: 157px\" class=\"aligncenter\"><\/p>\n<p>GA \u7edf\u8ba1\u7684\u4ec5\u4ec5\u662f\u4e0e DOM \u6587\u6863\u6709\u5173\u7684\u6570\u636e\u3002APLT \u5b9a\u4e49\u91cc\u6240\u8bf4\u7684 load completion \u65f6\u523b\u6307\u7684\u5c31\u662f loadEventEnd \u4e8b\u4ef6\u7684\u53d1\u751f\u65f6\u673a\uff0c\u5373 onLoad \u4e8b\u4ef6\u89e6\u53d1\u5b8c\u6bd5(load \u4e8b\u4ef6\u89e6\u53d1\u65f6\u610f\u5473\u7740\u6240\u6709\u7684\u5916\u90e8\u8d44\u6e90\uff0c\u5305\u62ec iframe\u3001\u56fe\u7247\u3001\u811a\u672c\u3001\u6837\u5f0f\u90fd\u5df2\u7ecf\u52a0\u8f7d\u5b8c\u6bd5)\u3002\u6240\u4ee5 APLT \u503c\u662f GA \u91cc\u6240\u6709\u6307\u6807\u91cc\u6a2a\u8de8\u65f6\u95f4\u8303\u56f4\u6700\u5e7f\u7684\u3002<\/p>\n<h4>\u811a\u672c\u5bf9 Avg Page Load Time \u7684\u5f71\u54cd\u662f\u4ec0\u4e48<\/h4>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/02\/77648fb1724e8e40cf9183f20ace6649f36415.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s4.\/oss\/202205\/02\/2237df3686b6bb298cb604f7aaebdd5dc18fcb.png\" style=\"width: 360px;height: 189px\" class=\"aligncenter\"><\/p>\n<p>\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u5f53\u6d4f\u89c8\u5668\u81ea\u4e0a\u800c\u4e0b\u89e3\u6790 DOM \u6811\u65f6\uff0c\u5b83\u4f1a\u9047\u89c1\u5f88\u591a\u5916\u8054\u8d44\u6e90\uff0c\u6bd4\u5982\u56fe\u7247\u3001\u6837\u5f0f\u548c\u811a\u672c\u3002\u4e8e\u662f\u5b83\u9700\u8981\u4ece\u7f13\u5b58\u6216\u8005\u7f51\u7edc\u4e2d\u8bf7\u6c42\u8fd9\u4e9b\u8d44\u6e90\u3002<\/p>\n<p>\u9875\u9762\u7684\u89e3\u6790\u662f\u540c\u6b65\u7684\uff0c\u6240\u4ee5\u811a\u672c\u7684\u52a0\u8f7d\u4f1a\u5bfc\u81f4\u9875\u9762\u89e3\u6790\u7684\u6682\u505c\u3002\u6d4f\u89c8\u5668\u9700\u8981\u5728\u811a\u672c\u52a0\u8f7d\u3001\u7f16\u8bd1\u3001\u6267\u884c\u5b8c\u6bd5\u4e4b\u540e\u624d\u4f1a\u7ee7\u7eed\u4e4b\u540e\u7684\u89e3\u6790\u5de5\u4f5c\uff0c\u8fd9\u4e48\u505a\u662f\u6709\u9053\u7406\u7684\uff0c\u56e0\u4e3a JavaScript \u53ef\u80fd\u4f1a\u4f7f\u7528\u8bf8\u5982 document.write() \u65b9\u6cd5\u6765\u6539\u53d8 DOM \u7684\u7ed3\u6784\u3002\u4f60\u53ef\u80fd\u542c\u8bf4\u8fc7\u5728 script \u6807\u7b7e\u4e0a\u6dfb\u52a0 async \u6216\u8005 defer \u5c5e\u6027\u6765\u5f02\u6b65\u7684\u52a0\u8f7d\u548c\u6267\u884c\u811a\u672c\u3002\u4f46\u662f\u5b83\u5728\u6211\u4eec\u7684\u4ea7\u54c1\u4e2d\u662f\u4e0d\u9002\u7528\u7684\uff0c\u56e0\u4e3a async \u65e0\u6cd5\u4fdd\u8bc1\u811a\u672c\u6267\u884c\u7684\u987a\u5e8f\u3002\u4f46\u8fd9\u5219\u65b9\u6848\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6240\u6709\u9875\u9762\uff0c\u56e0\u4e3a async \u65e0\u6cd5\u4fdd\u8bc1\u811a\u672c\u7684\u6267\u884c\u987a\u5e8f\uff0c\u5982\u679c\u4f60\u7684\u5e94\u7528\u5bf9\u811a\u672c\u7684\u6267\u884c\u987a\u5e8f\u6709\u4e25\u683c\u8981\u6c42\uff0c\u90a3\u4e48\u5b83\u5bf9\u4f60\u7231\u83ab\u80fd\u52a9\u3002<\/p>\n<p>\u76ee\u524d\u6d4f\u89c8\u5668\u90fd\u914d\u5907preloader\u673a\u5236\u6765\u63d0\u524d\u626b\u9762\u9875\u9762\u4e2d\u7684\u5916\u8054\u5143\u7d20\u63d0\u524d\u52a0\u8f7d\uff0c\u4f46\u8fd9\u4e2a\u673a\u5236\u5e76\u65e0\u7edf\u4e00\u7684\u6807\u51c6\u4e5f\u65e0\u6cd5\u8861\u91cf\u6548\u679c\uff0c\u6240\u4ee5\u6682\u65f6\u4e0d\u8003\u8651\u5b83\u5bf9\u6211\u4eec\u7684\u5f71\u54cd\u3002<\/p>\n<p>\u811a\u672c\u4e0b\u8f7d\u4e4b\u540e\u9700\u8981\u7ecf\u8fc7\u89e3\u6790(parse \/ compile)\u548c\u6267\u884c(run \/ execute)\u3002\u89e3\u6790\u9636\u6bb5\u9996\u5148\u5c06 javascript \u4ee3\u7801\u7f16\u8bd1\u4e3a\u673a\u5668\u8bed\u8a00\uff0c\u6267\u884c\u9636\u6bb5\u624d\u4f1a\u771f\u6b63\u7684\u8fd0\u884c\u6211\u4eec\u7f16\u5199\u7684\u4ee3\u7801\u3002\u811a\u672c\u7684\u89e3\u6790\u548c\u6267\u884c\u4e5f\u4f1a\u963b\u585e\u9875\u9762\u7684\u89e3\u6790<\/p>\n<p>\u6240\u4ee5\u7efc\u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u51fa\u811a\u672c\u786e\u5b9e\u80fd\u591f\u5f71\u54cd APLT \u3002<\/p>\n<p>\u4f46\u629b\u5f03\u8ba1\u91cf\u8c08\u5371\u5bb3\u90fd\u662f\u5237\u6d41\u6c13\uff0c\u5b83\u7684\u5f71\u54cd\u8303\u56f4\u7a76\u7adf\u6709\u591a\u5927?\u4e5f\u5c31\u662f\u8bf4\u5982\u679c APLT \u662f 2 \u79d2\u7684\u8bdd\uff0c\u5176\u4e2d\u591a\u5c11\u65f6\u95f4\u8017\u8d39\u5728\u4e86\u811a\u672c\u4e0a\uff1f<\/p>\n<p>\u8fd9\u91cc\u6ca1\u6709\u4e00\u4e2a\u5177\u4f53\u7684\u6570\u5b57\uff0c\u4f46\u5b83\u4e0d\u5bb9\u5c0f\u89d1\uff0c\u4ee5\u53ca\u8db3\u591f\u5f71\u54cd\u5230\u6027\u80fd\u3002Addy Osmani \u5728 2017 \u5e74\u7684\u4e00\u7bc7\u6587\u7ae0\u4e2d\u6307\u51fa Chrome \u7684\u811a\u672c\u5f15\u64ce\u82b1\u8d39\u5728\u7f16\u8bd1\u65f6\u95f4\u4e0a\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s4.\/oss\/202205\/02\/532ea3525d613d009588522c671b419ee0a731.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s7.\/oss\/202205\/02\/673fe5e56a5c4ae21cb5707cc86c89530a6310.png\" style=\"width: 420px;height: 229px\" class=\"aligncenter\"><\/p>\n<p>\u867d\u7136\u6b64\u540e Chrome \u5bf9\u7f16\u8bd1\u8fc7\u7a0b\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u4f46\u6267\u884c\u811a\u672c\u8fc7\u957f\u7684\u56f0\u607c\u4f9d\u7136\u5b58\u5728\u3002\u540c\u65f6\u8fd9\u53ea\u662f Chrome \u4e0b\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u65e0\u6cd5\u786e\u8ba4\u5176\u4ed6\u6d4f\u89c8\u5668\u5728\u7f16\u8bd1\u811a\u672c\u65f6\u4e5f\u53ef\u4ee5\u4fdd\u8bc1\u540c\u6837\u7684\u6548\u7387<\/p>\n<p>\u5982\u679c\u8bf4 APLT \u662f\u7531\u4e0d\u540c\u7684\u9636\u6bb5\u7ec4\u6210\uff0c\u90a3\u4e48\u6211\u4eec\u6709\u6ca1\u6709\u53ef\u80fd\u8ba1\u7b97\u51fa\u6bcf\u4e00\u4e2a\u9636\u6bb5\u7684\u5177\u4f53\u65f6\u95f4\uff1f<\/p>\n<p>\u56de\u987e\u4e0a\u9762\u5173\u4e8e GA \u6307\u6807\u7684\u5b9a\u4e49\uff0c\u81f3\u5c11\u6211\u4eec\u73b0\u5728\u80fd\u5206\u79bb\u51fa server time \u548c browser time. \u4f46\u662f\u5728 browser time \u4e4b\u4e0b\u5462?\u6bd4\u5982\u8bf4\u811a\u672c\u7684\u4e0b\u8f7d\u65f6\u95f4\u548c\u6267\u884c\u65f6\u95f4\uff0c\u8fd9\u4e9b\u6211\u4eec\u5c31\u65e0\u4ece\u5f97\u77e5\u4e86\u3002\u8fd9\u4e9b\u662f\u9700\u8981\u989d\u5916\u8ba1\u7b97\u548c\u91c7\u96c6\u7684\u3002<\/p>\n<p>\u7efc\u4e0a\uff0c\u6211\u4eec\u5b8c\u5168\u4f9d\u8d56 APLT \u6765\u5bf9\u7ad9\u70b9\u7684\u6027\u80fd\u95ee\u9898\u8fdb\u884c\u8bca\u65ad\u662f\u4e0d\u9760\u8c31\uff0c\u6211\u4eec\u5355\u7eaf\u7684\u8ba4\u4e3a\u811a\u672c\u8d1f\u62c5\u62d6\u6162\u4e86\u6027\u80fd\u4e5f\u662f\u4e0d\u5b8c\u6574\u7684\u3002<\/p>\n<h4>\u4e00\u573a\u5173\u4e8e\u6307\u6807\u7684\u4fe1\u4ef0\u5371\u673a<\/h4>\n<p>\u6211\u60f3\u4f60\u5927\u6982\u660e\u767d\u4e86\u4e3a\u4ec0\u4e48\u6211\u5728\u4e0a\u4e00\u8282\u4e2d\u82b1\u4e86\u8fd9\u4e48\u5927\u6bb5\u7684\u7bc7\u5e45\u6765\u89e3\u91ca\u4ec5\u4ec5\u4e00\u4e2a\u6307\u6807\u7684\u542b\u4e49\u3002\u56e0\u4e3a\u4e00\u4e2a\u6307\u6807\u80fd\u900f\u9732\u7684\u4fe1\u606f\u53ef\u80fd\u4f1a\u6bd4\u4f60\u60f3\u8c61\u7684\u8981\u590d\u6742\uff0c\u5f15\u5bfc\u548c\u8bef\u5bfc\u5e76\u5b58\u3002<\/p>\n<p>\u9996\u5148\u8981\u58f0\u660e\u6211\u5e76\u4e0d\u53cd\u5bf9\u4f7f\u7528\u5e38\u89c1\u6307\u6807\uff0c\u8fd9\u7bc7\u6587\u7ae0\u4e5f\u4e0d\u662f\u5bf9\u5b83\u4eec\u7684\u6279\u8bc4\uff0c\u5b83\u4eec\u5728\u5e2e\u52a9\u6211\u4eec\u6392\u67e5\u6027\u80fd\u95ee\u9898\u65b9\u9762\u7ed9\u4e86\u975e\u5e38\u5927\u7684\u5e2e\u52a9\u3002\u5728\u8fd9\u91cc\u6211\u60f3\u63a2\u8ba8\u7684\u662f\uff0c\u5982\u679c\u5e38\u89c4\u6307\u6807\u662f\u6027\u80fd\u76d1\u63a7\u7684\u5e95\u7ebf\u7684\u8bdd\uff0c\u5b83\u7684\u4e0a\u9650\u5728\u54ea\uff1f<\/p>\n<p>\u4ece\u4e0a\u9762\u7684\u63cf\u8ff0\u4e2d\u6211\u4eec\u4e0d\u96be\u770b\u51fa APLT \u7684\u6d89\u730e\u7684\u7ef4\u5ea6\u8fc7\u4e8e\u5bbd\u6cdb\uff0c\u5b83\u66f4\u504f\u5411\u4e8e\u4e00\u4e2a\u6280\u672f\u5411\u7684\u7efc\u5408\u6027\u6307\u6807\uff0c\u5b83\u5c55\u793a\u7ed9\u6211\u4eec\u662f\u8d8b\u52bf\u800c\u975e\u7ec6\u8282\u3002\u8fd9\u6837\u5e26\u6765\u7684\u95ee\u9898\u6709\u4e24\u4e2a\uff1a<\/p>\n<ul>\n<li>\u6307\u6807\u6307\u6570\u4e0e\u5b9e\u9645\u7684\u4ea7\u54c1\u4f53\u9a8c\u4e0d\u7b26<\/li>\n<li>\u5b83\u65e0\u52a9\u4e8e\u6211\u4eec\u6392\u67e5\u5177\u4f53\u7684\u6027\u80fd\u95ee\u9898<\/li>\n<\/ul>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u6df1\u5165\u7684\u804a\u804a\u8fd9\u4e24\u4e2a\u95ee\u9898\u3002<\/p>\n<h4>\u4ee5\u7528\u6237\u4e3a\u4e2d\u5fc3<\/h4>\n<p>\u4f60\u6216\u8bb8\u6709\u7559\u610f\u5230\uff0c\u76ee\u524d\u524d\u7aef\u6027\u80fd\u76d1\u6d4b\u7684\u8d8b\u52bf\u9010\u6e10\u5728\u5411\u4ee5\u7528\u6237\u4e3a\u4e2d\u5fc3\u7684\u6307\u6807 (User-Centric Performance Metrics) \u9760\u62e2\u3002\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0\u8fd9\u6837\u7684\u60c5\u51b5?\u56e0\u4e3a\u968f\u7740\u5355\u9875\u9762\u5e94\u7528\u7684\u666e\u53ca\u4ee5\u53ca\u524d\u7aef\u529f\u80fd\u53d8\u201c\u91cd\u201d\uff0c\u7ecf\u5178\u7684\u4ee5\u8d44\u6e90\u4e3a\u4e2d\u5fc3\u7684\u6027\u80fd\u6307\u6807(\u4f8b\u5982 Onload, DOMContentLoaded)\u8d8a\u6765\u8d8a\u4e0d\u80fd\u51c6\u786e\u5730\u53cd\u9988\u771f\u5b9e\u7528\u6237\u7684\u4f53\u9a8c\u4e0e\u4ea7\u54c1\u6027\u80fd\u3002\u5728\u4f20\u7edf\u540e\u7aef\u6e32\u67d3\u7684\u591a\u9875\u9762\u5e94\u7528\u6a21\u5f0f\u4e0b\uff0c\u8d44\u6e90\u52a0\u8f7d\u5b8c\u6bd5\u5373\u610f\u5473\u7740\u9875\u9762\u5bf9\u7528\u6237\u53ef\u7528;\u800c\u5728\u5355\u9875\u9762\u6a21\u5f0f\u4e0b\uff0c\u8d44\u6e90\u52a0\u8f7d\u5b8c\u6bd5\u8ddd\u79bb\u4ea7\u54c1\u53ef\u7528\u5b58\u5728\u4e00\u5b9a\u7684\u5dee\u8ddd\uff0c\u56e0\u4e3a\u6b64\u65f6\u5e94\u7528\u624d\u80fd\u771f\u6b63\u5730\u8bf7\u6c42\u7528\u6237\u4e2a\u6027\u5316\u7684\u6570\u636e\uff0c\u6e32\u67d3\u5b9a\u5236\u5316\u7684\u9875\u9762\u3002<\/p>\n<p>\u603b\u7684\u6765\u8bf4\uff0c\u8d8a\u6765\u8d8a\u591a\u91cd\u8981\u4e14\u8017\u65f6\u7684\u5de5\u4f5c\u90fd\u53d1\u751f\u5728\u8d44\u6e90\u52a0\u8f7d\u4e4b\u540e\uff0c\u6211\u4eec\u9700\u8981\u628a\u8fd9\u90e8\u5206\u5de5\u4f5c\u7684\u6027\u80fd\u4e5f\u76d1\u63a7\u8d77\u6765\u3002<\/p>\n<p>\u597d\u6d88\u606f\u662f\u6d4f\u89c8\u5668\u539f\u751f\u7684\u5728\u63d0\u4f9b\u7ed9\u4e88\u6211\u4eec\u8fd9\u65b9\u9762\u7684\u652f\u6301\uff0c\u4f8b\u5982 Chrome \u5c31\u5728 Performace API \u4e2d\u63d0\u4f9b\u4e86 Paint Timing API \u8bf8\u5982 first paint (FP) \u3001 first contentful paint (FCP)\u3001time to interact(tti) \u7b49\u6307\u6807\u6570\u636e\u3002\u987e\u540d\u601d\u4e49\u7684\u8fd9\u4e9b\u6307\u6807\u5c1d\u8bd5\u7ad9\u5728\u7528\u6237\u4f53\u9a8c\u7684\u89c6\u89d2\u5c55\u73b0\u5e94\u7528\u5728\u6d4f\u89c8\u5668\u4e2d\u88ab\u5448\u73b0\u65f6\u7684\u6027\u80fd;\u574f\u6d88\u606f\u662f\uff0c\u8fd9\u4e9b\u6307\u6807\u4f9d\u7136\u5728\u6d4b\u91cf\u771f\u5b9e\u7684\u7528\u6237\u4f53\u9a8c\u65b9\u9762\u4f9d\u7136\u5b58\u5728\u8bef\u5dee\u3002<\/p>\n<p>\u5c31\u4ee5\u4e0a\u9762\u63d0\u5230\u7684 FP\u3001FCP\u3001TTI \u8fd9\u4e09\u4e2a\u6307\u6807\u4e3a\u4f8b\uff0c\u6211\u7528\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u8bf4\u660e\u8fd9\u4e09\u4e2a\u6307\u6807\u662f\u5982\u4f55\u4e0d\u591f\u51c6\u786e\u7684\uff1a\u5728\u5355\u9875\u9762\u7684\u521d\u59cb\u5316\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u901a\u5e38\u4f1a\u63d0\u4f9b\u7c7b\u4f3c\u4e8e\u300c\u52a0\u8f7d\u4e2d\u300d\u89c6\u56fe\uff0c\u901a\u5e38\u662f\u4e00\u4e2a placeholder \u6216\u8005 skeleton \u6837\u5f0f\uff0c\u5728\u6570\u636e\u8bf7\u6c42\u5b8c\u6bd5\u4e4b\u540e\u624d\u4f1a\u5c06\u5b9e\u9645\u7684\u89c6\u56fe\u6e32\u67d3\u51fa\u6765\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/02\/c3f004c7199c932b70110908fdc6a0150af4ac.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s3.\/oss\/202205\/02\/54b898c32912a1762d48624744b25d9f5d2792.png\" style=\"width: 360px;height: 74px\" class=\"aligncenter\"><\/p>\n<p>\u5982\u679c\u52a0\u8f7d\u65f6\u95f4\u8fc7\u957f\uff0c\u6d4f\u89c8\u5668\u4f1a\u4ee5\u4e3a\u300c\u52a0\u8f7d\u4e2d\u300d\u89c6\u56fe\u5c31\u662f\u5bf9\u7528\u6237\u53ef\u7528\u7684\u6700\u7ec8\u4ea7\u54c1\u5f62\u6001\uff0c\u5e76\u4ee5\u5b83\u4e3a\u57fa\u51c6\u8ba1\u7b97\u90a3\u4e0a\u8ff0\u7684\u4e09\u4e2a\u6307\u6807\u3002<\/p>\n<p>\u4e0b\u9762\u8fd9\u6bb5\u4ee3\u7801\u6a21\u62df\u7684\u5c31\u662f\u5305\u542b\u4e0a\u9762\u6240\u8bf4\u60c5\u51b5\u7684\u65e5\u5e38\u60c5\u51b5\uff1a\u5728\u7ec4\u4ef6\u52a0\u8f7d\u65f6\u6a21\u62df\u53d1\u51fa\u4e24\u4e2a\u8bf7\u6c42\uff0c\u5176\u4e2d\u4e00\u4e2a\u9700\u89815\u79d2\u8f83\u957f\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u53ea\u6709\u5f53\u4e24\u4e2a\u8bf7\u6c42\u90fd\u8fd4\u56de\u65f6\u624d\u80fd\u5f00\u59cb\u6e32\u67d3\u6570\u636e\uff0c\u5426\u5219\u4e00\u76f4\u63d0\u793a\u7528\u6237\u52a0\u8f7d\u4e2d\u3002<\/p>\n<pre><span style=\"margin: 0px;padding: 0px\">function<\/span> <span style=\"margin: 0px;padding: 0px\">App<\/span>() {<br>  <span style=\"margin: 0px;padding: 0px\">const<\/span> [<span style=\"margin: 0px;padding: 0px\">data<\/span>, <span style=\"margin: 0px;padding: 0px\">setState<\/span>] <span style=\"margin: 0px;padding: 0px\">=<\/span> <span style=\"margin: 0px;padding: 0px\">useState<\/span>([]);<br>  <span style=\"margin: 0px;padding: 0px\">useEffect<\/span>(() <span style=\"margin: 0px;padding: 0px\">=&gt;<\/span> {<br>    <span style=\"margin: 0px;padding: 0px\">const<\/span> <span style=\"margin: 0px;padding: 0px\">longRequest<\/span> <span style=\"margin: 0px;padding: 0px\">=<\/span> <span style=\"margin: 0px;padding: 0px\">new<\/span> <span style=\"margin: 0px;padding: 0px\">Promise<\/span>((<span style=\"margin: 0px;padding: 0px\">resolve<\/span>, <span style=\"margin: 0px;padding: 0px\">reject<\/span>) <span style=\"margin: 0px;padding: 0px\">=&gt;<\/span> {<br>      <span style=\"margin: 0px;padding: 0px\">setTimeout<\/span>(() <span style=\"margin: 0px;padding: 0px\">=&gt;<\/span> {<br>        <span style=\"margin: 0px;padding: 0px\">resolve<\/span>([]);<br>      }, <span style=\"margin: 0px;padding: 0px\">1000<\/span> <span style=\"margin: 0px;padding: 0px\">*<\/span> <span style=\"margin: 0px;padding: 0px\">5<\/span>)<br>    });<br>    <span style=\"margin: 0px;padding: 0px\">const<\/span> <span style=\"margin: 0px;padding: 0px\">shortRequest<\/span> <span style=\"margin: 0px;padding: 0px\">=<\/span> <span style=\"margin: 0px;padding: 0px\">Promise<\/span>.<span style=\"margin: 0px;padding: 0px\">resolve<\/span>([]);<br> <br>    <span style=\"margin: 0px;padding: 0px\">Promise<\/span>.<span style=\"margin: 0px;padding: 0px\">all<\/span>([<span style=\"margin: 0px;padding: 0px\">longRequest<\/span>, <span style=\"margin: 0px;padding: 0px\">shortRequest<\/span>]).<span style=\"margin: 0px;padding: 0px\">then<\/span>(([<span style=\"margin: 0px;padding: 0px\">longRequestResponse<\/span>, <span style=\"margin: 0px;padding: 0px\">shortRequestResponse<\/span>]) <span style=\"margin: 0px;padding: 0px\">=&gt;<\/span> {<br>      <span style=\"margin: 0px;padding: 0px\">setState<\/span>([<br>        [<span style=\"margin: 0px;padding: 0px\">''<\/span>, <span style=\"margin: 0px;padding: 0px\">'Tesla'<\/span>, <span style=\"margin: 0px;padding: 0px\">'Mercedes'<\/span>, <span style=\"margin: 0px;padding: 0px\">'Toyota'<\/span>, <span style=\"margin: 0px;padding: 0px\">'Volvo'<\/span>],<br>        [<span style=\"margin: 0px;padding: 0px\">'2019'<\/span>, <span style=\"margin: 0px;padding: 0px\">10<\/span>, <span style=\"margin: 0px;padding: 0px\">11<\/span>, <span style=\"margin: 0px;padding: 0px\">12<\/span>, <span style=\"margin: 0px;padding: 0px\">13<\/span>],<br>        [<span style=\"margin: 0px;padding: 0px\">'2020'<\/span>, <span style=\"margin: 0px;padding: 0px\">20<\/span>, <span style=\"margin: 0px;padding: 0px\">11<\/span>, <span style=\"margin: 0px;padding: 0px\">14<\/span>, <span style=\"margin: 0px;padding: 0px\">13<\/span>],<br>        [<span style=\"margin: 0px;padding: 0px\">'2021'<\/span>, <span style=\"margin: 0px;padding: 0px\">30<\/span>, <span style=\"margin: 0px;padding: 0px\">15<\/span>, <span style=\"margin: 0px;padding: 0px\">12<\/span>, <span style=\"margin: 0px;padding: 0px\">13<\/span>]<br>      ])<br>    })<br>  }, []);<br>  <span style=\"margin: 0px;padding: 0px\">return<\/span> (<br>    <span style=\"margin: 0px;padding: 0px\">&lt;<\/span><span style=\"margin: 0px;padding: 0px\">div<\/span> <span style=\"margin: 0px;padding: 0px\">className<\/span><span style=\"margin: 0px;padding: 0px\">=<\/span><span style=\"margin: 0px;padding: 0px\">\"App\"<\/span><span style=\"margin: 0px;padding: 0px\">&gt;<\/span><br>      {<span style=\"margin: 0px;padding: 0px\">data<\/span> <span style=\"margin: 0px;padding: 0px\">&amp;&amp;<\/span> <span style=\"margin: 0px;padding: 0px\">data<\/span>.<span style=\"margin: 0px;padding: 0px\">length<\/span><br>      <span style=\"margin: 0px;padding: 0px\">?<\/span> <span style=\"margin: 0px;padding: 0px\">&lt;<\/span><span style=\"margin: 0px;padding: 0px\">HotTable<\/span> <span style=\"margin: 0px;padding: 0px\">data<\/span><span style=\"margin: 0px;padding: 0px\">=<\/span>{<span style=\"margin: 0px;padding: 0px\">data<\/span>} <span style=\"margin: 0px;padding: 0px\">\/&gt;<\/span><br>      : <span style=\"margin: 0px;padding: 0px\">&lt;<\/span><span style=\"margin: 0px;padding: 0px\">Skeleton<\/span> <span style=\"margin: 0px;padding: 0px\">count<\/span><span style=\"margin: 0px;padding: 0px\">=<\/span>{<span style=\"margin: 0px;padding: 0px\">15<\/span>}<span style=\"margin: 0px;padding: 0px\">\/<\/span><span style=\"margin: 0px;padding: 0px\">&gt;<\/span>}<br>    <span style=\"margin: 0px;padding: 0px\">&lt;<\/span><span style=\"margin: 0px;padding: 0px\">\/div&gt;<\/span><br>  )<br>}<br><\/pre>\n<p>\u5982\u679c\u4f60\u5c1d\u8bd5\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\u4e0a\u8ff0 App, \u901a\u8fc7 Devtools \u89c2\u6d4b\u5230\u7684\u5404\u4e2a\u6307\u6807\u5982\u4e0b\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/02\/e545a8906820bae8ceb510b8d1e7a78a95327c.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/02\/44bafa1951c61655e7369053d876d530ec214f.png\" style=\"width: 360px;height: 293px\" class=\"aligncenter\"><\/p>\n<p>\u4f60\u80fd\u901a\u8fc7\u5f00\u53d1\u8005\u5de5\u5177\u591f\u89c2\u6d4b\u5230\u5404\u79cd\u6307\u6807\u6bd4\u5982 DCL (DOMContentLoaded Event), FP, FCP, FMP (first meaningful paint), L(Onload Event) \u90fd\u53d1\u751f\u5728\u9875\u9762\u52a0\u8f7d\u540e\u4e00\u79d2\u5de6\u53f3\u4ee5\u5185\u3002\u7136\u800c\u4ece\u4ee3\u7801\u91cc\u6211\u4eec\u975e\u5e38\u80af\u5b9a\u81f3\u5c11\u4e94\u79d2\u540e\u7528\u6237\u624d\u80fd\u770b\u5230\u771f\u5b9e\u5185\u5bb9\u3002\u6240\u4ee5\u4e0a\u8ff0\u6307\u6807\u5e76\u4e0d\u80fd\u771f\u7684\u53cd\u9988\u7528\u6237\u611f\u53d7\u5230\u7684\u6027\u80fd\u95ee\u9898<\/p>\n<p>\u6211\u5df2\u7ecf\u628a\u8fd9\u4e2a\u5e94\u7528\u90e8\u7f72\u5230\u4e86 https:\/\/cheat-web-page-test.com\/ \u7ad9\u70b9\u4e0a\uff0c\u53ef\u4ee5\u5728\u7ebf\u8bbf\u95ee\u3002\u5e76\u4e14\u53ef\u4ee5\u4f7f\u7528 https:\/\/www.webpagetest.org\/ \u5bf9\u5b83\u505a\u66f4\u8be6\u7ec6\u7684\u6027\u80fd\u68c0\u6d4b\uff0c\u4e5f\u4f1a\u5f97\u51fa\u548c devtools \u76f8\u540c\u7684\u7ed3\u679c\u3002webpagetest \u662f\u4e00\u4e2a\u5f00\u6e90\u514d\u8d39\u5bf9\u7f51\u7ad9\u6027\u80fd\u8fdb\u884c\u68c0\u6d4b\u7684\u5de5\u5177\u3002\u65e9\u5728 2012 \u5e74\u8fd8\u6ca1\u6709\u8bf8\u5982 FP \u4e00\u7c7b\u7684\u6307\u6807\u65f6\uff0c\u5b83\u72ec\u521b\u7684 Speed Index \u6307\u6807\u5c31\u80fd\u591f\u8861\u91cf\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/02\/38f0acf9891c37271c67224157ff56d5c40523.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s7.\/oss\/202205\/02\/f72d711508a9eb3feaf986a0e26c90db55b1cd.png\" style=\"width: 360px;height: 127px\" class=\"aligncenter\"><\/p>\n<p>\u603b\u7684\u6765\u8bf4\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u76ee\u524d\u6d4f\u89c8\u5668\u63d0\u4f9b\u7684 API \u80fd\u591f\u6d4b\u91cf\u7684\u53ea\u662f D \u9636\u6bb5\u7684\u6027\u80fd\uff0c\u5bf9 E \u548c F \u9636\u6bb5\u7231\u83ab\u80fd\u52a9\u3002<\/p>\n<p>\u8fd9\u53ea\u662f\u5176\u4e2d\u4e00\u4e2a\u8bf4\u660e\u539f\u751f\u6307\u6807\u4e0d\u591f\u51c6\u786e\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u5f52\u7eb3\u4e3a\u540e\u7aef\u63a5\u53e3\u5ef6\u8fdf\u8fc7\u957f\u3002\u7136\u800c\u8fd8\u6709\u4e00\u79cd\u60c5\u51b5\u662f\u524d\u7aef\u6e32\u67d3\u65f6\u95f4\u8fc7\u957f\u3002\u4f8b\u5982\u6211\u4eec\u5728\u4f7f\u7528 Handsontable \u7ec4\u4ef6\u6e32\u67d3\u4e0a\u5343\u884c\u6570\u636e\u8868\u683c\u7684\u65f6\u5019\uff0c\u751a\u81f3\u5bfc\u81f4\u4e86\u6d4f\u89c8\u5668\u7684\u5047\u6b7b\uff0c\u8fd9\u79cd\u573a\u666f\u5bf9 Paint Timing API \u4e5f\u662f\u514d\u75ab\u7684\u3002<\/p>\n<p>\u90a3 tti \u8fd9\u4e2a\u6307\u6807\u600e\u4e48\u6837?\u5b83\u4e0d\u662f\u542c\u4e0a\u53bb\u80fd\u591f\u68c0\u6d4b\u9875\u9762\u662f\u5426\u53ef\u4ee5\u4ea4\u4e92\u5417\uff1f\u5b83\u662f\u4e0d\u662f\u80fd\u591f\u68c0\u6d4b\u9875\u9762\u7684\u5047\u6b7b\uff1f<\/p>\n<p>\u5f88\u9057\u61be\u4f9d\u7136\u4e0d\u884c\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6709\u5fc3\u53bb\u67e5\u770b tti \u8fd9\u4e2a\u6307\u6807\u7684\u5b9a\u4e49\u7684\u8bdd\uff0c \u4f60\u4f1a\u53d1\u73b0 tti \u672c\u8d28\u4e0a\u662f\u4e00\u79cd\u7b97\u6cd5\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s3.\/oss\/202205\/02\/94af02346f57975a7f987636e0a6d949a2ebe8.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s8.\/oss\/202205\/02\/b6e56d08573b0b4f010144d82aa2fe84fb4ad1.png\" style=\"width: 360px;height: 173px\" class=\"aligncenter\"><\/p>\n<ul>\n<li>\u9996\u5148\u627e\u5230\u4e00\u4e2a\u63a5\u8fd1 tti \u7684\u96f6\u754c\u70b9\uff0c\u6bd4\u5982 FirstContentfulPaint \u6216\u8005 DomContentLoadedEnd \u65f6\u673a<\/li>\n<li>\u4ece\u4e34\u754c\u70b9\u5411\u540e\u67e5\u627e\u4e0d\u5305\u542b\u957f\u4efb\u52a1 (long task) \u7684\u5e76\u4e14\u7f51\u7edc\u8bf7\u6c42\u76f8\u5bf9\u5e73\u9759\u7684 5 \u79d2\u949f\u7a97\u53e3\u671f<\/li>\n<li>\u627e\u5230\u4e4b\u540e\uff0c\u518d\u5411\u524d\u8ffd\u6eaf\u5230\u6700\u540e\u4e00\u4e2a\u957f\u4efb\u52a1\u7684\u6267\u884c\u7ed3\u675f\u70b9\uff0c\u90a3\u5c31\u662f\u6211\u4eec\u7684\u8981\u627e\u7684 tti<\/li>\n<\/ul>\n<p>\u5e76\u4e14\u76ee\u524d\u7684\u539f\u751f API \u5e76\u4e0d\u652f\u6301 tti \u6307\u6807\uff0c\u9700\u8981\u901a\u8fc7 polyfill \u5b9e\u73b0\uff0c\u6309\u7167\u5b98\u65b9\u7684\u8bf4\u660e\uff0c\u76ee\u524d\u5e76\u4e0d\u80fd\u9002\u914d\u6240\u6709\u7684 web app\u3002<\/p>\n<h4>\u53cc\u5411\u6307\u6807<\/h4>\n<p>\u8fd9\u662f\u77e5\u4e4e\u521b\u4f5c\u8005\u4e2d\u5fc3\u9875\u9762\u7684\u4e00\u4e2a\u622a\u56fe\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s6.\/oss\/202205\/02\/149f74491bbaf2164f8370c04cd05ae770a76d.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s9.\/oss\/202205\/02\/a6b12c1037d6fb395c7775c2f502c93a57dae3.png\" style=\"width: 420px;height: 280px\" class=\"aligncenter\"><\/p>\n<p>\u5728\u8fd9\u4e2a\u9875\u9762\u4e2d\uff0c\u77e5\u4e4e\u6bcf\u5929\u90fd\u4f1a\u4e3a\u4f60\u66f4\u65b0\u8fc7\u53bb\u4e03\u5929\u5185\u6587\u7ae0\u9605\u8bfb\u6570\u3001\u8d5e\u540c\u6570\u3001\u8bc4\u8bba\u6570\u7b49\u6570\u636e\u7684\u6c47\u603b\u3002\u4e0a\u56fe\u4e2d\u7684\u6298\u7ebf\u5c31\u662f\u9605\u8bfb\u6570\u3002<\/p>\n<p>\u6211\u77e5\u9053\u5b83\u7684\u7528\u610f\u662f\u60f3\u7ed9\u4e88\u521b\u4f5c\u8005\u6570\u636e\u4e0a\u7684\u53cd\u9988\u5e2e\u52a9\u4ed6\u4eec\u66f4\u597d\u7684\u8f93\u51fa\u5185\u5bb9\uff0c\u4f46\u81f3\u5c11\u5bf9\u6211\u6765\u8bf4\u4e00\u70b9\u7528\u4e5f\u6ca1\u6709\u3002\u56e0\u4e3a\u6211\u66f4\u60f3\u77e5\u9053\u7684\u662f\u7a76\u7adf\u589e\u957f\u6765\u81ea\u4e8e\u54ea\u91cc\uff0c\u8fd9\u6837\u6211\u624d\u80fd\u6709\u9488\u5bf9\u6027\u7684\u8f93\u51fa\u5e26\u6765\u70b9\u51fb\u91cf\u7684\u5185\u5bb9\u3002\u4f46\u5b83\u5e26\u7ed9\u6211\u7684\u603b\u662f\u6c47\u603b\u6570\u636e\u3002<\/p>\n<p>\u8fd9\u4e2a\u9700\u6c42\u5bf9\u4e8e\u6027\u80fd\u76d1\u63a7\u4e5f\u662f\u540c\u6837\u7684\u6210\u7acb\u7684\uff0c\u76d1\u63a7\u7684\u76ee\u7684\u4e3b\u8981\u662f\u4e3a\u4e86\u53ca\u65f6\u53d1\u73b0\u95ee\u9898\uff0c\u89e3\u51b3\u95ee\u9898\u3002\u6240\u4ee5\u5728\u5ba1\u89c6\u6570\u636e\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u66f4\u5173\u5fc3\u7684\u662f\u5f02\u5e38\u6ce2\u52a8\u503c\u53d1\u751f\u5728\u4f55\u65f6\u4f55\u5730\uff0c\u6211\u4eec\u4e5f\u5e0c\u671b\u6570\u636e\u80fd\u7ed9\u4e88\u6211\u8fd9\u65b9\u9762\u7684\u5e2e\u52a9\u3002<\/p>\n<p>\u5f53\u7136\u6211\u4eec\u4e0d\u53ef\u80fd\u65e0\u4e2d\u751f\u6709\u7684\u5c06\u4e00\u7ec4\u6c47\u603b\u6570\u636e\u8fd8\u539f\u6210\u7ec6\u8282\u6570\u636e\uff0c\u4f46\u5728\u8fd9\u4e2a\u95ee\u9898\u4e0a\u6211\u4eec\u53ef\u4ee5\u5f80\u4e24\u4e2a\u65b9\u5411\u52aa\u529b\uff1a<\/p>\n<ul>\n<li>\u4fdd\u7559\u5411\u7ec6\u8282\u8ffd\u6eaf\u7684\u80fd\u529b\uff1a\u867d\u7136\u6211\u4eec\u6700\u7ec8\u770b\u5230\u7684\u662f\u6c47\u603b\u6570\u636e\uff0c\u4f46\u4f9d\u7136\u53ef\u4ee5\u67e5\u8be2\u5230\u7528\u4e8e\u805a\u5408\u8ba1\u7b97\u4f7f\u7528\u7684\u5355\u6b21\u6570\u636e<\/li>\n<li>\u66f4\u6709\u9488\u5bf9\u6027\u7684\u6536\u96c6\u6570\u636e\uff1a\u5982\u679c\u4f60\u5df2\u7ecf\u610f\u8bc6\u5230\u9ad8\u5c42\u6b21\u7684\u6307\u6807\u6570\u636e\u5bf9\u4f60\u6765\u4ef7\u503c\u6709\u9650\uff0c\u90a3\u4e48\u4e0d\u59a8\u6709\u9488\u5bf9\u6027\u7684\u6536\u96c6\u4f60\u9700\u8981\u7684\u6570\u636e\uff0c\u8fd9\u5728\u4e0b\u4e00\u8282\u4f1a\u8c08\u5230\u3002<\/li>\n<\/ul>\n<p>\u5728 Web Performance Calendar 2020 Edition \u4e2d A wish list for web performance tools \u4e00\u6587\u4e2d\uff0c\u4f5c\u8005\u63d0\u51fa\u4e86\u5173\u4e8e\u4ed6\u7406\u60f3\u6027\u80fd\u5de5\u5177\u5e94\u8be5\u6ee1\u8db3\u7684\u56db\u5219\u529f\u80fd\uff0c\u5206\u522b\u662f\uff1a<\/p>\n<ul>\n<li>Predict Web Performance as early as possible<\/li>\n<li>Don\u2019t let me do the hard work<\/li>\n<li>Make data actionable<\/li>\n<li>Protect the environment<\/li>\n<\/ul>\n<p>\u5176\u4e2d\u7684\u7b2c\u4e8c\u4e09\u5219\u5bf9\u4e8e\u6211\u4eec\u9009\u62e9\u6307\u6807\u6765\u8bf4\u4e5f\u662f\u6210\u7acb\u7684\uff0c\u4e0e\u6211\u5728\u4e0a\u9762\u7684\u5f3a\u8c03\u7684\u4e0d\u8c0b\u800c\u5408\u3002<\/p>\n<p>\u6700\u540e\u518d\u4e00\u6b21\u5f3a\u8c03\u8fd9\u91cc\u4e0d\u662f\u5bf9\u4f20\u7edf\u6307\u6807\u7684\u5426\u5b9a\u3002\u6570\u636e\u5e26\u6765\u7684\u6548\u679c\u4e00\u5b9a\u662f\u804a\u80dc\u4e8e\u65e0\uff0c\u6307\u6807\u8d8a\u591a\u8d8a\u662f\u80fd\u7cbe\u786e\u7684\u63cf\u7ed8\u51fa\u6027\u80fd\u753b\u50cf\u3002\u8fd9\u91cc\u63a2\u8ba8\u7684\u662f\u5982\u4f55\u5728\u8fd9\u4e9b\u57fa\u7840\u4e0a\u7ee7\u7eed\u4e8b\u534a\u529f\u500d\u63d0\u5347\u6211\u4eec\u6d1e\u5bdf\u95ee\u9898\u7684\u6548\u7387\u3002<\/p>\n<h3>\u5728\u9009\u62e9\u8861\u91cf\u6307\u6807\u4e0a\u7684\u4e00\u4e9b\u5efa\u8bae<\/h3>\n<h4>\u4e0a\u4e0b\u6587\u9a71\u52a8 (Context Driven)<\/h4>\n<p>\u4e4b\u6240\u4ee5\u6211\u65e0\u6cd5\u5728\u8fd9\u91cc\u7ed9\u4f60\u4e00\u4e2a\u5927\u800c\u5168\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u662f\u56e0\u4e3a\u6211\u8ba4\u4e3a\u8fd9\u79cd\u4e1c\u897f\u5e76\u4e0d\u5b58\u5728\uff0c\u4e00\u5207\u90fd\u8981\u4f9d\u8d56\u4f60\u7684\u4e0a\u4e0b\u6587\u800c\u5b9a\u3002<\/p>\n<p>\u4f60\u4e5f\u8bb8\u66f4\u719f\u6089\u7684\u662f\u4e0a\u4e0b\u6587\u9a71\u52a8\u6d4b\u8bd5(Context Driven Testing)\uff0c\u4f46\u5728\u6211\u770b\u6765\uff0c\u4e0a\u4e0b\u6587\u9a71\u52a8\u5728\u4f60\u9009\u62e9\u6027\u80fd\u6307\u6807\u6216\u8005\u5de5\u5177\u65f6\u4e5f\u662f\u540c\u6837\u6210\u7acb\u7684\u3002\u6211\u4eec\u4e0d\u59a8\u770b\u4e00\u770b\u4e0a\u4e0b\u6587\u6d4b\u8bd5\u4e03\u6761\u539f\u5219\u4e2d\u7684\u5934\u4e24\u6761\uff1a<\/p>\n<ul>\n<li>The value of any practice depends on its context. (\u4efb\u4f55\u5b9e\u8df5\u7684\u4ef7\u503c\u90fd\u4f9d\u9644\u4e8e\u5b83\u6240\u5904\u7684\u4e0a\u4e0b\u6587)<\/li>\n<li>There are good practices in context, but there are no best practices. (\u5728\u540c\u4e00\u5757\u4e0a\u4e0b\u6587\u5462\u4e2d\u4f1a\u6709\u5404\u5f0f\u5404\u6837\u597d\u7684\u5b9e\u8df5\uff0c\u4f46\u6c38\u8fdc\u4e0d\u4f1a\u6709\u6700\u4f73\u5b9e\u8df5)<\/li>\n<\/ul>\n<p>\u60f3\u8c61\u4e00\u4e0b\u5982\u679c\u4f60\u628a\u4e24\u53e5\u8bdd\u4e2d\u7684 practice \u7406\u89e3\u4e3a\u6307\u6807(metric)\uff0c\u751a\u81f3\u76f4\u63a5\u66ff\u6362\u4e3a\u6307\u6807\uff0c\u662f\u4e0d\u662f\u4e5f\u6ca1\u6709\u4efb\u4f55\u8fdd\u548c\u611f\u5462?<\/p>\n<p>\u201c\u4e0a\u4e0b\u6587\u9a71\u52a8\u201d\u521d\u770b\u4e0a\u53bb\u4e0d\u8fc7\u662f\u6b63\u53cd\u8bdd\uff0c\u4f46\u5b9e\u9645\u4e0a\u5b83\u662f\u6211\u4eec\u63d0\u5347\u76d1\u6d4b\u6548\u7387\u7684\u6709\u6548\u51fa\u8def\u3002\u6307\u6807\u672c\u8eab\u4e0d\u4f1a\u6709\u5bf9\u9519\u4e4b\u5206\uff0c\u4f46\u4e0d\u540c\u4eba\u7fa4\u5bf9\u4e8e\u6307\u6807\u7684\u89c6\u89d2\u662f\u5272\u88c2\u7684\uff1a\u4e1a\u52a1\u5206\u6790\u5e08\u5e0c\u671b\u5f97\u5230\u7684\u662f\u80fd\u76f4\u63a5\u5f70\u663e\u4e1a\u52a1\u4ef7\u503c\u7684\u6570\u636e\uff0c\u4f8b\u5982\u70b9\u51fb\u7387\uff0c\u5f39\u51fa\u7387\uff0c\u7528\u6237\u8f6c\u5316;DevOps \u540c\u5b66\u4ed6\u4eec\u53ef\u80fd\u5173\u5fc3\u7684\u662f\u7f51\u7ad9\u7684\u201c\u5fc3\u8df3\u201d\uff0c\u8d44\u6e90\u7684\u6d88\u8017\uff0c\u540e\u7aef\u63a5\u53e3\u7684\u5feb\u6162;\u6240\u4ee5\u4e0d\u540c\u6307\u6807\u5728\u4e0d\u540c\u4eba\u7fa4\u4e2d\u662f\u4e00\u79cd\u6b64\u6d88\u5f7c\u957f\u7684\u72b6\u6001\u3002\u8fd9\u79cd\u5272\u88c2\u8fd8\u53ef\u4ee5\u4ece\u6280\u672f\u89d2\u5ea6\u4e0a\u5212\u5206\uff0c\u6709\u7684\u6307\u6807\u66f4\u4fa7\u91cd\u4e8e\u8d44\u6e90\uff0c\u6709\u7684\u6307\u6807\u66f4\u4fa7\u91cd\u4e8e\u7528\u6237\u611f\u53d7\u3002<\/p>\n<p>\u6307\u6807\u53ea\u662f\u53d1\u73b0\u95ee\u9898\u7684\u4e00\u79cd\u624b\u6bb5\uff0c\u73b0\u5728\u6211\u4eec\u6709\u65e0\u6570\u79cd\u624b\u6bb5\u4efb\u541b\u6311\u9009\uff1aAPM (Application Performance Management)\u3001\u65e5\u5fd7\u5206\u6790\u3001RUM (Real-User Monitoring)\u3001TTFB (Time to First Byte)\u2026\u2026\u6700\u7ec8\u5b83\u8feb\u4f7f\u4f60\u56de\u5230\u4e86\u95ee\u9898\u7684\u8d77\u70b9\uff1a\u6211\u7a76\u7adf\u60f3\u8861\u91cf\u4ec0\u4e48?\u6211\u60f3\u8861\u91cf\u7684\u7269\u4f53\u662f\u5426\u53ef\u4ee5\u901a\u8fc7\u5df2\u6709\u7684\u6307\u6807\u8868\u8fbe\u51fa\u6765?\u6211\u53ea\u662f\u60f3 monitor \u5417?\u5982\u679c\u6211\u60f3 debug \u6216\u8005\u662f analyze \u7684\u8bdd\u662f\u5426\u8fd8\u6709\u5176\u4ed6\u7684\u9009\u62e9?<\/p>\n<p>\u201cGood software testing is a challenging intellectual process.\u201d (\u8bf7\u628a testing \u66ff\u6362\u4e3a performance tuning)\u4e0a\u4e0b\u6587\u9a71\u52a8\u6d4b\u8bd5\u4e2d\u7684\u7b2c\u516d\u6761\u539f\u5219\u5982\u662f\u8bf4\u3002<\/p>\n<h4>\u8ffd\u8e2a\u5143\u7d20<\/h4>\n<p>\u5982\u679c\u8bf4\u201c\u8d44\u6e90\u52a0\u8f7d\u5b8c\u6bd5\u201d\u8fd9\u4ef6\u4e8b\u4e0d\u9760\u8c31\uff0c\u201c\u6d4f\u89c8\u5668\u5f00\u59cb\u7ed8\u5236\u201d\u4e5f\u4e0d\u9760\u8c31\u7684\u8bdd\uff0c\u6211\u60f3\u552f\u4e00\u9760\u8c31\u7684\u4e8b\u60c5\u5c31\u662f\u7528\u6237\u7684\u6240\u89c1\u6240\u5f97\u4e86\u3002\u4e0d\u9700\u8981\u7528\u5404\u79cd\u6570\u636e\u6765\u5c55\u793a\u4f60\u7684\u9875\u9762\u52a0\u8f7d\u6709\u591a\u5feb\uff0c\u5982\u679c\u7528\u6237\u6bcf\u6b21\u90fd\u8981\u7b49\u5f85\u5341\u79d2\u624d\u80fd\u770b\u5230\u4ed6\u60f3\u770b\u5230\u7684\u4fe1\u606f\uff0c\u90a3\u4e48\u8fd9\u4e9b\u6570\u5b57\u65e0\u975e\u662f\u81ea\u6b3a\u6b3a\u4eba\u800c\u5df2\u3002\u6240\u4ee5\u6211\u4eec\u4e0d\u59a8\u53ef\u4ee5\u8ffd\u8e2a\u7528\u6237\u5173\u6ce8\u4fe1\u606f\u6240\u5bf9\u5e94\u5143\u7d20\u7684\u51fa\u73b0\u7684\u65f6\u673a\u3002<\/p>\n<p>\u8fd9\u4e0d\u662f\u521b\u65b0\uff0c\u4ece\u65e9\u4e9b\u5e74\u7684 Speed Index\uff0c\u201cabove the fold\u201d \u5230\u5982\u4eca\u7684 web vitals \u90fd\u662f\u8fd9\u79cd\u601d\u60f3\u7684\u5ef6\u7eed\uff0c\u6307\u6807\u7684\u8fdb\u5316\u8fc7\u7a0b\u50cf\u4e00\u4e2a\u4e0d\u65ad\u6536\u7f29\u8fc7\u7a0b\u4e2d\u5706\u5708\uff0c\u5728\u4e0d\u65ad\u7684\u50cf\u7528\u6237\u672c\u8eab\u9760\u62e2\u3002\u53ea\u4e0d\u8fc7\u51fa\u4e8e\u6280\u672f\u624b\u6bb5\u7684\u9650\u5236\uff0c\u5b83\u4eec\u53ea\u80fd\u8d70\u5230\u90a3\u4e48\u8fdc\uff0c\u800c\u5982\u4eca\u6211\u4eec\u6709\u4e86 MutationObserver \u548c Perforamce API, \u5219\u53ef\u4ee5\u7cbe\u786e\u7684\u5b9a\u4f4d\u5230\u5143\u7d20\uff0c\u751a\u81f3\u5143\u7d20\u4e0a\u5c5e\u6027\u7684\u6539\u53d8\uff0c\u81ea\u7136\u4e5f\u5c31\u4e0d\u4f1a\u88ab\u4e0a\u9762\u4f8b\u5b50\u4e2d\u7684 placeholder \u6240\u6b3a\u9a97\u3002<\/p>\n<p>\u62b1\u6b49\u6211\u8981\u5728\u8fd9\u91cc\u518d\u6b21\u5f3a\u8c03\u4e00\u4e0b\u4e0a\u4e0b\u6587\uff1a\u6211\u4eec\u4e0d\u80fd\u53ea\u5173\u6ce8\u201c\u5143\u7d20\u51fa\u73b0\u7684\u65f6\u673a\u201d\uff0c\u66f4\u8981\u4ece\u65f6\u95f4\u7684\u8303\u7574\u548c\u4ece\u4ee3\u7801\u5ef6\u5c55\u4e0a\u770b\u5173\u6ce8\u5f62\u6210\u5b83\u7684\u539f\u56e0\uff0c\u8fd9\u4f9d\u7136\u9700\u8981\u6211\u4eec\u7ed3\u5408\u95ee\u9898\u6240\u5904\u7684\u73af\u5883\u548c\u5b83\u7684\u8fd0\u8f6c\u673a\u5236\u800c\u5b9a\u3002\u4e3e\u4e24\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s8.\/oss\/202205\/02\/28d1ab3588e266e2f1649882cac2274d128e7a.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s9.\/oss\/202205\/02\/f3850d811769b4cc65e846b3b8b9280d42bdeb.png\" style=\"width: 420px;height: 191px\" class=\"aligncenter\"><\/p>\n<p>\u5728\u4e0a\u56fe\u4e2d\uff0c\u5982\u679c Component D \u662f\u5411\u5ba2\u6237\u5c55\u793a\u5173\u952e\u4fe1\u606f\u7684\u5173\u952e\u5143\u7d20\uff0c\u90a3\u4e48 request \u5230\u8fbe router \u7684\u65f6\u95f4\uff0c\u7531 router \u6e32\u67d3\u51fa Component C \u7684\u65f6\u95f4\uff0c\u90fd\u4f1a\u5bf9 D \u5143\u7d20\u4ea7\u751f\u5f71\u54cd;\u4ece\u53e6\u4e00\u4e2a\u7ef4\u5ea6\u4e0a\u770b\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s2.\/oss\/202205\/02\/a5cccfd6490d075f1f0910ffc33b0d03debe13.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s7.\/oss\/202205\/02\/d4b54748955f2c7475c444bcb874d1e5ae6846.png\" style=\"width: 420px;height: 203px\" class=\"aligncenter\"><\/p>\n<p>\u811a\u672c\u4ee5\u53ca\u8bf7\u6c42\u52a0\u8f7d\u7684\u5feb\u6162\u548c\u6267\u884c\u7684\u6548\u7387\uff0c\u540c\u6837\u4e5f\u4f1a\u5bf9\u5143\u7d20\u7684\u51fa\u73b0\u4ea7\u751f\u5f71\u54cd\u3002\u5982\u679c\u4f60\u9700\u8981\u5bf9\u95ee\u9898\u8fdb\u884c\u8bca\u65ad\uff0c\u5bf9\u8fd9\u4e9b\u80cc\u540e\u5de5\u4f5c\u673a\u5236\u7684\u4e86\u89e3\u5fc5\u4e0d\u53ef\u5c11\u3002<\/p>\n<p>\u4f46\u8ffd\u8e2a\u5143\u7d20\u4e5f\u5b58\u5728\u53e6\u4e00\u4e2a\u95ee\u9898\u5c31\u662f\u5b83\u96be\u4ee5\u5927\u89c4\u6a21\u7684\u5e94\u7528\u3002\u56e0\u4e3a\u5b83\u662f\u4fb5\u5165\u5f0f\u7684\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u4f60\u8bc6\u522b\u4e0d\u540c\u9875\u9762\u4e0a\u7684\u4e0d\u540c\u5173\u952e\u5143\u7d20\uff0c\u7528\u8fd1\u4f3c\u4e8e hard code \u7684\u65b9\u5f0f\u5bf9\u5b83\u4eec\u4e00\u4e00\u8ffd\u8e2a\u3002\u8fd9\u7c7b\u5de5\u4f5c\u4ea7\u751f\u7684\u7ef4\u62a4\u6210\u672c\u63a5\u8fd1\u4e8e\u7ef4\u62a4\u524d\u7aef\u7684 E2E \u6d4b\u8bd5\u3002\u8bda\u7136\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5206\u914d\u7edf\u4e00\u7684 id \u6216\u8005 class name \u7684\u65b9\u5f0f\u6765\u51cf\u5c11\u6211\u4eec\u7684\u7ef4\u62a4\u6210\u672c\uff0c\u4f46\u662f\u76f8\u6bd4\u7edf\u4e00\u7684 GA \u4ee3\u7801\u8fd9\u6837\u7684\u7ef4\u62a4\u6210\u672c\u4f9d\u7136\u504f\u9ad8\u3002\u6240\u4ee5\u6211\u5efa\u8bae\u4f7f\u7528\u6700\u7b80\u5355\u7684\u65b9\u6cd5\u53bb\u76d1\u63a7\u6700\u76f4\u63a5\u7684\u5143\u7d20\uff0c\u4e0d\u8981 case by case \u7684\u53bb\u7f16\u5199\u4f60\u7684\u76d1\u63a7\u4ee3\u7801\uff0c\u4e0d\u8981\u8ba9\u4f60\u7684\u5b9e\u73b0\u4ee3\u7801\u88ab\u76d1\u63a7\u4ee3\u7801\u675f\u7f1a\u4f4f\u3002<\/p>\n<h4>\u8ba9\u5de5\u5177\u4e3a\u4f60\u6240\u7528<\/h4>\n<p>\u4f60\u53ef\u4ee5\u5728\u5e02\u9762\u4e0a\u627e\u5230\u5404\u7c7b\u6570\u4e0d\u80dc\u6570\u53f7\u79f0\u80fd\u591f\u534f\u52a9\u4f60\u6539\u5584\u6027\u80fd\u7684\u5de5\u5177\u3002\u4f46\u9996\u5148\u4f60\u8981\u5c0f\u5fc3\uff0c\u5b83\u4eec\u6240\u5ba3\u626c\u7684\uff0c\u5e76\u975e\u662f\u4f60\u771f\u6b63\u9700\u8981\u7684\u3002<\/p>\n<p>\u4f8b\u5982 site24x7 \u662f\u4e00\u5bb6\u4e13\u4e1a\u63d0\u4f9b\u7528\u6237\u884c\u4e3a\u76d1\u63a7\u89e3\u51b3\u65b9\u6848\u7684\u516c\u53f8\u3002\u5728\u5b83\u4eec\u6709\u5173 APM \u7684\u5e2e\u52a9\u9875\u9762\u4e0a\uff0c\u5f00\u5b97\u660e\u4e49\u7684\u6307\u51fa\u4e86\u76d1\u63a7\u6355\u83b7 SAP(Single Page Application) \u6027\u80fd\u6570\u636e\u4ee5\u76ee\u524d\u7684\u6280\u672f\u6765\u8bf4\u5176\u5b9e\u662f\u4e00\u9879\u9887\u5177\u6311\u6218\u7684\u5de5\u4f5c\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-bottom: 5px;padding-left: 1em;margin-left: 0px\">\n<p>In case of Single Page Applications, the time taken for page load completion cannot be obtained by page onload event since the data are dynamically obtained from the server using<\/p>\n<p>Hence, for each SPA framework, the page load metrics are calculated by listening to particular events specific to the framework.<\/p>\n<\/blockquote>\n<p>\u6240\u4ee5\u5bf9\u4e8e\u6b64\u79cd\u7c7b\u578b\u7684\u9875\u9762\uff0c\u5b83\u4eec\u6355\u83b7\u6307\u6807\u4e5f\u53ea\u6709\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-bottom: 5px;padding-left: 1em;margin-left: 0px\">\n<p>For every dynamic page load, the corresponding URL, it's respective AJAX calls, response time of each AJAX call, response codes and errors (if any) are captured.<\/p>\n<\/blockquote>\n<p>\u4f46\u8981\u77e5\u9053\u5728\u5982\u4eca SPA \u5927\u884c\u5176\u9053\u7684\u4eca\u5929\uff0c\u5982\u6b64\u7684\u6536\u96c6\u529f\u80fd\u7565\u663e\u7684\u82cd\u767d\u65e0\u529b\u4e86\u3002<\/p>\n<p>\u540c\u7406\u5982\u679c\u4f60\u53bb\u770b Azure Application Insights \u65d7\u4e0b JavaScript SDK \u9ed8\u8ba4\u6536\u96c6\u7684\u9875\u9762\u4fe1\u606f\uff1a<\/p>\n<blockquote style=\"margin-top: 5px;margin-bottom: 5px;padding-left: 1em;margin-left: 0px\">\n<p>(1) Uncaught exceptions in your app, including information on<\/p>\n<ul>\n<li>Stack trace<\/li>\n<li>Exception details and message accompanying the error<\/li>\n<li>Line &amp; column number of error<\/li>\n<li>URL where error was raised<\/li>\n<\/ul>\n<p>(2) Network Dependency Requests made by your app XHR and Fetch (fetch collection is disabled by default) requests, include information on<\/p>\n<ul>\n<li>Url of dependency source<\/li>\n<li>Command &amp; Method used to request the dependency<\/li>\n<li>Duration of the request<\/li>\n<li>Result code and success status of the request<\/li>\n<li>ID (if any) of user making the request<\/li>\n<li>Correlation context (if any) where request is made<\/li>\n<\/ul>\n<p>(3) User information (for example, Location, network, IP)<\/p>\n<p>(4) Device information (for example, Browser, OS, version, language, model)<\/p>\n<p>(5) Session information<\/p>\n<\/blockquote>\n<p>\u6211\u4e0d\u8ba4\u4e3a\u8fd9\u4e9b\u6307\u6807\u548c\u5176\u4ed6\u5e73\u53f0\u63d0\u4f9b\u7684\u76f8\u6bd4\u80fd\u5e26\u6765\u989d\u5916\u7684\u4ef7\u503c\uff0c\u5b83\u80fd\u771f\u7684\u7ed9\u6211\u5e26\u6765\u591a\u5c11\u771f\u6b63\u7684 \u201cinsights\u201d\u3002<\/p>\n<p>\u53e6\u4e00\u65b9\u9762\uff0c\u4e0d\u8981\u8ba9\u4f60\u7684\u601d\u7ef4\u88ab\u5de5\u5177\u9650\u5236\u4f4f\uff1a\u4e0d\u8981\u201c\u56e0\u4e3a xx \u5de5\u5177\u53ea\u80fd\u505a\u5230\u8fd9\u4e9b\uff0c\u6240\u4ee5\u6211\u53ea\u80fd\u6536\u96c6\u8fd9\u4e9b\u6307\u6807\u201d;\u800c\u8981\u201c\u6211\u60f3\u6536\u96c6\u8fd9\u4e9b\u6307\u6807\uff0c\u6240\u4ee5\u6211\u9700\u8981 xx \u5de5\u5177\u201d\u3002\u5728\u8fd9\u91cc\u6211\u5217\u4e3e\u4e00\u4e2a\u6211\u4eec\u5728\u63a2\u7d22\u4e2d\u7684\u4f8b\u5b50\uff1a\u7528 OpenTracing \u5de5\u5177 Jaeger \u53bb\u53ef\u89c6\u5316\u524d\u7aef\u6027\u80fd\u56fe\u8868\u3002<\/p>\n<p>\u5728\u8fd9\u91cc\u6211\u9996\u5148\u5fc5\u987b\u8d5e\u9882 Chrome \u5185\u7f6e Performance \u5de5\u5177\u7ed9\u6211\u4eec\u8c03\u6559\u6027\u80fd\u5e26\u6765\u4e86\u6781\u5927\u7684\u4fbf\u5229\u3002\u4f46\u6211\u4eec\u59cb\u7ec8\u6709\u4e00\u4e9b\u989d\u5916\u7684\u9700\u6c42\u65e0\u6cd5\u6ee1\u8db3\u3002\u4f8b\u5982\u6211\u5e0c\u671b\u80fd\u591f\u5728\u7ed3\u679c\u5448\u73b0\u4e2d\u505a\u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\u6807\u8bb0\uff0c\u53c8\u6216\u8005\u5728 Performance Tab \u4e0b\u5c55\u793a\u6bcf\u4e00\u4e2a\u8bf7\u6c42\u4ece connect \u5230 resposne \u6bcf\u4e2a\u9636\u6bb5\u7684\u72b6\u6001\u3002<\/p>\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u4e8e\u662f\u6211\u4eec\u8de8\u754c\u7684\u4f7f\u7528\u4e86 Jaeger \u5f00\u6e90\u5de5\u5177\u6765\u7528\u4e8e\u81ea\u5b9a\u4e49\u6307\u6807\u7684\u6536\u96c6\u548c\u5c55\u793a\uff0c\u53ef\u4ee5\u8bf4\u662f\u5c06\u4e0d\u540c\u7eac\u5ea6\u7684\u6307\u6807\u4ee5\u65f6\u95f4\u4e3a\u7ebf\u7d22\u5c06\u5b83\u4eec\u8054\u7cfb\u8d77\u6765\uff0c\u8fd9\u6837\u4e00\u6765\u9875\u9762\u52a0\u8f7d\u9636\u6bb5\u7684\u72b6\u6001\u5e76\u80fd\u4e00\u89c8\u65e0\u4f59\u7684\u5c3d\u6536\u773c\u5e95\u3002\u4fbf\u4e8e\u5b9a\u4f4d\u95ee\u9898\u7684\u6240\u5728\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/s5.\/oss\/202205\/02\/e38132902f7ed1b02e2145336db9436302ea7f.gif\" style=\"width: 1px;height: 1px\" class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/s7.\/oss\/202205\/02\/a113abd41a6c0e3858274766dea464f25d8874.png\" style=\"width: 420px;height: 258px\" class=\"aligncenter\"><\/p>\n<h3>\u7ed3\u675f\u8bed<\/h3>\n<p>\u6211\u89c2\u5bdf\u5230\u5bf9\u4e8e\u5927\u90e8\u5206\u524d\u7aef\u5de5\u7a0b\u5e08\u800c\u8a00\uff0c\u53c8\u6216\u8005\u66fe\u7ecf\u7684\u81ea\u5df1\u800c\u8a00\uff0c\u5728\u505a\u6027\u80fd\u76d1\u63a7\u65f6\u662f\u4e00\u4e2a\u88ab\u201c\u5582\u201d\u7684\u8fc7\u7a0b\uff0c\u5373\u4f1a\u60ef\u6027\u7684\u4e0d\u5047\u601d\u7d22\u7684\u6536\u96c6\u5df2\u6709\u6307\u6807\u548c\u5229\u7528\u5df2\u6709\u5de5\u5177\u3002\u53c8\u56e0\u4e3a\u6027\u80fd\u4f18\u5316\u5de5\u4f5c\u8fc7\u7a0b\u524d\u7f6e\u7ed3\u679c\u540e\u7f6e\u7684\u5173\u7cfb\uff0c\u7b49\u5230\u6211\u4eec\u6709\u9700\u6c42\u53d1\u751f\u65f6\u624d\u4f1a\u53d1\u73b0\u5f53\u4e0b\u7684\u7ed3\u679c\u5e76\u975e\u662f\u6211\u4eec\u60f3\u8981\u7684\u3002\u591a\u4e00\u4e9b\u601d\u8003\u624d\u4f1a\u8ba9\u6211\u4eec\u7684\u5de5\u4f5c\u5c11\u4e00\u5206\u6d6a\u8d39\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5728\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\u7684\u4f60\uff0c\u6216\u591a\u6216\u8005\u63a5\u89e6\u8fc7\u524d\u7aef\u6027\u80fd\u4f18\u5316\uff0c\u8fd9\u6837\u7684\u63a5\u89e6\u53ef\u80fd\u662f\u6765\u81ea\u4f60\u7684\u9605\u8bfb\u4f53\u9a8c\u4e5f\u53ef\u80fd\u662f\u6765\u81ea\u5de5\u4f5c\u7ecf\u9a8c\u3002\u90a3\u6211\u4eec [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":335738,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-335737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/335737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=335737"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/335737\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/335738"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=335737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=335737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=335737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}