This article is reprinted from the Jishu Community.
Jishu Column: Arm Server
Author:BoltLiu
This is a test report on enabling MySQL PGO. Correctly enabling MySQL PGO leads to significant performance improvements, with write performance increasing by about 13% and read performance increasing by about 20%.
Environment Setup
The testing environment is set up on an ARM server ECS requested from Aliyun, as shown in the table below:

MySQL PGO Compilation Steps
- 
Add the parameter “-DFPROFILE_GENERATE=ON” during cmake, then compile:  
$ cd mysql-server-8.0.33
$ mkdir build
$ cmake -DCMAKE_C_FLAGS="-g -O3 -march=native -mcpu=native -flto" -DCMAKE_CXX_FLAGS="-g -O3 -march=native -mcpu=native -flto" -DCMAKE_INSTALL_PREFIX=/mysql_data/mysql_8.0.33_gcc_11.3.0_profile -DWITH_BOOST=/build/boost_1_77_0 -DFPROFILE_GENERATE=ON ..
$ make -j $(nproc)
$ make install
- 
Start MySQL installed in /mysql_data/mysql_8.0.33_gcc_11.3.0_profile, run write and read performance tests from the client, and the profile data will be generated in the directory:  
         mysql-server-8.0.33/build-profile-data
- 
Add the parameter “-DFPROFILE_USE=ON” and recompile MySQL:  
$ cd mysql-server-8.0.33
$ rm rf build && mkdir build # make sure it's same build directory as in step 1, or it would fail to find the profile data under build-profile-data
$ cmake -DCMAKE_C_FLAGS="-g -O3 -march=native -mcpu=native -flto" -DCMAKE_CXX_FLAGS="-g -O3 -march=native -mcpu=native -flto" -DCMAKE_INSTALL_PREFIX=/mysql_data/mysql_8.0.33_gcc_11.3.0_pgo  -DWITH_BOOST=/build/boost_1_77_0 -DFPROFILE_USE=ON ..
$ make -j $(nproc)
$ make install
Test Results
- 
Restart the server machine
 - 
Start the non-PGO version of MySQL
 - 
Run write tests
 - 
Run read tests
 - 
Repeat steps 1 to 4 a total of 3 times
 - 
Restart the server machine
 - 
Start the PGO version of MySQL
 - 
Run write tests
 - 
Run read tests
 - 
Repeat steps 6 to 9 a total of 3 times
 
Write Test Results
Throughput:
    events/s (eps):                      7837.0387
    time elapsed:                        300.0977s
    total number of events:              2351876
Throughput:
    events/s (eps):                      7616.9932
    time elapsed:                        300.0844s
    total number of events:              2285740
Throughput:
    events/s (eps):                      7893.9496
    time elapsed:                        300.0817s
    total number of events:              2368829
Read Test Results
The following are the results of 3 rounds of read tests for the non-PGO version:
Throughput:
    events/s (eps):                      3768.8060
    time elapsed:                        300.1503s
    total number of events:              1131208
Throughput:
    events/s (eps):                      3688.1464
    time elapsed:                        300.1504s
    total number of events:              1106998
Throughput:
    events/s (eps):                      3774.9087
    time elapsed:                        300.1509s
    total number of events:              1133042
PGO Version
Write Test Results (+13.4%, +16.7%, +11.8%)
The following are the write test results for the 3 rounds of the PGO version, compared to the non-PGO version, with performance improvements of 13.4%, 16.7%, and 11.8% respectively:
Throughput:
    events/s (eps):                      8891.5023
    time elapsed:                        300.0943s
    total number of events:              2668288
Throughput:
    events/s (eps):                      8892.7030
    time elapsed:                        300.0876s
    total number of events:              2668589
Throughput:
    events/s (eps):                      8831.1063
    time elapsed:                        300.0857s
    total number of events:              2650088
Read Test Results (+25.9%, +20.9%, +16.4%)
The following are the read test results for the 3 rounds of the PGO version, compared to the non-PGO version, with performance improvements of 25.9%, 20.9%, and 16.4% respectively:
Throughput:
    events/s (eps):                      4746.7576
    time elapsed:                        300.1492s
    total number of events:              1424735
Throughput:
    events/s (eps):                      4460.4811
    time elapsed:                        300.1489s
    total number of events:              1338808
Throughput:
    events/s (eps):                      4395.7754
    time elapsed:                        300.1699s
    total number of events:              1319479
Copyright belongs to the original author. If there is any infringement, please contact for deletion.
END
关于安芯教育
安芯教育是聚焦AIoT(人工智能+物联网)的创新教育平台,提供从中小学到高等院校的贯通式AIoT教育解决方案。
安芯教育依托Arm技术,开发了ASC(Arm智能互联)课程及人才培养体系。已广泛应用于高等院校产学研合作及中小学STEM教育,致力于为学校和企业培养适应时代需求的智能互联领域人才。