Preparing a Run Script
The GCC FDO component uses a run script to start optimized applications. Therefore, a run script needs to be prepared. The run script contains the startup and test commands.
Its contents depend on the actual environment. For example, in the sysbench and TPC-C tests, the run script must contain the following contents:
- Commands for starting MySQL
- Commands for starting the test
- Custom test execution duration (The recommended execution duration for a sysbench or TPC-C test is 5 to 10 minutes.)
Preparing a Run Script
The following uses the BenchmarkSQL test tool as an example to describe how to create a run script. For details about how to use BenchmarkSQL, see BenchmarkSQL Test Guide.
- Optional: Install MySQL by referring to MySQL Porting Guide. If MySQL has been installed, skip this step.
- Optional: Load test data by referring to BenchmarkSQL Test Guide. If the database contains the BenchmarkSQL test data, skip this step.
- Create a run script file.
1vi /root/run.sh - Press i to enter the insert mode and add the following contents to the file:
1 2 3
/usr/local/mysql-gcc/bin/mysqld --defaults-file=/etc/my.cnf & # This command is used to start MySQL. /usr/local/mysql-gcc is the MySQL installation path in the MySQL run script. Change the path to the actual one. sleep 60 # Wait until the MySQL startup is complete. The waiting time depends on the actual environment. cd /home/benchmarksql5.0-for-mysql/run && bash runBenchmark.sh my_mysql.properties # This is the TPC-C test command. To remotely run this command, you can configure password-free login and run this command through SSH.
- If remote execution is required, you can configure password-free login to the remote server and run TPC-C test commands through SSH. For details about how to configure password-free login to a remote server, see Configuring Password-free Login to a Remote Server Through SSH.
- You are advised to change the test duration in the props.conf configuration file to 5 to 10 minutes. For details about how to change the test duration, see Changing the Test Duration.
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
Configuring Password-free Login to a Remote Server Through SSH
- Run the following command to generate a public-private key pair.
The system will ask you where to store the generated key pair. Press Enter to use the default directory. If the system prompts you to enter a passphrase, press Enter to use the default value.
1ssh-keygen

- Ensure that a key pair has been generated in the specified directory.
1ll /root/.ssh/
- Run the following command to add the contents of the id_rsa.pub public key on the local host to the /root/.ssh/authorized_keys file on the server. Assume that the IP address of the local host is 192.168.53.222. When the system prompts you to enter the password of the root user on the server, enter the password and press Enter.
1ssh-copy-id root@192.168.53.222
- Run the test command remotely through SSH.
1ssh root@192.168.53.222 "cd benchamrksql-5.0/run && bash runBenchmark.sh props.conf"
Changing the Test Duration
This section describes how to change the test duration in the props.conf file to 12 minutes. Set the test duration based on the actual requirements.
- Open the props.conf configuration file.
1vi props.conf - Press i to enter the insert mode and change the test duration in the props.conf file to 12 minutes, that is, change the value of runMins to 12.
1runMins=12
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.