我要评分
获取效率
正确性
完整性
易理解

Usage

Dependencies

To use D-FOT, you need to install the following dependent components. You can use yum to install them. Currently, openEuler-22.03-LTS-SP4 and openEuler-25.03 are supported.

Component

Code Repository

Description

oeAware-manager

Link

Online imperceptible service optimization framework

libkperf

Link

Lightweight full-memory collection tool

sysboost

Link

Micro-architecture optimization tool

llvm-bolt

Link

Binary optimizer

Necessary Conditions for Applications to Be Optimized

The optimized binary must contain relocation information.

  • If self-compiled software is used, the link option -Wl,-q is needed during compilation. An example in MySQL is as follows:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DBUILD_CONFIG=mysql_release -DWITH_BOOST=../boost -DCMAKE_C_LINK_FLAGS="-Wl,-q" -DCMAKE_CXX_LINK_FLAGS="-Wl,-q"
  • If the oe software package is used, a relocation package of the corresponding application will be provided later and you can directly install it.

How to determine whether the target binary contains relocation information:

After -Wl,-q takes effect, multiple RELA segments are added to the binary file. You can run readelf -SW /path/to/bin to view the segment information. For example, if -Wl,-q is not added to MySQL, only the .rela.dyn and .rela.plt segments are present. After the option is added, more than ten RELA segments, such as .rela.text and .rela.eh_frame, are generated.

If -Wl,-q does not take effect, if perf sampling is manually performed and perf2bolt is run, or llvm-bolt is used for optimization (regardless of whether the sysboost mechanism is used), the "BOLT-WARNING: non-relocation mode for AArch64 is not fully supported" alarm is triggered.

Preparation for Using D-FOT

Modify /etc/dfot/dfot.ini based on information about the application to be optimized. The contents are described as follows. Generally, only the [app] part needs to be modified.

[general] part

Configuration Item

Value Range

Available

Description

LOG_LEVEL

<FATAL,ERROR,WARN,INFO,DEBUG>

Yes

Log level of the service to be optimized. Note that the lower the level, the greater the number of logs that will be printed.

COLLECTOR_SAMPLING_STRATEGY

<0>

No

Sampling strategy.

  • 0: After being enabled, the dfot_tuner_sysboost plug-in performs low-frequency sampling continuously.
  • 1: When being enabled, the dfot_tuner_sysboost plug-in starts the monitoring thread. It performs sampling only when loads reach the specified threshold.

Currently, the sampling process is controlled by oeAware. The value can only be 0.

COLLECTOR_HIGH_LOAD_THRESHOLD

[0,cpus*100]

No

This configuration item (unsupported currently) takes effect only when sampling strategy 1 is applied. It uses HIGH_LOAD_THRESHOLD as the application CPU usage threshold for triggering sampling.

COLLECTOR_DATA_AGING_TIME

Configure the value based on actual requirements.

Yes

Aging time (in ms) of sampled data. When the time difference between the current data and the earliest data reaches the specified threshold, the accumulated sampled data will be discarded.

TUNER_TOOL

["sysboost"]

No

Binary optimizer. Currently, only sysboost is supported.

TUNER_CHECK_PERIOD

[10,max]

Yes

Check interval (in ms) of the optimization plug-in. The sampling plug-in's data is collected at the specified interval to determine whether optimization is necessary.

TUNER_PROFILE_DIR

Configure the value based on actual requirements.

Yes

Location where the sampled data is stored. The profiles are named [app_name]_[full_path_hash]_[threshold].profile.

TUNER_OPTIMIZING_STRATEGY

[0,1]

Yes

Optimization strategy. 0 indicates that optimization is performed only once. 1 indicates that optimization can be performed multiple times as long as the sampled data is updated.

TUNER_OPTIMIZING_CONDITION

[0,2]

No

Condition for triggering optimization. 0 indicates that optimization starts immediately after the application exits. 1 indicates that optimization is performed during low-load periods. 2 indicates that optimization is performed when both the application exits and low-load conditions are present. Currently, only 0 is supported.

[app] part

Configuration Item

Value Range

Available

Description

FULL_PATH

Configure the value based on actual requirements.

Yes

Absolute path to the application's binary file.

DEFAULT_PROFILE

Configure the value based on actual requirements.

Yes

Default profile of the application, which is used to enable binary optimization during cold startup. Leave it empty if there is no default profile.

COLLECTOR_DUMP_DATA_THRESHOLD

[10000,max]

Yes

When the number of sampled data rows reaches the specified threshold, data will be exported to a profile. A larger value indicates that more samples are collected.

BOLT_DIR

N/A

No

BOLT tool path. If it is left empty, the default path /usr/bin will be used. ${BOLT_DIR}/perf2bolt and ${BOLT_DIR}/llvm-bolt are called internally.

Determined by sysboost.

BOLT_OPTIONS

Configure the value based on actual requirements.

Yes

BOLT optimization options. This configuration item can overwrite the built-in default options for targeted optimization.

UPDATE_DEBUG_INFO

[0,1]

Yes

Specifies whether to update the debugging information synchronously during optimization. 1 indicates that the debugging information is updated, while 0 indicates that it is not updated. Note that updating the debugging information will take extra time.

Enabling D-FOT

Use the optimization plug-in by referring to the oeAware-manager user manual.

# Start the oeAware optimization service.
systemctl start oeaware

# Start the PMU collection plug-in and D-FOT optimization plug-in for oeAware.
oeawarectl -e pmu_sampling_collector
oeawarectl -e dfot_tuner_sysboost

# D-FOT log
tail -f /etc/dfot/dfot.log

# Stop the oeAware plug-ins.
oeawarectl -d pmu_sampling_collector
oeawarectl -d dfot_tuner_sysboost