You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`--instrumentation-file`: Path where the profile output will be saved
112
-
-`--instrumentation-wait-forks`: Ensures the instrumentation continues through forks (important for daemon processes)
113
-
114
-
115
-
## Start the instrumented MySQL server
116
-
117
-
Before running the workload, start the instrumented MySQL server in a separate terminal. You may need to initialize a new data directory if this is your first run:
105
+
Start the instrumented server. On an 8-core system, use available cores (e.g., 2 for mysqld, 7 for sysbench). Run the command from build directory.
Adjust `--datadir`, `--socket`, and `--port` as needed for your environment. Make sure the server is running and accessible before proceeding.
133
141
134
-
With the database running, open a second terminal to run the client commands.
135
-
136
-
## Install sysbench
137
-
138
-
You will need sysbench to generate workloads for MySQL. On most Arm Linux distributions, you can install it using your package manager:
142
+
With the database running, open a second terminal to create a benchmark User and third terminal to run the client commands.
139
143
144
+
## Create Benchmark User and Database
145
+
Run once after initializing MySQL for the first time:
140
146
```bash
141
-
sudo apt update
142
-
sudo apt install -y sysbench
147
+
bin/mysql -u root <<<"
148
+
CREATE USER 'bench'@'localhost' IDENTIFIED BY 'bench';
149
+
CREATE DATABASE bench;
150
+
GRANT ALL PRIVILEGES ON *.* TO 'bench'@'localhost' WITH GRANT OPTION;
151
+
FLUSH PRIVILEGES;"
143
152
```
144
153
145
-
Alternatively, see the [sysbench GitHub page](https://github.com/akopytov/sysbench) for build-from-source instructions if a package is not available for your platform.
154
+
This sets up the bench user and the bench database with full privileges. Do not repeat this before every test — it is only required once.
146
155
147
-
## Create a test database and user
156
+
## Reset Benchmark Database Between Runs
148
157
149
-
For sysbench to work, you need a test database and user. Connect to the MySQL server as the root user (or another admin user) and run:
158
+
This clears all existing tables and data from the bench database, giving you a clean slate for sysbench prepare without needing to recreate the user or reinitialize the datadir.
-`--instrumentation-file`: Path where the profile output will be saved
246
+
-`--instrumentation-wait-forks`: Ensures the instrumentation continues through forks (important for daemon processes)
247
+
248
+
## Run the instrumented binary under a feature-specific workload
249
+
250
+
Start the MySQL instrumented binary in first terminal.
251
+
183
252
Use a workload generator to stress the binary in a feature-specific way. For example, to simulate **read-only traffic** with sysbench:
184
253
185
254
```bash
186
-
taskset -c 7 sysbench \
255
+
taskset -c 7 ./src/sysbench \
187
256
--db-driver=mysql \
188
257
--mysql-host=127.0.0.1 \
189
258
--mysql-db=bench \
@@ -192,16 +261,30 @@ taskset -c 7 sysbench \
192
261
--mysql-port=3306 \
193
262
--tables=8 \
194
263
--table-size=10000 \
264
+
--forced-shutdown \
265
+
--report-interval=60 \
266
+
--rand-type=uniform \
267
+
--time=5 \
195
268
--threads=1 \
196
-
/usr/share/sysbench/oltp_read_only.lua run
269
+
--simple-ranges=1 \
270
+
--distinct-ranges=1 \
271
+
--sum-ranges=1 \
272
+
--order-ranges=1 \
273
+
--point-selects=10 \
274
+
src/lua/oltp_read_only.lua run
197
275
```
198
276
199
277
{{% notice Note %}}
200
-
On an 8-core system, cores are numbered 0-7. Adjust the `taskset -c` values as needed for your system. Avoid using the same core for both mysqld and sysbench to reduce contention.
278
+
On an 8-core system, cores are numbered 0-7. Adjust the `taskset -c` values as needed for your system. Avoid using the same core for both mysqld and sysbench to reduce contention. You can increase this time (e.g., --time=5 or --time=300) for more statistically meaningful profiling and better .fdata data.
201
279
{{% /notice %}}
202
280
203
281
The `.fdata` file defined in `--instrumentation-file` will be populated with runtime execution data.
204
282
283
+
After completing each benchmark run (e.g. after sysbench run), you must cleanly shut down the MySQL server and reset the dataset to ensure the next test starts from a consistent state.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/bolt-merge/how-to-3.md
+33-16Lines changed: 33 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,23 @@ Next, you will collect profile data for a **write-heavy** workload and merge the
10
10
11
11
## Run Write-Only Workload for Application Binary
12
12
13
-
Use the same BOLT-instrumented MySQL binary and drive it with a write-only workload to capture `profile-writeonly.fdata`:
13
+
Use the same BOLT-instrumented MySQL binary and drive it with a write-only workload to capture `profile-writeonly.fdata`
14
+
15
+
For this you can reuse the existing instrumented binary, rename .fdata appropriately for read and write workloads or run llvm-bolt with new file target.
2>&1| tee $HOME/mysql-server/bolt-instrumentation-writeonly.log
25
+
```
14
26
15
27
```bash
16
28
# On an 8-core system, use available cores (e.g., 7 for sysbench)
17
-
taskset -c 7 sysbench \
29
+
taskset -c 7 ./src/sysbench \
18
30
--db-driver=mysql \
19
31
--mysql-host=127.0.0.1 \
20
32
--mysql-db=bench \
@@ -23,13 +35,25 @@ taskset -c 7 sysbench \
23
35
--mysql-port=3306 \
24
36
--tables=8 \
25
37
--table-size=10000 \
38
+
--forced-shutdown \
39
+
--report-interval=60 \
40
+
--rand-type=uniform \
41
+
--time=5 \
26
42
--threads=1 \
27
-
/usr/share/sysbench/oltp_write_only.lua run
43
+
--simple-ranges=1 \
44
+
--distinct-ranges=1 \
45
+
--sum-ranges=1 \
46
+
--order-ranges=1 \
47
+
--point-selects=10 \
48
+
src/lua/oltp_write_only.lua run
28
49
```
29
50
30
51
Make sure that the `--instrumentation-file` is set appropriately to save `profile-writeonly.fdata`.
31
52
32
-
53
+
After completing each benchmark run (e.g. after sysbench run), you must cleanly shut down the MySQL server and reset the dataset to ensure the next test starts from a consistent state.
2>&1| tee $HOME/mysql-server/build/bolt-readwritemerged-opt.log
93
110
```
94
111
95
112
This command optimizes the binary layout based on the merged workload profile, creating a single binary (`mysqldreadwrite_merged.bolt_instrumentation`) that is optimized across both features.
0 commit comments