测试采用模拟电网时序数据的自制性能测试工具,该工具可以测试不同并发度下,数据写入和查询的各项性能指标。
注: 若需要了解该自制工具的详情,请联系我们
TSDB2.0实例,华东1(杭州):
测试机,华东1(杭州):
测试所用数据模型模拟了电网的量采数据模型,具体模拟的是每一个量采设备在一个时间点上报的量采指标。其中,每个设备包含四个标签
此外,每个设备上报的数据包含十个指标值
CREATE TABLE IF NOT EXISTS test_tmr_ssz(
time TIMESTAMP WITHOUT TIME ZONE,
sf TEXT,
ds TEXT,
yxt TEXT,
sbbh TEXT,
pa DOUBLE PRECISION,
pb DOUBLE PRECISION,
pc DOUBLE PRECISION,
ca DOUBLE PRECISION,
cb DOUBLE PRECISION,
cc DOUBLE PRECISION,
cz DOUBLE PRECISION,
va DOUBLE PRECISION,
vb DOUBLE PRECISION,
vc DOUBLE PRECISION,
day AS date_trunc('day', time))
在下述测试中,根据不同测试场景需要,会给建表语句加上以下不同的数据分布策略。但保证其余定义完全相同
介绍该测试中对于写入以及查询的性能指标。
向数据库中执行写入时,平均每秒钟写入的测量数据点数(Points-per-second)
为统一时序数据的写入测量单位,本次测试统一以单值模型的测量点数量来进行统计。以上述数据模型为例,基于单值模型的时序数据,每个设备每上报一次数据就包含十个测量值。因此其一次上报数据的数据量计为 10 (数据点)。 结合上述建表DDL,换算成关系型表格数据,同样一次上报的数据量即为 1行。因此在该数据模型下, 10PPS = 1TPS(Tuples-per-second)
数据分布规则 | 三节点集群实例写入PPS | 单节点实例写入PPS | 三节点集群实例写入TPS | 单节点实例写入TPS |
---|---|---|---|---|
无指定(即不指定PARTITIONED BY和CLUSTERED BY) | 105107.99 | 96642.66 | 10510.799 | 9664.266 |
PARTITION BY day | 123075.19 | 117071.20 | 12307.519 | 11707.120 |
CLUSTERED BY ds | 112495.36 | 95997.70 | 11249.536 | 9599.770 |
CLUSTERED BY ds + PARTITION BY day | 125215.39 | 121005.44 | 12521.539 | 12100.544 |
分别在要求的最大并发数限制下基于上述基础数据测试以下各查询的QPS指标。 QPS的衡量方法为:对于各用例指定的查询总数 / 查询完成的时间。同时,会在测试程序中判断查询运行结果。若查询出错则不计入成绩。
用例编号 | SELECT语句 | 查询含义 |
---|---|---|
1 | select count(pa) pa, count(pb) pb, count(pc) pc from postgres.test_tmr_ssz where time between ‘2019-07-04 00:00:00.000’ and ‘2019-07-04 02:45:00.000’ and sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10080’; | 根据TAG过滤出指定的设备在指定时间范围内的值的数据点个数计算 |
2 | select time, pa, pb, pc from postgres.test_tmr_ssz where time between ‘2019-07-04 03:00:00.000’ and ‘2019-07-04 05:45:00.000’ and sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10080’ order by time desc; | 根据TAG过滤出指定的单个设备在指定时间范围内量采值并基于时间戳降序排列 |
3 | select sbbh,pa, pb, pc from postgres.test_tmr_ssz where time between ‘2019-07-04 13:00:00.000’ and ‘2019-07-04 14:30:00.000’ and sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh like ‘1008%’; | 根据TAG进行模糊匹配,将所有符合条件的设备的量采值查询出来 |
4 | select pa, pb, pc, va, cb from postgres.test_tmr_ssz where time between ‘2019-07-04 15:00:00.000’ and ‘2019-07-04 16:45:00.000’ and sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10080’ and pa < 81 and pb > 60 and pc != 54; | 查询基于TAG过滤出指定的单个设备在指定时间范围中符合要求的量采值 |
5 | select pa+pb, pb-pc, ca*va, pa/pc from postgres.test_tmr_ssz where time between ‘2019-07-04 18:00:00.000’ and ‘2019-07-04 18:00:00.000’ and sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10080’; | 查询基于TAG过滤出指定的单个设备在指定时间范围中的量采值,并对量采值进行数值的四则运算 |
6 | select sum(pa), avg(pb), max(pc), min(va), count(vb) from postgres.test_tmr_ssz where time between ‘2019-07-04 18:00:00.000’ and ‘2019-07-04 19:45:00.000’ and sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10080’; | 根据TAG过滤出指定的单个设备在指定时间范围内的值各类聚合运算 |
7 | select ds, count(pa) pacnt, count(pb) pbcnt, count(pc) pccnt from postgres.test_tmr_ssz where sf = ‘GD’ and ds in (‘SW’,’FS’) and yxt = ‘TMR’ and time between ‘2019-07-01 00:00:00.000’ and ‘2019-07-15 00:00:00.000’ group by ds; | 查询符合指定条件的全部设备在指定时间范围内采量的数据点指标数总和,并按指定TAG分组 |
8 | select time, sbbh, pa, pb, pc, ca, cb, cc, cz, va, vb, vc from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘DG’ and yxt = ‘TMR’ and time between ‘2019-07-01 00:00:00.000’ and ‘2019-07-15 00:00:00.000’ order by time desc limit 1000; | 查询符合指定条件的全部设备在指定时间范围内的全部量采数据点,并依照时间戳排序 |
9 | select sbbh, MAX(pa), MIN(pb), MAX(pc), MIN(ca), MAX(cb), MIN(cc), MAX(cz), MIN(va), MAX(vb), MIN(vc) from postgres.test_tmr_ssz where sf = ‘GD’ and yxt = ‘TMR’ and sbbh like ‘%12’ and time between ‘2019-07-01 00:00:00.000’ and ‘2019-07-15 00:00:00.000’ GROUP BY sbbh; | 通过模糊匹配查询符合条件的全部设备在指定时间范围内的全部量采数据点,并按设备编号分组后,求每个设备的个量采指标的最大/最小值 |
10 | select count(*) from postgres.test_tmr_ssz where ds=’GZ’; | 求指定地域全部设备的全部量采数据点个数 |
11 | select time, sf, ds, sbbh, (vaca+vbcb+vc*cc) AS szgl from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘YF’ and yxt = ‘TMR’ AND sbbh IN (‘10017’) and time between ‘2019-07-01 00:00:00.000’ and ‘2019-07-15 00:00:00.000’; | 求指定设备在指定时间范围内各上报时间的视在功率(vaca+vbcb+vc*cc) |
12 | select pa, pb, pc, ca, cb, cc, cz, va, vb, vc from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10460’ order by time desc limit 1; | 查询指定设备的最新上报指标数据 |
13 | select MAX(pa) from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10460’ UNION ALL select MAX(pa) from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10520’ UNION ALL select MAX(pa) from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘14680’ UNION ALL select MAX(pa) from postgres.test_tmr_ssz where sf = ‘GD’ and ds = ‘GZ’ and yxt = ‘TMR’ and sbbh = ‘10080’; | 对不同设备进行聚合查询后求UNION ALL |
14 | - | 上述1~13个用例并发混合执行并确保每个查询的执行次数近似相同 |
按以下方法分别进行两组对比测试:
对比场景一
下述结果中,蓝色值 表示横向对比中的最大值; 红色值表示 横向对比中的 最小值。平均查询响应时间(mean RT)以及查询响应中位数(median RT) 由于统计因素,仅具备相对的参考价值。
对比场景二
在文档使用中是否遇到以下问题
更多建议
匿名提交