Dynimizer Quickstart Tutorial

Dynimizer Quickstart Tutorial

Duration: 10 min

Level: Beginner

 

This tutorial will show you how to install Dynimizer. We'll then use it to optimize a live MySQL process that's been running the Sysbench OLTP benchmark, obtaining a 46% increase in performance by applying Dynimizer.

 

Part 1:  Quickstart

 

Here's a quick overview of how to use Dynimizer.

To install Dynimizer, run

$ sudo bash -c 'bash <(wget -O - https://dynimize.com/install) -default'

 

To start Dynimizer, run

$ sudo dyni -start

 

To check the status of Dynimizer and any optimization targets, run:

$ sudo dyni -status

 

Once a target process has been fully optimized, the above command will report:

Dynimizer is running
mysqld, pid: 21091, dynimized

 

It could take anywhere from 30 to 300s of CPU intensive activity from the target process before Dynimizer has completed profiling and optimizing that process.

Deciding which applications to target can be done by editing the list of supported target exes in /etc/dyni.conf under the [exeList] section.

To stop Dynimizer, run:

$ sudo dyni -stop

 

 

Part 2:   Benchmarking with Dynimizer

 

In the remainder of this tutorial we'll demonstrate how to benchmark MySQL using the Sysbench OLTP benchmark, and then improve on the benchmark results by installing and running Dynimizer alongside MySQL. We try to keep things as simple as possible, and so by no means is this meant to demonstrate the most realistic or optimal way to benchmark MySQL with Sysbench, or accurately measure the improvements Dynimizer can achieve. This tutorial can be completed with any version of MySQL, MariaDB, or Percona Server, and it is assumed that one of these is already installed.

Note that the benchmark is run using a CPU bound setup, with --oltp-read-only=on so that the IO subsystem is not involved, and making sure the workload fits into RAM. This example was run on a cloud based VPS from OVH, with 2 vCPUs (2.4 Ghz Haswell), with 8 GB ram, and a 40 GB SSD. You can recreate this exact VM on OVH's public cloud by selecting the VPS-SSD-3 server option in their Beauharnois data center. We used Ubuntu 16.04.2 LTS with MySQL 5.7.18, and Sysbench 0.4.12. Note that Sysbench 0.4 is used in this tutorial because it can easily be installed from most Linux repositories. Note that Dynimizer speedups can be more pronounced when running on KVM hypervisors, as is the case here.

 

1. Install Sysbench

apt-get based install:

$ sudo apt-get install sysbench

 

OR

yum based install:

$ sudo yum install sysbench

 

2. Run sysbench

In the following commands, make sure to replace user and password with something appropriate. Here we use the database name testDB.

Lets start off with a fresh MySQL process:

$ sudo service mysql restart

 

Load a table for the Sysbench OLTP workload. Make sure to replace user and password as appropriate:

$ mysql -u user --password=password -e "DROP DATABASE testDB;"
$ mysql -u user --password=password -e "CREATE DATABASE testDB;"
$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=testDB --mysql-user=user --mysql-password='password' prepare

 

Perform a warm-up run:

$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=testDB --mysql-user=user --mysql-password='password' --max-time=120 --oltp-read-only=on --max-requests=0 --num-threads=8 run

 

Perform a measurement run (command is the same as warm-up):

$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=testDB --mysql-user=user --mysql-password='password' --max-time=120 --oltp-read-only=on --max-requests=0 --num-threads=8 run

 

These runs will produce results in the following format:

OLTP test statistics:
queries performed:
read: 1203062
write: 0
other: 171866
total: 1374928
transactions: 85933 (1432.12 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 1203062 (20049.73 per sec.)
other operations: 171866 (2864.25 per sec.)

Test execution summary:
total time: 60.0039s
total number of events: 85933
total time taken by event execution: 479.6911
per-request statistics:
min: 1.19ms
avg: 5.58ms
max: 41.07ms
approx. 95 percentile: 7.85ms

Threads fairness:
events (avg/stddev): 10741.6250/233.97
execution time (avg/stddev): 59.9614/0.00

 

In this case we can see transactions per second of 1432.12 as highlighted above.

 

3. Repeat with Dynimizer

Let's repeat that with Dynimizer running. First install Dynimizer if you haven't already, then start it:

$ sudo bash -c 'bash <(wget -O - https://dynimize.com/install) -default'

 

Now start Dynimizer:

$ sudo dyni -start

 

Perform another warmup run to get the mysqld process in the "dynimized" state:

$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=testDB --mysql-user=user --mysql-password='password' --max-time=120 --oltp-read-only=on --max-requests=0 --num-threads=8 run

 

After the warmup make sure mysqld is dynimized:

$ sudo dyni -status
Dynimizer is running
mysqld, pid: 25072, dynimized

 

If the mysqld process is not yet dynimized then repeatedly run the warm-up followed by sudo dyni -status until mysqld shows up as dynimized.

 

Now that mysqld is dynimized, let's measure its performance again:

$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=testDB --mysql-user=user --mysql-password='password' --max-time=120 --oltp-read-only=on --max-requests=0 --num-threads=8 run

 

Which will output the following:

OLTP test statistics:
queries performed:
read: 1759352
write: 0
other: 251336
total: 2010688
transactions: 125668 (2094.36 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 1759352 (29321.06 per sec.)
other operations: 251336 (4188.72 per sec.)

Test execution summary:
total time: 60.0030s
total number of events: 125668
total time taken by event execution: 479.5530
per-request statistics:
min: 0.77ms
avg: 3.82ms
max: 492.75ms
approx. 95 percentile: 5.52ms

Threads fairness:
events (avg/stddev): 15708.5000/166.91
execution time (avg/stddev): 59.9441/0.00

 

Here we see transactions per second of 2094.36, which is a 46% speedup from the baseline of 1432.12 tps.

That concludes this tutorial. Happy Dynimizing!

Share

David Yeager is the founder of Dynimize Inc., and built the initial release of Dynimizer from the ground up. His area of expertise is in just-in-time compilation and computer architectures. Previously, David was a member of IBM's JIT compiler development team. David has a Master of Engineering degree in Electrical and Computer Engineering from the University of British Columbia.

Product

Dynimizer

Dynimizer Beta License
Performance

Speedup

CPU Stalls
Docs

User Reference

Tutorials
Communicate

Support

Contact


COPYRIGHT © DYNIMIZE INC.