Skip to content
This repository was archived by the owner on Mar 20, 2021. It is now read-only.

Example

Bohan Zhang edited this page Jan 14, 2019 · 7 revisions

An End-To-End Tuning Example

Hardware

We use m5d.xlarge instance on AWS, which has 4 CPUs, 16GB RAM, and 150GB local storage SSD. We use local SSD to store the target database data since it does not have IOPS limits compared to EBS. However, you will lose your local data once stop/restart/terminate the instance (more info). We use Ubuntu Server 16.04 LTS (HVM) AMI.

Installation

We choose Postgres 9.6 as the target database, i.e. the database we will tune on the client side. On the server side, we use MySQL to store the website data. We set up both client side and server side on the same machine, since we find that it has little effect on the performance. Follow the instruction on the Linux Quick Start Wiki to install the packages on the bare-metal instance.

Mount the local storage

We use local storage on AWS to save money. You need to format and mount the device, and specify the data directory path in Postgres. e.g. the device is /dev/nvme1n1 and we mount it to the directory /mnt/data. You should

mkfs -t ext4 /dev/nvme1n1   # Format the device
mount -t ext4 /dev/nvme1n1 /mnt/data   # Mount the device
sudo rsync -av /var/lib/postgresql /mnt/data   # Copy the data from the old directory to the mounted one.

Then set the data_directory in Postgres configuration to the new one (e.g. /mnt/data/postgresql/9.6/main), restart the database. Then it should save all the data to the local storage SSD.

Client-side

You should specify controller configuration, driver configuration, and OLTP-Bench configuration. More information can be found in Client-Side Wiki. In this example, we use TPC-C workload in OLTP-Bench, and change the settings in config/tpcc_config_postgres.xml as follows.

<time>300</time>  # observation time is 5 mins
<rate>unlimited</rate>  # unlimited rate
<scalefactor>200</scalefactor>  # Scale Factor in TPC-C
<terminals>50</terminals>   # 50 concurrent terminals

Also, we restore database every 10 loops as default. (question 4 in FAQ)

Server-side

Set up the web server, and run celery worker. Details can be found in Get Started Wiki

Clone this wiki locally