与开源PostgreSQL性能对比

本文介绍PolarDB for PostgreSQL 14版本的OLTP负载性能测试结果。

简介

相较于开源PostgreSQL 14,PolarDB for PostgreSQL 14在以下几方面进行了优化,提升了整体性能:

  • 采用了领先硬件技术,包括使用3DXpoint存储介质的Optane存储卡、NVMeSSDRoCE RDMA网络等。

  • 基于新的硬件,实现了一整套在用户态运行的IO和网络协议栈,获得了更高的性能、更低的延迟。

  • 通过Polar CSN(Commit Sequence Number)技术,将原生PostgreSQL xid事务替换为单调递增的64位整型来提升高并发下OLTP性能。

  • 借助预读、预扩展、rel_size_cache技术,可以有效减少IO读写次数,提升性能。

说明

具体测试步骤,请参见性能测试方法(OLTP)

测试环境和规格

PolarDB for PostgreSQL 14和开源 PostgreSQL 14的环境和规格如下表所示,本次测试的开源PostgreSQL 14在阿里云ECS机器上进行部署:

参数

PolarDB for PostgreSQL 14

开源 PostgreSQL 14

核数+内存

8核 64 GB

8核 64 GB

发压ECS机规格

ecs.c5.4xlarge

ecs.c5.4xlarge

并发数

256

256

PostgreSQL版本

14

14

磁盘性能等级

PSL5

cloud_essd+PL3

预留磁盘空间

自动扩容,无限制

4 TB

说明

关于内核参数,PolarDB for PostgreSQL 14的参数与开源PostgreSQL 14性能参数进行了对齐,其余参数均采用默认参数。

测试Workload说明

Sysbench中,有七类场景,包括oltp_insert、oltp_point_select、oltp_read_only、oltp_read_write、oltp_update_index、oltp_update_non_index、oltp_write_only。各种场景的测试内容说明如下:

参数

场景

测试内容

写场景

oltp_insert

插入表。

oltp_update_index

更新带索引的表。

oltp_update_non_index

更新不带索引的表。

oltp_write_only

插入、更新、删除表混合测试。

读场景

oltp_point_select

点查询。

oltp_read_only

点查询+范围查询。

读写混合

oltp_read_write

oltp_write_only+oltp_read_only混合测试。

衡量指标

TPS(Transactions Per Second):即数据库每秒执行的事务数,以COMMIT成功次数为准。

测试数据量

本次实验测试数据量如下表所示:

参数

说明

表数目

8

行数

64,000,000

总数据量

128 GB

性能结果

  • 写场景写场景

    TPS/实例类型

    PolarDB for PostgreSQL 14

    开源PostgreSQL 14数据库

    oltp_insert

    43129.08

    41161.66

    oltp_update_index

    32492.36

    3710.60

    oltp_update_non_index

    30929.04

    5367.59

    oltp_write_only

    9492.40

    1294.47

  • 读场景读场景

    TPS/实例类型

    PolarDB for PostgreSQL 14

    开源PostgreSQL 14数据库

    oltp_point_select

    88967.60

    14566.05

    oltp_read_only

    4834.21

    570.62

  • 读写混合场景读写混合场景

    TPS/实例类型

    PolarDB for PostgreSQL 14

    开源PostgreSQL 14数据库

    oltp_read_write

    1738.51

    306.39