---
title: BOLT优化方法
description: "1. 使用BOLT构建插桩版MySQL，生成插桩的二进制mysqld.inst。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevps/compilation/ug-bisheng/kunpengbisheng_30_0028.html
sourcePath: /source/zh/kunpengdevps/compilation/ug-bisheng/kunpengbisheng_30_0028.html
indexId: f6019cf148fb156deb294bc76789d8159316a0c35f0198b124eb63b5a4ff894574
---
# BOLT优化方法

1. 使用BOLT构建插桩版MySQL，生成插桩的二进制mysqld.inst。
  1 llvm-bolt $SHELL_PATH/install/bin/mysqld -instrument -o mysqld.inst -instrumentation-file=mysqld.fdata --instrumentation-wait-forks -instrumentation-sleep-time=2 -instrumentation-no-counters-clear --instrumentation-binpath=$SHELL_PATH/install/bin/mysqld.inst # mysqld.fdata为profile文件的指定目录

2. 使用插桩后的二进制mysqld.inst运行典型的benchmark，如sysbench、TPCC。运行结束、退出mysql后，会生成名为mysqld.fdata的profile文件。
3. 结合采集的profile文件，生成高性能的mysql二进制mysqld.opt。
  1 llvm-bolt $SHELL_PATH/install/bin/mysqld -o mysqld.opt -data=mysqld.fdata --infer-fall-throughs --reorder-blocks=ext-tsp --reorder-functions=hfsort --peepholes=useless-branches --simplify-conditional-tail-calls --simplify-rodata-loads --indirect-call-promotion-use-mispredicts --elim-link-veneers --eliminate-unreachable --fix-block-counts --fix-func-counts --split-all-cold --sctc-mode=preserve --align-blocks --cg-use-split-hot-size --tail-duplication=aggressive --iterative-guess --assume-abi
