{"id":33,"date":"2019-07-15T16:20:19","date_gmt":"2019-07-15T16:20:19","guid":{"rendered":"http:\/\/dynimize.com\/blog\/?p=33"},"modified":"2021-02-08T23:37:20","modified_gmt":"2021-02-08T23:37:20","slug":"dynimize-quickstart-tutorial","status":"publish","type":"post","link":"https:\/\/dynimize.com\/blog\/tutorials\/beginner\/dynimize-quickstart-tutorial\/","title":{"rendered":"Dynimize Quickstart Tutorial"},"content":{"rendered":"<p><span style=\"color: #000000;\"><strong><em>Duration: <\/em><\/strong><em>10 min<\/em><\/span><\/p>\n<p><span style=\"color: #000000;\"><em><strong>Level: <\/strong>Beginner<\/em><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>This tutorial will show you how to install Dynimize. We'll then use it to optimize a live MySQL process that's been running the Sysbench OLTP benchmark, obtaining a <strong>46% increase in performance by applying Dynimize<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<h2>Part 1: &nbsp;Quickstart<\/h2>\n<p>&nbsp;<\/p>\n<p>Here's a quick overview of how to use Dynimize.<\/p>\n<p>To install Dynimize, run the following commands.<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">wget https:\/\/dynimize.com\/install -O install<br \/>\nwget https:\/\/dynimizecloud.com\/install.sha256 -O install.sha256<br \/>\nsha256sum -c install.sha256; if [ $? -eq 0 ]; then sudo bash .\/install -d; fi<\/div>\n<p>&nbsp;<\/p>\n<p>Use your <a href=\"https:\/\/dynimize.com\/console\/token\">access token<\/a> to start a subscription license for your host.<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo dyni -license=start -token=&lt;your-access-token&gt;<\/div>\n<p>&nbsp;<\/p>\n<p>To start Dynimize, run<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo dyni -start<\/div>\n<p>&nbsp;<\/p>\n<p>To check the status of Dynimize and any optimization targets, run:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo dyni -status<\/div>\n<p>&nbsp;<\/p>\n<p>Once a target process has been fully optimized, the above command will report:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n        display: inline-block; background-color: white; border-radius: 4px; \r\n        text-align: left ; box-shadow: 2px 2px 5px rgb(145,255,211); \r\n        padding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid rgb(122,214,177);\">\nDynimize is running<br \/>\nmysqld, pid: 21091, dynimized<br \/>\n<\/div>\n<p>&nbsp;<\/p>\n<p>It could take anywhere from 30 to 300s of CPU intensive activity from the target process before Dynimize has completed profiling and optimizing that process.<\/p>\n<p>Deciding which applications to target can be done by editing the list of supported target exes in \/etc\/dyni.conf under the [exeList] section.<\/p>\n<p>&nbsp;<\/p>\n<p>To stop Dynimize, run:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo dyni -stop<\/div>\n<p>&nbsp;<\/p>\n<p>To stop the subscription license for this host, run:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$sudo dyni -license=stop -token=<span class=\"codeFontFamily\">&lt;your-access-token&gt;<\/span><\/div>\n<h4>&nbsp;<\/h4>\n<p>Follow <a href=\"https:\/\/dynimize.com\/blog\/discussions\/measuring-the-impact-of-dynimize-on-your-mysql-workload\/\" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial<\/a> for help measuring the performance impact.<\/p>\n<p>&nbsp;<\/p>\n<h2>Part 2: &nbsp; Benchmarking with Dynimize<\/h2>\n<p>&nbsp;<\/p>\n<p>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 Dynimize 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 Dynimize 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.<\/p>\n<p>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 <a href=\"https:\/\/www.ovh.com\/ca\/en\/public-cloud\/instances\/\" target=\"_blank\" rel=\"noopener noreferrer\">OVH's public cloud<\/a>&nbsp;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 Dynimize speedups can be more pronounced when running on KVM hypervisors, as is the case here.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>1. Install Sysbench<\/strong><\/p>\n<p>apt-get based install:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo apt-get install sysbench<\/div>\n<p>&nbsp;<\/p>\n<p>OR<\/p>\n<p>yum based install:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo yum install sysbench<\/div>\n<p>&nbsp;<\/p>\n<p><strong>2. Run sysbench<\/strong><\/p>\n<p>In the following commands, make sure to replace user and password with something appropriate. Here we use the database name testDB.<\/p>\n<p>Lets start off with a fresh MySQL process:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo service mysql restart<\/div>\n<p>&nbsp;<\/p>\n<p>Load a table for the Sysbench OLTP workload. Make sure to replace user and password as appropriate:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">\n$ mysql -u user --password=password -e \"DROP DATABASE testDB;\"<br \/>\n$ mysql -u user --password=password -e \"CREATE DATABASE testDB;\"<br \/>\n$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=testDB --mysql-user=user --mysql-password='password' prepare<br \/>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Perform a warm-up run:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">\n$ 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<br \/>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Perform a measurement run (command is the same as warm-up):<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">\n$ 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<br \/>\n<\/div>\n<p>&nbsp;<\/p>\n<p>These runs will produce results in the following format:<br \/>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n        display: inline-block; background-color: white; border-radius: 4px; \r\n        text-align: left ; box-shadow: 2px 2px 5px rgb(145,255,211); \r\n        padding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid rgb(122,214,177);\">OLTP test statistics:<br \/>\nqueries performed:<br \/>\nread: 1203062<br \/>\nwrite: 0<br \/>\nother: 171866<br \/>\ntotal: 1374928<br \/>\ntransactions: 85933 (<b>1432.12<\/b> per sec.)<br \/>\ndeadlocks: 0 (0.00 per sec.)<br \/>\nread\/write requests: 1203062 (20049.73 per sec.)<br \/>\nother operations: 171866 (2864.25 per sec.)<br \/>\n<br class=\"\u201d\u201d\">Test execution summary:<br \/>\ntotal time: 60.0039s<br \/>\ntotal number of events: 85933<br \/>\ntotal time taken by event execution: 479.6911<br \/>\nper-request statistics:<br \/>\nmin: 1.19ms<br \/>\navg: 5.58ms<br \/>\nmax: 41.07ms<br \/>\napprox. 95 percentile: 7.85ms<br \/>\n<br class=\"\u201d\u201d\">Threads fairness:<br \/>\nevents (avg\/stddev): 10741.6250\/233.97<br \/>\nexecution time (avg\/stddev): 59.9614\/0.00<\/div>\n<p>&nbsp;<\/p>\n<p>In this case we can see transactions per second of <strong>1432.12<\/strong> as highlighted above.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>3. Repeat with Dynimize<\/strong><\/p>\n<p>Let's repeat that with Dynimize running. First install Dynimize and start a host license if you haven't already.<\/p>\n<p>If you haven't already done so, install Dynimize:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">wget https:\/\/dynimize.com\/install -O install<br \/>\nwget https:\/\/dynimizecloud.com\/install.sha256 -O install.sha256<br \/>\nsha256sum -c install.sha256; if [ $? -eq 0 ]; then sudo bash .\/install -d; fi<\/div>\n<p>&nbsp;<\/p>\n<p>If you haven't already started a subscription license for your host then use your <a href=\"https:\/\/dynimize.com\/console\/token\">access token<\/a> to start one :<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$sudo dyni -license=start -token=<span class=\"codeFontFamily\">&lt;your-access-token&gt;<\/span><\/div>\n<p>&nbsp;<\/p>\n<p>Now start Dynimize:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo dyni -start<\/div>\n<p>&nbsp;<\/p>\n<p>Perform another warmup run to get the mysqld process in the \"dynimized\" state:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ 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<\/div>\n<p>&nbsp;<\/p>\n<p>After the warmup make sure mysqld is dynimized:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ sudo dyni -status<br \/>\nDynimize is running<br \/>\nmysqld, pid: 25072, dynimized<\/div>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p>&nbsp;<\/p>\n<p>Now that mysqld is dynimized, let's measure its performance again:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n\tdisplay: inline-block; background-color: white; border-radius: 4px; \r\n\ttext-align: left; color: 0x0066ff; box-shadow: 1.5px 1.5px 5px #0050c9; \r\n\tpadding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid #0066FF;\">$ 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<\/div>\n<p>&nbsp;<\/p>\n<p>Which will output the following:<\/p>\n<div class=\"code\" style=\"word-wrap:break-word;font-family: monospace; font-size: 12px; \r\n        display: inline-block; background-color: white; border-radius: 4px; \r\n        text-align: left ; box-shadow: 2px 2px 5px rgb(145,255,211); \r\n        padding: 1%; margin-top: 0px; margin-bottom: 0px; border: 1px solid rgb(122,214,177);\">OLTP test statistics:<br \/>\nqueries performed:<br \/>\nread: 1759352<br \/>\nwrite: 0<br \/>\nother: 251336<br \/>\ntotal: 2010688<br \/>\ntransactions: 125668 (<strong>2094.36<\/strong> per sec.)<br \/>\ndeadlocks: 0 (0.00 per sec.)<br \/>\nread\/write requests: 1759352 (29321.06 per sec.)<br \/>\nother operations: 251336 (4188.72 per sec.)<br \/>\n<br class=\"\u201d\u201d\">Test execution summary:<br \/>\ntotal time: 60.0030s<br \/>\ntotal number of events: 125668<br \/>\ntotal time taken by event execution: 479.5530<br \/>\nper-request statistics:<br \/>\nmin: 0.77ms<br \/>\navg: 3.82ms<br \/>\nmax: 492.75ms<br \/>\napprox. 95 percentile: 5.52ms<br \/>\n<br class=\"\u201d\u201d\">Threads fairness:<br \/>\nevents (avg\/stddev): 15708.5000\/166.91<br \/>\nexecution time (avg\/stddev): 59.9441\/0.00<\/div>\n<p>&nbsp;<\/p>\n<p>Here we see transactions per second of <strong>2094.36<\/strong>, which is a <strong>46% speedup<\/strong> from the baseline of <strong>1432.12<\/strong> tps.<\/p>\n<p>That concludes this tutorial. Happy Dynimizing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Duration: 10 min Level: Beginner &nbsp; This tutorial will show you how to install Dynimize. 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 Dynimize. &nbsp; Part 1: &nbsp;Quickstart &nbsp; Here's a quick overview of how to use Dynimize. To install Dynimize, run the following commands. wget https:\/\/dynimize.com\/install -O install wget https:\/\/dynimizecloud.com\/install.sha256 -O install.sha256 sha256sum -c install.sha256; if [ $? -eq 0 ]; then sudo bash .\/install -d; fi &nbsp; Use your access token to start a subscription license for your host. $ sudo dyni -license=start -token=&lt;your-access-token&gt; &nbsp; To start Dynimize, run $ sudo dyni -start &nbsp; To check the status of Dynimize and any optimization targets, run: $ sudo dyni -status &nbsp; Once a target process has been fully optimized, the above command will report: Dynimize is running mysqld, pid: 21091, dynimized &nbsp; It could take anywhere from 30 to 300s of CPU intensive activity from the target process before Dynimize 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. &nbsp; To stop Dynimize, run: $ sudo dyni -stop &nbsp; To stop the subscription license for this host, run: $sudo dyni -license=stop -token=&lt;your-access-token&gt; &nbsp; Follow this tutorial for help measuring the performance impact. &nbsp; Part 2: &nbsp; Benchmarking with Dynimize &nbsp; 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 Dynimize 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... <\/p>\n<p><a class=\"readmore\" href=\"https:\/\/dynimize.com\/blog\/tutorials\/beginner\/dynimize-quickstart-tutorial\/\">Continue Reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":6066,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[45,59,47,63,46],"class_list":["post-33","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-beginner","tag-dynimize","tag-kvm","tag-mysql","tag-performance","tag-sysbench"],"_links":{"self":[{"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":124,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":6690,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions\/6690"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/media\/6066"}],"wp:attachment":[{"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dynimize.com\/blog\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}