Laporan ini menyajikan hasil benchmark YCSB (Yahoo! Cloud Serving Benchmark) untuk API kompatibel DynamoDB dari PolarDB for PostgreSQL pada lima jenis workload dan empat skala data. Gunakan hasil ini sebagai acuan dalam pemilihan teknologi, desain aplikasi, dan perencanaan kapasitas.
Kinerja point query mencapai puncaknya pada 983.524 OPS (Operations Per Second) (spesifikasi 64-core 256 GB, volume data 10 GB, workload 100% read).
Lingkungan pengujian
Konfigurasi lingkungan
|
Komponen |
Spesifikasi |
|
Kluster pengujian (PolarDB) |
|
|
Client uji stres (ECS) |
|
Tool benchmark
-
Metrik: OPS (Operations Per Second) — jumlah operasi yang diproses database per detik.
Model workload
Semua workload menggunakan CoreWorkload YCSB. Model data pengujian terdiri atas satu tabel usertable dengan kunci primary HASH, dan setiap record berisi 10 field berupa string acak sepanjang 100 byte (sekitar 1 KB per record).
|
Workload YCSB |
Skenario |
Parameter inti |
|
|
100% write |
|
|
|
100% update |
|
|
|
100% point query |
|
|
|
50% read + 50% update |
|
|
|
100% range scan |
|
Metode uji stres lainnya
|
Metode uji stres |
Deskripsi |
|
Volume data |
Preload masing-masing 1 juta / 10 juta / 100 juta / 1 miliar record sebelum menjalankan uji stres (sekitar 1 GB / 10 GB / 100 GB / 1 TB data). |
|
Durasi pengujian |
5 menit per sesi (maxexecutiontime=300s) |
|
Sumber nilai |
Throughput terbaik dari berbagai jumlah thread konkuren dalam uji stres. |
Hasil pengujian detail per spesifikasi
Tiga tabel berikut menunjukkan throughput (OPS) untuk berbagai skala data dan workload pada tiga spesifikasi kluster: 8-core 32 GB, 32-core 128 GB, dan 64-core 256 GB. Nilai throughput terbaik dari berbagai jumlah thread konkuren dalam uji stres digunakan.
Spesifikasi 8-core 32 GB
|
Skenario pengujian |
1 GB (OPS) |
10 GB (OPS) |
100 GB (OPS) |
1 TB (OPS) |
|
100% read (Read) |
243.067 |
238.188 |
140.199 |
116.189 |
|
100% range scan (Scan) |
37.142 |
36.945 |
5.626 |
4.857 |
|
50% read + 50% update |
89.119 |
84.636 |
65.903 |
57.164 |
|
100% update (Update) |
45.401 |
42.869 |
34.741 |
29.907 |
|
100% write (Insert) |
57.806 |
46.621 |
44.428 |
44.359 |
Spesifikasi 32-core 128 GB
|
Skenario pengujian |
1 GB (OPS) |
10 GB (OPS) |
100 GB (OPS) |
1 TB (OPS) |
|
100% read (Read) |
578.397 |
575.689 |
462.904 |
373.101 |
|
100% range scan (Scan) |
90.256 |
89.789 |
25.986 |
10.278 |
|
50% read + 50% update |
221.826 |
216.588 |
164.912 |
120.688 |
|
100% update (Update) |
114.770 |
114.696 |
92.479 |
78.317 |
|
100% write (Insert) |
128.332 |
121.148 |
117.396 |
112.275 |
Spesifikasi 64-core 256 GB
|
Skenario pengujian |
1 GB (OPS) |
10 GB (OPS) |
100 GB (OPS) |
1 TB (OPS) |
|
100% read (Read) |
894.926 |
983.524 |
980.197 |
653.825 |
|
100% range scan (Scan) |
138.609 |
142.560 |
140.653 |
14.171 |
|
50% read + 50% update |
318.094 |
312.043 |
288.028 |
189.536 |
|
100% update (Update) |
171.349 |
170.789 |
154.085 |
115.961 |
|
100% write (Insert) |
171.682 |
176.069 |
167.877 |
165.308 |
Lampiran: Mereproduksi pengujian
Ikuti langkah-langkah berikut untuk mereproduksi pengujian kinerja guna validasi sekunder atau pengujian kustom.
Langkah 1: Konfigurasikan YCSB
Sebelum menjalankan pengujian, konfigurasikan client DynamoDB YCSB.
-
Konfigurasikan kredensial identitas
Edit file
dynamodb/conf/AWSCredentials.propertiesdan masukkan kredensial untuk PolarDB consoleakun DynamoDB khusus Anda.# Nama akun adalah ID AccessKey accessKey = <YOUR_ACCESS_KEY_ID> # Kunci rahasia secretKey = <YOUR_SECRET_ACCESS_KEY> -
Konfigurasikan properti koneksi
Edit file
dynamodb/conf/dynamodb.propertiesdan tentukan informasi koneksi kluster PolarDB.# Jalur mutlak file autentikasi dynamodb.awsCredentialsFile = /path/to/your/AWSCredentials.properties # Buat tabel usertable di kluster terlebih dahulu. # Contoh ini membuat tabel usertable hanya dengan kunci partisi bernama pk. dynamodb.primaryKey = pk # Titik akhir DynamoDB untuk PolarDB. Harus menyertakan awalan http://. dynamodb.endpoint = http://<your-polardb-ddb-endpoint>:<port> # Biarkan parameter region kosong. dynamodb.region = # Nama dan tipe kunci primary untuk tabel pengujian. Harus sesuai dengan tabel pengujian. dynamodb.primaryKey = HASH
Langkah 2: Patch operasi update YCSB
Client DynamoDB resmi YCSB secara default menggunakan parameter AttributeUpdates yang sudah tidak digunakan lagi. PolarDB memerlukan parameter UpdateExpression. Anda harus menerapkan perubahan berikut sebelum menjalankan workload update apa pun.
-
Jalur file:
dynamodb/src/main/java/site/ycsb/db/DynamoDBClient.java -
Metode yang perlu dimodifikasi:
update()
Ganti implementasi aslinya:
@Override
public Status update(String table, String key, Map<String, ByteIterator> values) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("updatekey: " + key + " from table: " + table);
}
Map<String, AttributeValueUpdate> attributes = new HashMap<>(values.size());
for (Entry<String, ByteIterator> val : values.entrySet()) {
AttributeValue v = new AttributeValue(val.getValue().toString());
attributes.put(val.getKey(), new AttributeValueUpdate().withValue(v).withAction("PUT"));
}
UpdateItemRequest req = new UpdateItemRequest(table, createPrimaryKey(key), attributes);
try {
dynamoDB.updateItem(req);
} catch (AmazonServiceException ex) {
LOGGER.error(ex);
return Status.ERROR;
} catch (AmazonClientException ex) {
LOGGER.error(ex);
return CLIENT_ERROR;
}
return Status.OK;
}
Setelah perubahan (menggunakan UpdateExpression)
@Override
public Status update(String table, String key, Map<String, ByteIterator> values) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("updatekey: " + key + " from table: " + table);
}
StringBuilder updateExp = new StringBuilder("SET ");
Map<String, String> attrNames = new HashMap<>();
Map<String, AttributeValue> attrValues = new HashMap<>();
boolean first = true;
for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
String attr = entry.getKey();
if (!first) {
updateExp.append(", ");
}
String attrName = "#" + attr;
String valueName = ":" + attr;
updateExp.append(attrName).append(" = ").append(valueName);
attrNames.put(attrName, attr);
attrValues.put(valueName, new AttributeValue(entry.getValue().toString()));
first = false;
}
UpdateItemRequest req = new UpdateItemRequest()
.withTableName(table)
.withKey(createPrimaryKey(key))
.withUpdateExpression(updateExp.toString())
.withExpressionAttributeNames(attrNames)
.withExpressionAttributeValues(attrValues);
try {
dynamoDB.updateItem(req);
} catch (AmazonServiceException ex) {
LOGGER.error(ex);
return Status.ERROR;
} catch (AmazonClientException ex) {
LOGGER.error(ex);
return CLIENT_ERROR;
}
return Status.OK;
}
Langkah 3: Jalankan pengujian
Setiap sesi pengujian terdiri atas dua fase: load (mengisi data pengujian) dan run (menjalankan workload). Contoh berikut menggunakan set data 1 GB (1 juta record), 128 thread konkuren, dan workload read-only.
Untuk menguji volume data lainnya, ubah parameter recordcount dan operationcount dalam perintah.
-
Muat data (Fase Load)
# -s: Menampilkan pembaruan status selama pemuatan. # -P workloads/workload_read_only: Menentukan file workload. # -P /path/to/dynamodb.properties: Menentukan konfigurasi koneksi database. # -p recordcount=1000000: Jumlah total record yang dimuat (1 GB). # -p operationcount=1000000: Jumlah total operasi. # -threads 128: Jumlah thread konkuren. nohup ./bin/ycsb load dynamodb -s \ -P workloads/workload_read_only \ -P /path/to/dynamodb.properties \ -p recordcount=1000000 \ -p operationcount=1000000 \ -threads 128 \ > load.log 2>&1 & -
Jalankan pengujian (Fase Run)
nohup ./bin/ycsb run dynamodb -s \ -P workloads/workload_read_only \ -P /path/to/dynamodb.properties \ -p recordcount=1000000 \ -p operationcount=1000000 \ -threads 128 \ > run.log 2>&1 &