All Products
Search
Document Center

PolarDB:Performance test

Last Updated:Mar 26, 2024

This topic describes the performance of PolarDB Always Encrypted in different encryption configurations

Test environment

Configuration item

ECS instance (where the test client is deployed)

PolarDB for MySQL cluster

Description

Region and zone

Hangzhou Zone H (primary) and Hangzhou Zone J

Hangzhou Zone H

The tests are done in a single region and zone.

Network type

Virtual Private Cloud (VPC)

VPC

The tests are done in a single VPC.

CPU and memory

8 cores and 32 GB of memory

64 cores and 512 GB of memory

N/A

Instance type

ecs.s6-c1m4.2xlarge

polar.mysql.x8.8xlarge

N/A

Instance version or image version

Alibaba Cloud Linux 2.1903 LTS 64-bit (Quick Start)

Engine version: 8.0.2.2.12

N/A

Benchmark tool: OLTP-Bench

OLTP-Bench is an open source benchmarking tool to test the performance and scalability of OLTP databases. It provides multiple benchmarks such as TPC-C, TPC-E, and YCSB to test the database performance in different types of workloads. In this topic, TPC-C is used to test the performance of PolarDB clusters with PolarDB Always Encrypted enabled.

Metric

Transactions per second (TPS): indicates the number of transactions that are committed on a database per second.

Test procedure

PolarDB Always Encrypted encrypts data based on custom encryption rules. In the tests, different numbers of data columns are encrypted to test the database performance in different scenarios.

  1. Configure the OLTP-Bench project in your Elastic Compute Service (ECS) instance. For more information about the configuration method, see the official page of OLTB-Bench.

  2. Integrate EncJDBC with OLTP-Bench. For more information about how to integrate EncJDBC, see Integrate EncJDBC.

  3. Create an OLTP-Bench configuration file that contains the following content:

    <?xml version="1.0"?>
    <parameters>
    
        <!-- Connection details -->
        <dbtype>mysql</dbtype>
        <driver>com.aliyun.encdb.mysql.jdbc.EncDriver</driver>
        <DBUrl>jdbc:mysql:encdb://xxxx.rwlb.rds.aliyuncs.com:3306/xxxx</DBUrl>
        <DBName>xxxx</DBName>
        <username>xxxx</username>
        <password>xxxxx</password>
        <isolation>TRANSACTION_SERIALIZABLE</isolation>
    
        <scalefactor>1</scalefactor>
    
        <!-- The workload -->
        <terminals>8</terminals>
        <works>
            <work>
                <time>180</time>
                <rate>unlimited</rate>
                <weights>45,43,4,4,4</weights>
            </work>
        </works>
    
    
        <!-- TPCC specific -->
            <transactiontypes>
            <transactiontype>
                    <name>NewOrder</name>
            </transactiontype>
            <transactiontype>
                    <name>Payment</name>
            </transactiontype>
            <transactiontype>
                    <name>OrderStatus</name>
            </transactiontype>
            <transactiontype>
                    <name>Delivery</name>
            </transactiontype>
            <transactiontype>
                    <name>StockLevel</name>
            </transactiontype>
            </transactiontypes>
    </parameters>
    
  4. After the OLTP-Bench project is compiled, run the following command to import the data to the database.

    ./oltpbenchmark -b tpcc -c tpcc_encmysql.xml --load=true --create=true -s 1 -o tpcc
  5. Adjust configurations like the encrypted columns and TPC-C parameters to comprehensively test the performance of PolarDB Always Encrypted in OLTP scenarios (measured in TPS).

    ./oltpbenchmark -b tpcc -c tpcc_encmysql.xml --execute=true -s 1 -o tpcc

Test conditions and results

Test conditions

  • Each test is run three times to obtain the average result, with each test lasting 1 minute.

  • The performance deterioration caused by decryption of the encrypted data returned from the server is measured.

  • In the tests, the QPS numbers are constantly 9 to 10 times that of the TPS numbers. Therefore, only TPS results are provided in this topic.

  • The Terminal parameter simulates the concurrent number of clients.

Scenario 1: Encrypts 20% of the business data

In this condition, the ID information in the database is encrypted to simulate the encryption requirements for citizen IDs or order IDs, which are common in actual business scenarios.

Test results

Terminal

Plaintext (TPS)

20% encrypted (TPS)

Performance overhead

8

260.55

237.64

8.79%

16

302.78

280.28

7.43%

24

330.04

298.03

9.70%

32

343.65

315.25

8.26%

The performance deterioration is between 7% to 10%.

Scenario 2: Encrypts 50% of the business data

In addition to the ID column, columns of sensitive data like prices, dates, and quantities are encrypted.

Test results

Terminal

Plaintext (TPS)

50% encrypted (TPS)

Performance overhead

8

260.55

221.01

15.18%

16

302.78

256.64

15.24%

24

330.04

273.53

17.12%

32

343.65

293.65

14.55%

The performance deterioration is between 14% to 18%.

Scenario 3: Encrypts all business data

Test results

Terminal

Plaintext (TPS)

100% encrypted (TPS)

Performance overhead

8

260.55

201.62

22.62%

16

302.78

238.45

21.25%

24

330.04

256.36

22.32%

32

343.65

267.92

22.04%

The performance deterioration is around 22%.