This topic describes the performance of a Confidential Database under different encryption conditions to help you evaluate and select an encryption solution.
Test environment
| Configuration item | ECS instance (test client) | PolarDB for MySQL cluster | Description |
|---|---|---|---|
| Region and zone | Hangzhou Zone H (primary), Hangzhou Zone J | Hangzhou Zone H | The test was performed in the same region and zone. |
| Network type | Virtual Private Cloud (VPC) | Virtual Private Cloud (VPC) | The test was performed in the same VPC. |
| CPU and memory | 8 cores, 32 GB | 64 cores, 512 GB | — |
| Instance type | ecs.s6-c1m4.2xlarge | polar.mysql.x8.8xlarge | — |
| Instance/Image version | Alibaba Cloud Linux 2.1903 LTS 64-bit Quick Launch | Kernel version: 8.0.2.2.12 | — |
Test tool
oltpbench is an open-source benchmark tool for Online Transactional Processing (OLTP) that tests the performance and scalability of database management systems. It supports multiple benchmark programs, including TPC-C, TPC-E, and YCSB. This report uses the TPC-C benchmark to evaluate Confidential Database performance in OLTP scenarios.
Metric
TPS (Transactions Per Second): the number of transactions a database executes per second, measured by the number of successful COMMIT operations.
Test steps
Confidential Database encrypts data based on the column encryption rules you configure. This test adjusts the set of encrypted columns in the TPC-C benchmark to measure performance across different encryption coverage levels.
-
Set up oltpbench on your ECS instance. For details, see Configure oltpbench.
-
Integrate EncJDBC with oltpbench. For details, see Integrate EncJDBC.
-
Create an oltpbench configuration file:
<?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> -
After compiling the oltpbench project, import data into the database:
./oltpbenchmark -b tpcc -c tpcc_encmysql.xml --load=true --create=true -s 1 -o tpcc -
Adjust the encryption settings and run the benchmark to measure TPS:
./oltpbenchmark -b tpcc -c tpcc_encmysql.xml --execute=true -s 1 -o tpcc
Test scenarios and results
Each result is the average TPS from three test runs, each lasting one minute. Results include the overhead of decrypting encrypted fields returned to the client. In this TPC-C scenario, Queries Per Second (QPS) is a fixed multiple of TPS, at approximately 9 to 10 times the TPS value, so only TPS is reported. The terminals parameter represents the number of concurrent clients, which corresponds to the number of parallel test threads.
Scenario 1: Encrypt 20% of business data columns
ID columns were prioritized for encryption — for example, ID card numbers and order numbers. This simulates a common compliance requirement to protect identity and transaction identifiers.
Test results
| Number of terminals | Plaintext (TPS) | 20% sensitive columns 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% |
Scenario 2: Encrypt 50% of business data columns
In addition to the ID columns encrypted in Scenario 1, other sensitive columns were encrypted — including price, date, and quantity fields.
Test results
| Number of terminals | Plaintext (TPS) | 50% sensitive columns 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% |
Scenario 3: Encrypt all business data columns
All business data columns were encrypted.
Test results
| Number of terminals | Plaintext (TPS) | 100% sensitive columns 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% |