You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CloudSQL PostgreSQL(11/14)高配置下性能及TPS异常低下求助

CloudSQL PostgreSQL 性能异常问题

问题描述

我们的CloudSQL PostgreSQL实例(版本11或14)存在性能异常:测试过1vCPU到4vCPU、最高24GB内存、100GB SSD的多种配置,单连接pgbench测试时单请求响应耗时300-500ms,TPS仅2-3。

单连接测试结果

transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 1
number of threads: 1
duration: 100 s
number of transactions actually processed: 207
latency average = 483.165 ms
initial connection time = 359.565 ms
tps = 2.069685 (without initial connection time)

多连接测试结果

多连接时扩展性尚可,但整体性能仍极差:

transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 50
duration: 100 s
number of transactions actually processed: 9296
latency average = 538.585 ms
initial connection time = 441.047 ms
tps = 92.835803 (without initial connection time)

版本降级后的表现

从PG14降级到PG11后,大型基准测试性能提升约15%,但单连接测试仍缓慢。实例未修改任何高级数据库参数,保持默认配置。

本地测试对比

本地Mac M1 Pro上的相同测试性能远超云端,差距过大:

transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
maximum number of tries: 1
duration: 30 s
number of transactions actually processed: 4057
number of failed transactions: 0 (0.000%)
latency average = 7.393 ms
initial connection time = 17.055 ms
tps = 135.263939 (without initial connection time)

连接方式与性能期望

我们使用最新稳定版cloudsql auth proxy连接,期望单连接TPS达到线上常见的5-10左右。

近机房测试结果

在美中地区靠近服务器的机器上测试结果如下:

transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 5
number of threads: 1
duration: 30 s
number of transactions actually processed: 207
latency average = 690.794 ms
initial connection time = 2037.796 ms
tps = 7.238044 (without initial connection time)

内容的提问来源于stack exchange,提问作者MorenoMdz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 21:55:34