Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor,util: Stat inner/inter zone network traffic for MPP tasks #58683

Merged
merged 29 commits into from
Jan 21, 2025

Conversation

yibin87
Copy link
Contributor

@yibin87 yibin87 commented Jan 3, 2025

What problem does this PR solve?

Issue Number: close #58682

Problem Summary:

What changed and how does it work?

  1. Refine the execution summary merging code for tiflash to reduce heap allocation
  2. Encode sameZoneFlags for mpp exchange senders/receivers
  3. Parse new added network traffic info in tiflash execution summary, and finally set to tikv exec details

Manual tests

Slow Log Test will be done in #59041
Execution Summary Test: 3 TiFlash Nodes, zone labels: [east, east, west]
TPCH-10, Q1

Tidb Zone east

For ExchangeSender_51, all data are sent to one east tiflash node
+--------------------------------------------+-------------+----------+--------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+
| id                                         | estRows     | actRows  | task         | access object  | execution info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | operator info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | memory  | disk    |
+--------------------------------------------+-------------+----------+--------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+
| Sort_6                                     | 2.94        | 4        | root         |                | time:2.5s, open:2.69ms, close:10µs, loops:2, RU:126048.87                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | test.lineitem.l_returnflag, test.lineitem.l_linestatus                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | 11.5 KB | 0 Bytes |
| └─TableReader_54                           | 2.94        | 4        | root         |                | time:2.5s, open:2.68ms, close:8.74µs, loops:2, cop_task: {num: 4, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | MppVersion: 2, data:ExchangeSender_53                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | 1.79 KB | N/A     |
|   └─ExchangeSender_53                      | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.47s, min:2.45s, avg: 2.46s, p80:2.47s, p95:2.47s, iters:1, tasks:3, threads:3}, tiflash_network: {inner_zone_send_bytes: 1331}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | ExchangeType: PassThrough                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | N/A     | N/A     |
|     └─Projection_9                         | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.47s, min:2.45s, avg: 2.46s, p80:2.47s, p95:2.47s, iters:1, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | test.lineitem.l_returnflag, test.lineitem.l_linestatus, Column#17, Column#18, Column#19, Column#20, Column#21, Column#22, Column#23, Column#24                                                                                                                                                                                                                                                                                                                                                                                                                                                                | N/A     | N/A     |
|       └─Projection_49                      | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.47s, min:2.45s, avg: 2.46s, p80:2.47s, p95:2.47s, iters:1, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Column#17, Column#18, Column#19, Column#20, div(Column#21, cast(case(eq(Column#73, 0), 1, Column#73), decimal(20,0) BINARY))->Column#21, div(Column#22, cast(case(eq(Column#74, 0), 1, Column#74), decimal(20,0) BINARY))->Column#22, div(Column#23, cast(case(eq(Column#75, 0), 1, Column#75), decimal(20,0) BINARY))->Column#23, Column#24, test.lineitem.l_returnflag, test.lineitem.l_linestatus                                                                                                                                                                                                          | N/A     | N/A     |
|         └─HashAgg_50                       | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.46s, min:2.45s, avg: 2.46s, p80:2.46s, p95:2.46s, iters:1, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | group by:test.lineitem.l_linestatus, test.lineitem.l_returnflag, funcs:sum(Column#76)->Column#17, funcs:sum(Column#77)->Column#18, funcs:sum(Column#78)->Column#19, funcs:sum(Column#79)->Column#20, funcs:sum(Column#80)->Column#73, funcs:sum(Column#81)->Column#21, funcs:sum(Column#82)->Column#74, funcs:sum(Column#83)->Column#22, funcs:sum(Column#84)->Column#75, funcs:sum(Column#85)->Column#23, funcs:sum(Column#86)->Column#24, funcs:firstrow(test.lineitem.l_returnflag)->test.lineitem.l_returnflag, funcs:firstrow(test.lineitem.l_linestatus)->test.lineitem.l_linestatus                    | N/A     | N/A     |
|           └─ExchangeReceiver_52            | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:2.43s, min:2.39s, avg: 2.4s, p80:2.43s, p95:2.43s, iters:3, tasks:3, threads:216}, tiflash_wait: {pipeline_queue_wait: 2ms}, tiflash_network: {inner_zone_receive_bytes: 849, inter_zone_receive_bytes: 848}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | N/A     | N/A     |
|             └─ExchangeSender_51            | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:2.29s, min:0s, avg: 763.9ms, p80:2.29s, p95:2.29s, iters:3, tasks:3, threads:3}, tiflash_network: {inner_zone_send_bytes: 849, inter_zone_send_bytes: 848}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.lineitem.l_returnflag, collate: utf8mb4_bin], [name: test.lineitem.l_linestatus, collate: utf8mb4_bin]                                                                                                                                                                                                                                                                                                                                                                                                                                 | N/A     | N/A     |
|               └─HashAgg_47                 | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:2.29s, min:0s, avg: 762.9ms, p80:2.29s, p95:2.29s, iters:3, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | group by:Column#100, Column#99, funcs:sum(Column#89)->Column#76, funcs:sum(Column#90)->Column#77, funcs:sum(Column#91)->Column#78, funcs:sum(Column#92)->Column#79, funcs:count(Column#93)->Column#80, funcs:sum(Column#94)->Column#81, funcs:count(Column#95)->Column#82, funcs:sum(Column#96)->Column#83, funcs:count(Column#97)->Column#84, funcs:sum(Column#98)->Column#85, funcs:count(1)->Column#86                                                                                                                                                                                                     | N/A     | N/A     |
|                 └─Projection_57            | 58794654.01 | 58773499 | mpp[tiflash] |                | tiflash_task:{proc max:1.7s, min:0s, avg: 567.6ms, p80:1.7s, p95:1.7s, iters:970, tasks:3, threads:216}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | test.lineitem.l_quantity->Column#89, test.lineitem.l_extendedprice->Column#90, mul(test.lineitem.l_extendedprice, minus(1, test.lineitem.l_discount))->Column#91, mul(mul(test.lineitem.l_extendedprice, minus(1, test.lineitem.l_discount)), plus(1, test.lineitem.l_tax))->Column#92, test.lineitem.l_quantity->Column#93, test.lineitem.l_quantity->Column#94, test.lineitem.l_extendedprice->Column#95, test.lineitem.l_extendedprice->Column#96, test.lineitem.l_discount->Column#97, test.lineitem.l_discount->Column#98, test.lineitem.l_returnflag->Column#99, test.lineitem.l_linestatus->Column#100 | N/A     | N/A     |
|                   └─Selection_36           | 58794654.01 | 58773499 | mpp[tiflash] |                | tiflash_task:{proc max:1.11s, min:0s, avg: 368.9ms, p80:1.11s, p95:1.11s, iters:970, tasks:3, threads:216}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | le(test.lineitem.l_shipdate, 1998-08-15 00:00:00.000000)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | N/A     | N/A     |
|                     └─TableFullScan_35     | 59986052.00 | 59986052 | mpp[tiflash] | table:lineitem | tiflash_task:{proc max:962.8ms, min:0s, avg: 320.9ms, p80:962.8ms, p95:962.8ms, iters:970, tasks:3, threads:216}, tiflash_wait: {pipeline_queue_wait: 21ms}, tiflash_scan:{mvcc_input_rows:0, mvcc_input_bytes:0, mvcc_output_rows:0, local_regions:49, remote_regions:0, tot_learner_read:38ms, region_balance:{instance_num: 3, max/min: 17/16=1.062500}, delta_rows:0, delta_bytes:0, segments:98, stale_read_regions:0, tot_build_snapshot:7ms, tot_build_bitmap:25ms, tot_build_inputstream:5199ms, min_local_stream:43ms, max_local_stream:817ms, dtfile:{data_scanned_rows:59986052, data_skipped_rows:0, mvcc_scanned_rows:0, mvcc_skipped_rows:0, lm_filter_scanned_rows:0, lm_filter_skipped_rows:0, tot_rs_index_check:554ms, tot_read:53977ms}} | pushed down filter:empty, keep order:false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | N/A     | N/A     |
+--------------------------------------------+-------------+----------+--------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+

Tidb Zone west

For ExchangeSender_51, all data are sent to one west tiflash node

+--------------------------------------------+-------------+----------+--------------+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+
| id                                         | estRows     | actRows  | task         | access object  | execution info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | operator info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | memory  | disk    |
+--------------------------------------------+-------------+----------+--------------+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+
| Sort_6                                     | 2.94        | 4        | root         |                | time:3.03s, open:5.07ms, close:11µs, loops:2, RU:143284.20                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | test.lineitem.l_returnflag, test.lineitem.l_linestatus                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | 11.5 KB | 0 Bytes |
| └─TableReader_54                           | 2.94        | 4        | root         |                | time:3.03s, open:5.05ms, close:9.25µs, loops:2, cop_task: {num: 4, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | MppVersion: 2, data:ExchangeSender_53                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | 1.79 KB | N/A     |
|   └─ExchangeSender_53                      | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.98s, min:2.94s, avg: 2.96s, p80:2.98s, p95:2.98s, iters:1, tasks:3, threads:3}, tiflash_network: {inner_zone_send_bytes: 1331}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | ExchangeType: PassThrough                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | N/A     | N/A     |
|     └─Projection_9                         | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.98s, min:2.94s, avg: 2.96s, p80:2.98s, p95:2.98s, iters:1, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | test.lineitem.l_returnflag, test.lineitem.l_linestatus, Column#17, Column#18, Column#19, Column#20, Column#21, Column#22, Column#23, Column#24                                                                                                                                                                                                                                                                                                                                                                                                                                                                | N/A     | N/A     |
|       └─Projection_49                      | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.98s, min:2.94s, avg: 2.96s, p80:2.98s, p95:2.98s, iters:1, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Column#17, Column#18, Column#19, Column#20, div(Column#21, cast(case(eq(Column#73, 0), 1, Column#73), decimal(20,0) BINARY))->Column#21, div(Column#22, cast(case(eq(Column#74, 0), 1, Column#74), decimal(20,0) BINARY))->Column#22, div(Column#23, cast(case(eq(Column#75, 0), 1, Column#75), decimal(20,0) BINARY))->Column#23, Column#24, test.lineitem.l_returnflag, test.lineitem.l_linestatus                                                                                                                                                                                                          | N/A     | N/A     |
|         └─HashAgg_50                       | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:2.98s, min:2.94s, avg: 2.96s, p80:2.98s, p95:2.98s, iters:1, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | group by:test.lineitem.l_linestatus, test.lineitem.l_returnflag, funcs:sum(Column#76)->Column#17, funcs:sum(Column#77)->Column#18, funcs:sum(Column#78)->Column#19, funcs:sum(Column#79)->Column#20, funcs:sum(Column#80)->Column#73, funcs:sum(Column#81)->Column#21, funcs:sum(Column#82)->Column#74, funcs:sum(Column#83)->Column#22, funcs:sum(Column#84)->Column#75, funcs:sum(Column#85)->Column#23, funcs:sum(Column#86)->Column#24, funcs:firstrow(test.lineitem.l_returnflag)->test.lineitem.l_returnflag, funcs:firstrow(test.lineitem.l_linestatus)->test.lineitem.l_linestatus                    | N/A     | N/A     |
|           └─ExchangeReceiver_52            | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:2.94s, min:2.85s, avg: 2.89s, p80:2.94s, p95:2.94s, iters:3, tasks:3, threads:216}, tiflash_wait: {pipeline_queue_wait: 2ms}, tiflash_network: {inter_zone_receive_bytes: 1699}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | N/A     | N/A     |
|             └─ExchangeSender_51            | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:2.75s, min:0s, avg: 917.2ms, p80:2.75s, p95:2.75s, iters:3, tasks:3, threads:3}, tiflash_network: {inter_zone_send_bytes: 1699}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.lineitem.l_returnflag, collate: utf8mb4_bin], [name: test.lineitem.l_linestatus, collate: utf8mb4_bin]                                                                                                                                                                                                                                                                                                                                                                                                                                 | N/A     | N/A     |
|               └─HashAgg_47                 | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:2.75s, min:0s, avg: 915.2ms, p80:2.75s, p95:2.75s, iters:3, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | group by:Column#100, Column#99, funcs:sum(Column#89)->Column#76, funcs:sum(Column#90)->Column#77, funcs:sum(Column#91)->Column#78, funcs:sum(Column#92)->Column#79, funcs:count(Column#93)->Column#80, funcs:sum(Column#94)->Column#81, funcs:count(Column#95)->Column#82, funcs:sum(Column#96)->Column#83, funcs:count(Column#97)->Column#84, funcs:sum(Column#98)->Column#85, funcs:count(1)->Column#86                                                                                                                                                                                                     | N/A     | N/A     |
|                 └─Projection_57            | 58794654.01 | 58773499 | mpp[tiflash] |                | tiflash_task:{proc max:2.2s, min:0s, avg: 734.8ms, p80:2.2s, p95:2.2s, iters:970, tasks:3, threads:216}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | test.lineitem.l_quantity->Column#89, test.lineitem.l_extendedprice->Column#90, mul(test.lineitem.l_extendedprice, minus(1, test.lineitem.l_discount))->Column#91, mul(mul(test.lineitem.l_extendedprice, minus(1, test.lineitem.l_discount)), plus(1, test.lineitem.l_tax))->Column#92, test.lineitem.l_quantity->Column#93, test.lineitem.l_quantity->Column#94, test.lineitem.l_extendedprice->Column#95, test.lineitem.l_extendedprice->Column#96, test.lineitem.l_discount->Column#97, test.lineitem.l_discount->Column#98, test.lineitem.l_returnflag->Column#99, test.lineitem.l_linestatus->Column#100 | N/A     | N/A     |
|                   └─Selection_36           | 58794654.01 | 58773499 | mpp[tiflash] |                | tiflash_task:{proc max:1.59s, min:0s, avg: 531.2ms, p80:1.59s, p95:1.59s, iters:970, tasks:3, threads:216}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | le(test.lineitem.l_shipdate, 1998-08-15 00:00:00.000000)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | N/A     | N/A     |
|                     └─TableFullScan_35     | 59986052.00 | 59986052 | mpp[tiflash] | table:lineitem | tiflash_task:{proc max:1.37s, min:0s, avg: 456.2ms, p80:1.37s, p95:1.37s, iters:970, tasks:3, threads:216}, tiflash_wait: {pipeline_queue_wait: 9ms}, tiflash_scan:{mvcc_input_rows:0, mvcc_input_bytes:0, mvcc_output_rows:0, local_regions:49, remote_regions:0, tot_learner_read:40ms, region_balance:{instance_num: 3, max/min: 17/16=1.062500}, delta_rows:0, delta_bytes:0, segments:98, stale_read_regions:0, tot_build_snapshot:8ms, tot_build_bitmap:24ms, tot_build_inputstream:7337ms, min_local_stream:60ms, max_local_stream:1182ms, dtfile:{data_scanned_rows:59986052, data_skipped_rows:0, mvcc_scanned_rows:0, mvcc_skipped_rows:0, lm_filter_scanned_rows:0, lm_filter_skipped_rows:0, tot_rs_index_check:1463ms, tot_read:69838ms}} | pushed down filter:empty, keep order:false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | N/A     | N/A     |
+--------------------------------------------+-------------+----------+--------------+----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+

Tidb Zone west, fine grained count = 8

For ExchangeSender_51, all data are sent to one west tiflash node

+--------------------------------------------+-------------+----------+--------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+
| id                                         | estRows     | actRows  | task         | access object  | execution info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | operator info                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | memory  | disk    |
+--------------------------------------------+-------------+----------+--------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+
| Sort_6                                     | 2.94        | 4        | root         |                | time:1.61s, open:15.4ms, close:12.7µs, loops:2, RU:115859.54                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | test.lineitem.l_returnflag, test.lineitem.l_linestatus                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | 11.5 KB | 0 Bytes |
| └─TableReader_54                           | 2.94        | 4        | root         |                | time:1.61s, open:15.4ms, close:10.3µs, loops:2, cop_task: {num: 7, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | MppVersion: 2, data:ExchangeSender_53                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | 1.79 KB | N/A     |
|   └─ExchangeSender_53                      | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:1.39s, min:1.37s, avg: 1.38s, p80:1.39s, p95:1.39s, iters:4, tasks:3, threads:24}, tiflash_network: {inner_zone_send_bytes: 1652}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | ExchangeType: PassThrough                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | N/A     | N/A     |
|     └─Projection_9                         | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:1.38s, min:1.37s, avg: 1.38s, p80:1.38s, p95:1.38s, iters:4, tasks:3, threads:24}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | test.lineitem.l_returnflag, test.lineitem.l_linestatus, Column#17, Column#18, Column#19, Column#20, Column#21, Column#22, Column#23, Column#24                                                                                                                                                                                                                                                                                                                                                                                                                                                                | N/A     | N/A     |
|       └─Projection_49                      | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:1.38s, min:1.37s, avg: 1.38s, p80:1.38s, p95:1.38s, iters:4, tasks:3, threads:24}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Column#17, Column#18, Column#19, Column#20, div(Column#21, cast(case(eq(Column#73, 0), 1, Column#73), decimal(20,0) BINARY))->Column#21, div(Column#22, cast(case(eq(Column#74, 0), 1, Column#74), decimal(20,0) BINARY))->Column#22, div(Column#23, cast(case(eq(Column#75, 0), 1, Column#75), decimal(20,0) BINARY))->Column#23, Column#24, test.lineitem.l_returnflag, test.lineitem.l_linestatus                                                                                                                                                                                                          | N/A     | N/A     |
|         └─HashAgg_50                       | 2.94        | 4        | mpp[tiflash] |                | tiflash_task:{proc max:1.38s, min:1.37s, avg: 1.38s, p80:1.38s, p95:1.38s, iters:4, tasks:3, threads:24}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | group by:test.lineitem.l_linestatus, test.lineitem.l_returnflag, funcs:sum(Column#76)->Column#17, funcs:sum(Column#77)->Column#18, funcs:sum(Column#78)->Column#19, funcs:sum(Column#79)->Column#20, funcs:sum(Column#80)->Column#73, funcs:sum(Column#81)->Column#21, funcs:sum(Column#82)->Column#74, funcs:sum(Column#83)->Column#22, funcs:sum(Column#84)->Column#75, funcs:sum(Column#85)->Column#23, funcs:sum(Column#86)->Column#24, funcs:firstrow(test.lineitem.l_returnflag)->test.lineitem.l_returnflag, funcs:firstrow(test.lineitem.l_linestatus)->test.lineitem.l_linestatus, stream_count: 8   | N/A     | N/A     |
|           └─ExchangeReceiver_52            | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:1.38s, min:1.37s, avg: 1.37s, p80:1.38s, p95:1.38s, iters:4, tasks:3, threads:24}, tiflash_wait: {pipeline_queue_wait: 1ms}, tiflash_network: {inter_zone_receive_bytes: 4018}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | stream_count: 8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | N/A     | N/A     |
|             └─ExchangeSender_51            | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:1.29s, min:0s, avg: 431.6ms, p80:1.29s, p95:1.29s, iters:3, tasks:3, threads:3}, tiflash_network: {inter_zone_send_bytes: 4018}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: test.lineitem.l_returnflag, collate: utf8mb4_bin], [name: test.lineitem.l_linestatus, collate: utf8mb4_bin], stream_count: 8                                                                                                                                                                                                                                                                                                                                                                                                                | N/A     | N/A     |
|               └─HashAgg_47                 | 2.94        | 12       | mpp[tiflash] |                | tiflash_task:{proc max:1.27s, min:0s, avg: 425ms, p80:1.27s, p95:1.27s, iters:3, tasks:3, threads:3}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | group by:Column#100, Column#99, funcs:sum(Column#89)->Column#76, funcs:sum(Column#90)->Column#77, funcs:sum(Column#91)->Column#78, funcs:sum(Column#92)->Column#79, funcs:count(Column#93)->Column#80, funcs:sum(Column#94)->Column#81, funcs:count(Column#95)->Column#82, funcs:sum(Column#96)->Column#83, funcs:count(Column#97)->Column#84, funcs:sum(Column#98)->Column#85, funcs:count(1)->Column#86                                                                                                                                                                                                     | N/A     | N/A     |
|                 └─Projection_57            | 58794654.01 | 58773499 | mpp[tiflash] |                | tiflash_task:{proc max:915.9ms, min:0s, avg: 305.3ms, p80:915.9ms, p95:915.9ms, iters:970, tasks:3, threads:216}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | test.lineitem.l_quantity->Column#89, test.lineitem.l_extendedprice->Column#90, mul(test.lineitem.l_extendedprice, minus(1, test.lineitem.l_discount))->Column#91, mul(mul(test.lineitem.l_extendedprice, minus(1, test.lineitem.l_discount)), plus(1, test.lineitem.l_tax))->Column#92, test.lineitem.l_quantity->Column#93, test.lineitem.l_quantity->Column#94, test.lineitem.l_extendedprice->Column#95, test.lineitem.l_extendedprice->Column#96, test.lineitem.l_discount->Column#97, test.lineitem.l_discount->Column#98, test.lineitem.l_returnflag->Column#99, test.lineitem.l_linestatus->Column#100 | N/A     | N/A     |
|                   └─Selection_36           | 58794654.01 | 58773499 | mpp[tiflash] |                | tiflash_task:{proc max:529.9ms, min:0s, avg: 176.6ms, p80:529.9ms, p95:529.9ms, iters:970, tasks:3, threads:216}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | le(test.lineitem.l_shipdate, 1998-08-15 00:00:00.000000)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | N/A     | N/A     |
|                     └─TableFullScan_35     | 59986052.00 | 59986052 | mpp[tiflash] | table:lineitem | tiflash_task:{proc max:308.9ms, min:0s, avg: 103ms, p80:308.9ms, p95:308.9ms, iters:970, tasks:3, threads:216}, tiflash_wait: {pipeline_queue_wait: 4ms}, tiflash_scan:{mvcc_input_rows:0, mvcc_input_bytes:0, mvcc_output_rows:0, local_regions:49, remote_regions:0, tot_learner_read:16ms, region_balance:{instance_num: 3, max/min: 17/16=1.062500}, delta_rows:0, delta_bytes:0, segments:98, stale_read_regions:0, tot_build_snapshot:5ms, tot_build_bitmap:208ms, tot_build_inputstream:4226ms, min_local_stream:58ms, max_local_stream:214ms, dtfile:{data_scanned_rows:59986052, data_skipped_rows:0, mvcc_scanned_rows:0, mvcc_skipped_rows:0, lm_filter_scanned_rows:0, lm_filter_skipped_rows:0, tot_rs_index_check:1002ms, tot_read:41763ms}} | pushed down filter:empty, keep order:false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | N/A     | N/A     |
+--------------------------------------------+-------------+----------+--------------+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+---------+

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Jan 3, 2025
@sre-bot
Copy link
Contributor

sre-bot commented Jan 3, 2025

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 3, 2025
@yibin87 yibin87 changed the title executor,util: Stat inner/inter zone network traffic for MPP tasks [WIP]executor,util: Stat inner/inter zone network traffic for MPP tasks Jan 3, 2025
@ti-chi-bot ti-chi-bot bot added sig/planner SIG: Planner do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jan 3, 2025
Copy link

tiprow bot commented Jan 3, 2025

Hi @yibin87. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@yibin87 yibin87 changed the title [WIP]executor,util: Stat inner/inter zone network traffic for MPP tasks executor,util: Stat inner/inter zone network traffic for MPP tasks Jan 10, 2025
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 10, 2025
Signed-off-by: yibin87 <[email protected]>
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 64.54849% with 106 lines in your changes missing coverage. Please review.

Project coverage is 73.1372%. Comparing base (6463db6) to head (8877c6d).
Report is 51 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58683        +/-   ##
================================================
+ Coverage   73.1194%   73.1372%   +0.0178%     
================================================
  Files          1677       1685         +8     
  Lines        463911     472577      +8666     
================================================
+ Hits         339209     345630      +6421     
- Misses       103860     105983      +2123     
- Partials      20842      20964       +122     
Flag Coverage Δ
integration 42.9643% <5.6856%> (?)
unit 72.3412% <64.5484%> (+0.0457%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 43.1339% <ø> (-2.6171%) ⬇️

Signed-off-by: yibin87 <[email protected]>
Signed-off-by: yibin87 <[email protected]>
@yibin87
Copy link
Contributor Author

yibin87 commented Jan 14, 2025

/cc @xzhangxian1008 @windtalker

@yibin87
Copy link
Contributor Author

yibin87 commented Jan 14, 2025

/test check-dev

Copy link

tiprow bot commented Jan 14, 2025

@yibin87: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test check-dev

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Signed-off-by: yibin87 <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 14, 2025
return
}
tiflashNetworkStats := runtimeStatsColl.GetStmtCopRuntimeStats().TiflashNetworkStats
if tiflashNetworkStats == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we can dirctly return when tiflashNetworkStats == nil without setting tikv detail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set tikv details here to record mpp network traffic. When tiflashNetworkStats is nil, which means there is no mpp network traffic recorded, thus no need to set a default value tikv detail.

h.exchangeZoneInfo[*exec.ExecutorId] = zoneInfos
}
for i := 0; i < slots; i++ {
sameZoneFlags = append(sameZoneFlags, len(zoneInfos[i]) == 0 || h.currentTaskZone == zoneInfos[i])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When will len(zoneInfos[i]) be 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the respond tiflash node doesn't have zone label, in this situation, "" will be filled.

children = append(children, exec.TopN.Child)
case tipb.ExecType_TypeLimit:
children = append(children, exec.Limit.Child)
case tipb.ExecType_TypeExchangeSender:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of codes in sender and receiver are similiar, I think wemay create a function to unify them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll try

for _, tiflashStore := range allTiFlashStores {
tiflashStoreAddr := tiflashStore.GetAddr()
if tiflashZone, isSet := tiflashStore.GetLabelValue(placement.DCLabelKey); isSet {
h.allTiflashZoneInfo[tiflashStoreAddr] = tiflashZone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allTiflashZoneInfo seems to be repeated initialized in multi zoneHelpers. Maybe we can init allTiflashZoneInfo in one place for only once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll change it.

Signed-off-by: yibin87 <[email protected]>
Copy link
Contributor

@xzhangxian1008 xzhangxian1008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 17, 2025
Signed-off-by: yibin87 <[email protected]>
go.mod Outdated
@@ -330,3 +330,4 @@ replace (
sourcegraph.com/sourcegraph/appdash => github.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
sourcegraph.com/sourcegraph/appdash-data => github.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add an extra blank line here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

a.GoCtx = context.WithValue(a.GoCtx, util.ExecDetailsKey, tikvExecDetailRaw)
}

tikvExecDetail = *(tikvExecDetailRaw.(*util.ExecDetails))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that tikvExecDetail is just a local variable who's value is copied from tikvExecDetailRaw, is that the expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, changed to pointer type

return helper
}

/*func (h *taskZoneInfoHelper) tryQuickFillWithUncertainZones(exec *tipb.Executor, slots int, sameZoneFlags []bool) (bool, []bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why keep this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Signed-off-by: yibin87 <[email protected]>
@yibin87 yibin87 requested a review from windtalker January 20, 2025 07:30
Signed-off-by: yibin87 <[email protected]>
Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link

ti-chi-bot bot commented Jan 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: windtalker, xzhangxian1008

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 21, 2025
Copy link

ti-chi-bot bot commented Jan 21, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-17 03:39:08.705477226 +0000 UTC m=+262620.160523379: ☑️ agreed by xzhangxian1008.
  • 2025-01-21 01:24:42.289095158 +0000 UTC m=+144009.620014562: ☑️ agreed by windtalker.

@ti-chi-bot ti-chi-bot bot merged commit c34a6b6 into pingcap:master Jan 21, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stat inner/inter zone network traffic for MPP tasks
4 participants