| --- |
| { |
| "title": "Pipeline Tracing", |
| "language": "en" |
| } |
| --- |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| In the Pipeline execution engine, we split the execution plan tree of each Instance into multiple small Pipeline Tasks and execute them under our custom Pipeline scheduler. Therefore, in an environment with a large number of Pipeline Tasks executing, how these Tasks are scheduled across threads and CPU cores is an important factor for execution performance. We have developed a specialised tool to observe the scheduling process on a particular query or time period, which we call "Pipeline Tracing". |
| |
| ## Usage steps |
| |
| ### 1. Record Data |
| |
| First we need to log the Pipeline scheduling process. Whether and how to log the scheduling process can be set via the HTTP interface. These settings are associated with a specific BE: |
| |
| 1. Turn off Pipeline Tracing record |
| |
| ```shell |
| curl -X POST http://{be_host}:{http_port}/api/pipeline/tracing?type=disable |
| ``` |
| |
| 2. Generate a record for each Query |
| |
| ```shell |
| curl -X POST http://{be_host}:{http_port}/api/pipeline/tracing?type=perquery |
| ``` |
| |
| 3. Generate Tracing records for a fixed period of time |
| |
| ```shell |
| curl -X POST http://{be_host}:{http_port}/api/pipeline/tracing?type=periodic |
| ``` |
| |
| Set the time period (in seconds): |
| ```shell |
| curl -X POST http://{be_host}:{http_port}/api/pipeline/tracing?dump_interval=60 |
| ``` |
| |
| ### 2. Format Conversion |
| |
| The logged data will be generated in the `log/tracing` directory of the corresponding BE. The next step is to convert the data to a file that matches the format required by the visualisation tool. A conversion tool is provided to convert the tracing logs generated by the BE, which can be executed directly: |
| |
| ```shell |
| cd doris/tools/pipeline-tracing/ |
| python3 origin-to-show.py -s <SOURCE_FILE> -d <DEST>.json |
| ``` |
| |
| to generate a json file that can be displayed. For more detailed instructions, see the `README.md` file in this directory. |
| |
| ### 3. Visualisation |
| |
| Pipeline Tracing is visualised using [Perfetto](https://ui.perfetto.dev/). After generating a file in the legal format, select "Open trace file" on its page to open the file and view the results: |
| |
|  |
| |
| The tool is very powerful. For example, it is easy to see how the same Task is scheduled across cores. |
| |
|  |