{"id":13159,"date":"2024-06-17T10:31:41","date_gmt":"2024-06-17T02:31:41","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=13159"},"modified":"2024-06-17T10:31:41","modified_gmt":"2024-06-17T02:31:41","slug":"%e5%bb%b6%e8%bf%9f%e8%b0%83%e5%ba%a6%e7%ad%96%e7%95%a5%e5%af%bc%e8%87%b4%e7%9a%84task%e6%97%a0%e6%b3%95%e8%a7%a6%e5%8f%91%e6%89%a7%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=13159","title":{"rendered":"\u5ef6\u8fdf\u8c03\u5ea6 Delay Scheduler \u7b56\u7565\u5bfc\u81f4\u7684 task \u65e0\u6cd5\u89e6\u53d1\u6267\u884c"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<p>\u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u8c03\u5ea6\u7b56\u7565\uff08Delay Scheduler\uff09\u7684\u53c2\u6570\u914d\u7f6e\u95ee\u9898\uff0c\u5bfc\u81f4\u5ba2\u6237\u7684task\u4efb\u52a1\u65e0\u6cd5\u89e6\u53d1\u6267\u884c\uff0c\u5bfc\u81f4\u6267\u884c\u65f6\u95f4\u8fc7\u957f\u7684\u95ee\u9898<\/p>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<hr \/>\n<h4>\u95ee\u9898\u73b0\u8c61<\/h4>\n<p>\u5ba2\u6237\u53cd\u9988\uff0c\u591a\u4e2a\u5b58\u50a8\u8fc7\u7a0b\uff0c\u8bfb\u53d6text\u6587\u672c\u8868\uff0cstage\u6267\u884c\u65f6\u95f4\u8fc7\u957f\uff0c\u9700\u8981\u4e00\u4e2a\u5c0f\u65f6\u624d\u80fd\u6267\u884c\u5b8c\u6bd5<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716961355450.png\" alt=\"file\" \/><\/p>\n<h4>\u6392\u67e5\u601d\u8def<\/h4>\n<p>a\uff09\u8fd9\u4e9b\u8868\u662f\u666e\u901a\u7684text\u6587\u672c\u8868\uff0c\u6570\u636e\u91cf\u8f83\u5c11\uff0c\u76f4\u63a5select\u67e5\u8be2\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\u3002<\/p>\n<p>b\uff09DBAService\u67e5\u770bstage\u6267\u884c\u60c5\u51b5\uff0c\u8be5stage\u603b\u517159\u4e2atask\uff0c48\u4e2a\u5f88\u5feb\u6267\u884c\u5b8c\u6bd5\uff0c\u8fd8\u670911\u4e2a\u4e00\u76f4\u65e0\u6cd5\u5206\u914d\u5230task\u3002\u5bf9stage\u4e2dtask\u7684duration\u8fdb\u884c\u6392\u5e8f\uff0c\u53ef\u4ee5\u770b\u5230\u6bcf\u4e2atask\u6267\u884c\u7684\u901f\u5ea6\u662f\u5f88\u5feb\u7684\uff0c\u53ea\u662f\u4e00\u76f4\u65e0\u6cd5\u5206\u914d\u5230task\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716962564229.png\" alt=\"file\" \/><\/p>\n<p>d\uff09executor\u8d1f\u8f7d\u5f88\u7a7a\u95f2\uff0c\u4f7f\u7528\u7684\u8c03\u5ea6\u6c60\u8d44\u6e90\u961f\u5217\u4e5f\u90fd\u5bcc\u4f59\uff0cexecutor\u72b6\u6001\u4e5f\u90fd\u975e\u5e38\u5065\u5eb7\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716961744900.png\" alt=\"file\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716961731047.png\" alt=\"file\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716961737241.png\" alt=\"file\" \/><\/p>\n<p>e\uff09\u68c0\u67e5server \u7684jstat\uff0c\u4e5f\u6ca1\u6709GC\u7684\u60c5\u51b5<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716961719610.png\" alt=\"file\" \/><\/p>\n<p>f\uff09\u636e\u5ba2\u6237\u53cd\u9988\uff0c\u4e4b\u524d\u4e00\u76f4\u90fd\u662f\u6b63\u5e38\u7684\uff0c5\u670822\u65e5\u66f4\u65b0\u4e86Argodb Patch\uff0c\u5e76\u4e14\u5bf9<code>EXTRA_DRIVER_OPTS<\/code>\u548c<code>EXTRA_EXECUTOR_OPTS<\/code>\u8fdb\u884c\u4e86\u8c03\u6574\uff0c\u5176\u4e2d\u5305\u542b<code>-Dspark.locality.wait.node=3600000<\/code>\u7684\u914d\u7f6e\uff0c\u8fd9\u4e2a\u53c2\u6570\u4e5f\u5c31\u662f\u95ee\u9898\u6839\u6e90\u6240\u5728\u3002 <\/p>\n<p>\u8be5\u53c2\u6570\uff0c\u4f1a\u5bfc\u81f4\u5982\u679c\u57281\u4e2a\u5c0f\u65f6\u7b49\u4e0d\u5230 NODE_LOCAL \u65f6\u7684\u964d\u7ea7\u5ef6\u8fdf\u65f6\u95f4\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1716961900490.png\" alt=\"file\" \/><\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7 \u4efb\u52a1\u7684 stage \u4efb\u52a1\u96c6\u9875\u9762\u67e5\u770b\u6267\u884c\u65f6\u95f4\u6bd4\u8f83\u4e45\u7684 task \u7684\u8c03\u5ea6\u5ef6\u8fdf\u65f6\u95f4\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2024\/05\/image-1717141143709.png\" alt=\"file\" \/><\/p>\n<h4>\u89e3\u51b3\u65b9\u6848\uff1a<\/h4>\n<p>\u5220\u9664\u8be5<code>-Dspark.locality.wait.node=3600000<\/code>\u914d\u7f6e\uff0c\u7136\u540equark\u670d\u52a1\uff0c\u914d\u7f6e\u670d\u52a1\uff0c\u91cd\u542f\u3002<\/p>\n<hr \/>\n<p><strong>\u8fd9\u91cc\u6211\u4eec\u4ecb\u7ecd\u4e00\u4e0b \u5ef6\u8fdf\u8c03\u5ea6\u7b56\u7565\uff08Delay Scheduler\uff09<\/strong><\/p>\n<p>Spark\u5728\u8c03\u5ea6\u7a0b\u5e8f\u7684\u65f6\u5019\u5e76\u4e0d\u4e00\u5b9a\u603b\u662f\u80fd\u6309\u7167\u8ba1\u7b97\u51fa\u7684\u6570\u636e\u672c\u5730\u6027\u6267\u884c\uff0c\u56e0\u4e3a\u5373\u4f7f\u8ba1\u7b97\u51fa\u5728\u67d0\u4e2aExecutor\u4e0a\u6267\u884c\u65f6\u6570\u636e\u672c\u5730\u6027\u6700\u597d\uff0c\u4f46\u662fExecutor\u7684core\u4e5f\u662f\u6709\u9650\u7684\uff0c\u6709\u53ef\u80fd\u8ba1\u7b97\u51faTaskFoo\u5728ExecutorBar\u4e0a\u6267\u884c\u6570\u636e\u672c\u5730\u6027\u6700\u597d\uff0c\u4f46\u662f\u53d1\u73b0ExecutorBar\u7684\u6240\u6709core\u90fd\u4e00\u76f4\u88ab\u7528\u7740\u817e\u4e0d\u51fa\u8d44\u6e90\u6765\u6267\u884c\u65b0\u6765\u7684TaskFoo\uff0c\u6240\u4ee5\u5f53TaskFoo\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u4e4b\u540e\u53d1\u73b0\u4ecd\u7136\u7b49\u4e0d\u5230\u8d44\u6e90\u7684\u8bdd\u5c31\u5c1d\u8bd5\u964d\u4f4e\u6570\u636e\u672c\u5730\u6027\u7ea7\u522b\u8ba9\u5176\u5b83\u7684Executor\u53bb\u6267\u884c\u3002<\/p>\n<p>\u4e3e\u4f8b\u8bf4\u660e\uff1a<\/p>\n<p>\u6bd4\u5982\u5f53\u524d\u6709\u4e00\u4e2aRDD\uff0c\u6709\u56db\u4e2a\u5206\u533a\uff0c\u79f0\u4e3aA\u3001B\u3001C\u3001D\uff0c\u5f53\u524dStage\u4e2d\u8fd9\u4e2aRDD\u7684\u6bcf\u4e2a\u5206\u533a\u5bf9\u5e94\u7684Task\u5206\u522b\u79f0\u4e3aTaskA\u3001TaskB\u3001TaskC\u3001TaskD<\/p>\n<p>\u5728\u4e4b\u524d\u7684Stage\u4e2d\u5c06\u8fd9\u4e2aRDD cache\u5728\u4e86\u4e00\u53f0\u673a\u5668\u4e0a\u7684\u4e24\u4e2aExecutor\u4e0a\uff0c\u79f0\u4e3aExecutorA\u3001ExecutorB\uff0c\u6bcf\u4e2aExecutor\u7684core\u662f2\uff0cExecutorA\u4e0a\u7f13\u5b58\u4e86RDD\u7684A\u3001B\u3001C\u5206\u533a\uff0cExecutorB\u4e0a\u7f13\u5b58\u4e86RDD\u7684D\u5206\u533a<\/p>\n<p>\u7136\u540e\u5206\u914dTask\u7684\u65f6\u5019\u4f1a\u628aTaskA\u3001TaskB\u3001TaskC\u5206\u914d\u7ed9ExecutorA\uff0cTaskD\u5206\u914d\u7ed9ExecutorB\uff0c\u4f46\u662f\u56e0\u4e3a\u6bcf\u4e2aExecutor\u53ea\u6709\u4e24\u4e2acore\uff0c\u53ea\u80fd\u540c\u65f6\u6267\u884c\u4e24\u4e2aTask\uff0c\u6240\u4ee5ExecutorA\u80fd\u591f\u6267\u884cTaskA\u548cTaskB\uff0c\u4f46\u662fTaskC\u5c31\u53ea\u80fd\u7b49\u7740\uff0c\u5c3d\u7ba1\u5b83\u5728ExecutorA\u4e0a\u6267\u884c\u7684\u6570\u636e\u672c\u5730\u6027\u662fPROCESS_LOCAL\uff0c\u4f46\u662f\u56e0\u4e3a\u6ca1\u6709\u8d44\u6e90\uff0cTaskC\u53ea\u80fd\u7b49\u5f85\uff0cTaskC\u4f1a\u8bbe\u5b9a\u4e86\u4e00\u4e2a\u8d85\u65f6\u65f6\u95f4\uff0c\u5f53\u8d85\u8fc7\u4e4b\u540e\u8fd8\u7b49\u4e0d\u5230\u5c31\u653e\u5f03PROCESS_LOCAL\u7ea7\u522b\uff0c\u8f6c\u800c\u5c1d\u8bd5NODE_LOCAL\u7ea7\u522b\u7684Executor\uff0c\u7136\u540e\u5b83\u770b\u5230\u4e86ExecutorB\uff0cExecutorB\u548cExecutorA\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a\uff0c\u53ea\u662f\u4e24\u4e2a\u4e0d\u540c\u7684jvm\uff0c\u6240\u4ee5\u5728ExecutorB\u4e0a\u6267\u884c\u9700\u8981\u4eceExecutorA\u4e0a\u62c9\u53d6\u6570\u636e\uff0c\u901a\u8fc7BlockManager\u7684getRemote\uff0c\u5e95\u5c42\u901a\u8fc7BlockTransferService\u53bb\u628a\u6570\u636e\u62c9\u53d6\u8fc7\u6765\uff0c\u56e0\u4e3a\u662f\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a\u7684\u4e24\u4e2a\u8fdb\u7a0b\u4e4b\u95f4\u4f7f\u7528socket\u6570\u636e\u4f20\u8f93\uff0c\u8d70\u7684\u5e94\u8be5\u662f\u56de\u73af\u5730\u5740\uff0c\u901f\u5ea6\u4f1a\u975e\u5e38\u5feb\uff0c\u6240\u4ee5\u5bf9\u4e8e\u8fd9\u79cd\u6570\u636e\u5b58\u50a8\u5728\u540c\u4e00\u53f0\u673a\u5668\u4e0a\u7684\u4e0d\u540cExecutor\u4e0a\u56e0\u4e3a\u964d\u7ea7\u5bfc\u81f4\u7684NODE_LOCAL\u7684\u60c5\u51b5\uff0c\u7406\u8bba\u4e0a\u5e76\u4e0d\u4f1a\u6bd4PROCESS_LOCAL\u6162\u591a\u5c11\uff0cTaskC\u5728ExecutorB\u4e0a\u6267\u884c\u5e76\u4e0d\u4f1a\u6bd4ExecutorA\u4e0a\u6267\u884c\u6162\u591a\u5c11\u3002\u4f46\u662f\u5bf9\u4e8e\u6bd4\u5982HDFS\u5757\u5b58\u50a8\u5728\u6b64\u8282\u70b9\u6240\u4ee5\u5c06Task\u5206\u914d\u5230\u6b64\u8282\u70b9\u7684\u60c5\u51b5\u5bfc\u81f4\u7684NODE_LOCAL\uff0c\u56e0\u4e3a\u8981\u8ddfHDFS\u4ea4\u4e92\uff0c\u8fd8\u8981\u8bfb\u53d6\u78c1\u76d8\u6587\u4ef6\uff0c\u6d89\u53ca\u5230\u4e86\u4e00\u4e9bI\/O\u64cd\u4f5c\uff0c\u8fd9\u79cd\u60c5\u51b5\u5c31\u4f1a\u8017\u8d39\u8f83\u957f\u65f6\u95f4\uff0c\u76f8\u6bd4\u8f83\u4e8ePROCESS_LOCAL\u7ea7\u522b\u5c31\u6162\u4e0a\u4e0d\u5c11\u4e86\u3002<\/p>\n<p>\u4e0a\u9762\u4e3e\u7684\u4f8b\u5b50\u4e2d\u63d0\u5230\u4e86TaskC\u4f1a\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\uff0c\u6839\u636e\u6570\u636e\u672c\u5730\u6027\u4e0d\u540c\uff0c\u7b49\u5f85\u7684\u65f6\u95f4\u95f4\u9694\u4e5f\u4e0d\u4e00\u81f4\uff0c\u4e0d\u540c\u6570\u636e\u672c\u5730\u6027\u7684\u7b49\u5f85\u65f6\u95f4\u8bbe\u7f6e\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>spark.locality.wait\uff1a\u8bbe\u7f6e\u6240\u6709\u7ea7\u522b\u7684\u6570\u636e\u672c\u5730\u6027\uff0c\u9ed8\u8ba4\u662f3000\u6beb\u79d2<\/li>\n<li>spark.locality.wait.process\uff1a\u591a\u957f\u65f6\u95f4\u7b49\u4e0d\u5230PROCESS_LOCAL\u5c31\u964d\u7ea7\uff0c\u9ed8\u8ba4\u4e3a${spark.locality.wait}<\/li>\n<li>spark.locality.wait.node\uff1a\u591a\u957f\u65f6\u95f4\u7b49\u4e0d\u5230NODE_LOCAL\u5c31\u964d\u7ea7\uff0c\u9ed8\u8ba4\u4e3a${spark.locality.wait}<\/li>\n<li>spark.locality.wait.rack\uff1a\u591a\u957f\u65f6\u95f4\u7b49\u4e0d\u5230RACK_LOCAL\u5c31\u964d\u7ea7\uff0c\u9ed8\u8ba4\u4e3a${spark.locality.wait}<\/li>\n<\/ul>\n<p>\u603b\u7ed3\u6570\u636e\u5ef6\u8fdf\u8c03\u5ea6\u7b56\u7565\uff1a\u5f53\u4f7f\u7528\u5f53\u524d\u7684\u6570\u636e\u672c\u5730\u6027\u7ea7\u522b\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u4e4b\u540e\u4ecd\u7136\u6ca1\u6709\u8d44\u6e90\u6267\u884c\u65f6\uff0c\u5c1d\u8bd5\u964d\u4f4e\u6570\u636e\u672c\u5730\u6027\u7ea7\u522b\u4f7f\u7528\u66f4\u4f4e\u7684\u6570\u636e\u672c\u5730\u6027\u5bf9\u5e94\u7684Executor\u6267\u884c\uff0c\u8fd9\u4e2a\u5c31\u662fTask\u7684\u5ef6\u8fdf\u8c03\u5ea6\u7b56\u7565\u3002<\/p>\n<p>\u5982\u679cTask\u7684\u8f93\u5165\u6570\u636e\u6bd4\u8f83\u5927\uff0c\u90a3\u4e48\u8017\u8d39\u5728\u6570\u636e\u8bfb\u53d6\u4e0a\u7684\u65f6\u95f4\u4f1a\u6bd4\u8f83\u957f\uff0c\u4e00\u4e2a\u597d\u7684\u6570\u636e\u672c\u5730\u6027\u80fd\u591f\u8282\u7701\u5f88\u957f\u65f6\u95f4\uff0c\u6240\u4ee5\u8fd9\u79cd\u60c5\u51b5\u4e0b\u6700\u597d\u8fd8\u662f\u5c06\u5ef6\u8fdf\u8c03\u5ea6\u7684\u964d\u7ea7\u7b49\u5f85\u65f6\u95f4\u8c03\u957f\u4e00\u4e9b\u3002\u800c\u5bf9\u4e8e\u8f93\u5165\u6570\u636e\u6bd4\u8f83\u5c0f\u7684\uff0c\u5373\u4f7f\u6570\u636e\u672c\u5730\u6027\u4e0d\u597d\u4e5f\u53ea\u662f\u591a\u82b1\u4e00\u70b9\u70b9\u65f6\u95f4\uff0c\u90a3\u4e48\u4fbf\u4e0d\u5fc5\u5728\u5ef6\u8fdf\u8c03\u5ea6\u4e0a\u8017\u8d39\u592a\u957f\u65f6\u95f4\u3002\u603b\u7ed3\u4e00\u4e0b\u5c31\u662f\u5982\u679c\u6570\u636e\u672c\u5730\u6027\u5bf9\u4efb\u52a1\u7684\u6267\u884c\u65f6\u95f4\u5f71\u54cd\u8f83\u5927\u7684\u8bdd\u5c31\u7a0d\u7a0d\u8c03\u9ad8\u5ef6\u8fdf\u8c03\u5ea6\u7684\u964d\u7ea7\u7b49\u5f85\u65f6\u95f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 \u672c\u6587\u4e3b\u8981\u4ecb\u7ecd\uff0c\u56e0\u4e3a\u5ef6\u8fdf\u8c03\u5ea6\u7b56\u7565\uff08Delay Scheduler\uff09\u7684\u53c2\u6570\u914d\u7f6e\u95ee\u9898\uff0c\u5bfc\u81f4\u5ba2\u6237\u7684task\u4efb ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=13159\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"class_list":["post-13159","post","type-post","status-publish","format-standard","hentry","category-performance"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/13159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13159"}],"version-history":[{"count":4,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/13159\/revisions"}],"predecessor-version":[{"id":13374,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/13159\/revisions\/13374"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}