Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2909377
  • 博文数量: 199
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 4126
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-06 19:06
个人简介

半个PostgreSQL DBA,热衷于数据库相关的技术。我的ppt分享https://pan.baidu.com/s/1eRQsdAa https://github.com/chenhuajun https://chenhuajun.github.io

文章分类

全部博文(199)

文章存档

2020年(5)

2019年(1)

2018年(12)

2017年(23)

2016年(43)

2015年(51)

2014年(27)

2013年(21)

2011年(1)

2010年(4)

2009年(5)

2008年(6)

分类: Mysql/postgreSQL

2015-07-14 23:42:22

之前在青云的云主机上做过pgbench测试,这次在阿里云上再测一下,数据仅供参考

1.  ECS

1.1  环境

CPU: 1核    内存: 1024 MB
带宽:1Mbps(峰值)
OS:CentOS 6.5 x64
PostgresQL9.4.2(shared_buffers = 128MB,其它都是默认值)

点击(此处)折叠或打开

  1. [root@xxxxxxxx ~]# cat /proc/cpuinfo
  2. processor : 0
  3. vendor_id : GenuineIntel
  4. cpu family : 6
  5. model : 62
  6. model name : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
  7. stepping : 4
  8. cpu MHz : 2599.981
  9. cache size : 20480 KB
  10. physical id : 0
  11. siblings : 1
  12. core id : 0
  13. cpu cores : 1
  14. apicid : 0
  15. initial apicid : 0
  16. fpu : yes
  17. fpu_exception : yes
  18. cpuid level : 13
  19. wp : yes
  20. flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 ht syscall nx lm up rep_good unfair_spinlock pni ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm
  21. bogomips : 5199.96
  22. clflush size : 64
  23. cache_alignment : 64
  24. address sizes : 46 bits physical, 48 bits virtual
  25. power management:

1.2 scale因子为100时pgbench的测试结果

点击(此处)折叠或打开

  1. -bash-4.1$ pgbench postgres -n -S -T 20
  2. transaction type: SELECT only
  3. scaling factor: 100
  4. query mode: simple
  5. number of clients: 1
  6. number of threads: 1
  7. duration: 20 s
  8. number of transactions actually processed: 19892
  9. latency average: 1.005 ms
  10. tps = 994.338042 (including connections establishing)
  11. tps = 994.576926 (excluding connections establishing)

  12. -bash-4.1$ pgbench postgres -n -S -c 40 -T 20
  13. transaction type: SELECT only
  14. scaling factor: 100
  15. query mode: simple
  16. number of clients: 40
  17. number of threads: 1
  18. duration: 20 s
  19. number of transactions actually processed: 16596
  20. latency average: 48.204 ms
  21. tps = 826.941182 (including connections establishing)
  22. tps = 834.350086 (excluding connections establishing)

  23. -bash-4.1$ pgbench postgres -n -T 20
  24. transaction type: TPC-B (sort of)
  25. scaling factor: 100
  26. query mode: simple
  27. number of clients: 1
  28. number of threads: 1
  29. duration: 20 s
  30. number of transactions actually processed: 4840
  31. latency average: 4.132 ms
  32. tps = 241.357157 (including connections establishing)
  33. tps = 241.411969 (excluding connections establishing)

  34. -bash-4.1$ pgbench postgres -n -c 40 -T 20
  35. transaction type: TPC-B (sort of)
  36. scaling factor: 100
  37. query mode: simple
  38. number of clients: 40
  39. number of threads: 1
  40. duration: 20 s
  41. number of transactions actually processed: 8621
  42. latency average: 92.797 ms
  43. tps = 429.793392 (including connections establishing)
  44. tps = 433.587615 (excluding connections establishing)

1.3 scale因子为10时pgbench的测试结果

点击(此处)折叠或打开

  1. -bash-4.1$ pgbench -S -n -T 20
  2. transaction type: SELECT only
  3. scaling factor: 10
  4. query mode: simple
  5. number of clients: 1
  6. number of threads: 1
  7. duration: 20 s
  8. number of transactions actually processed: 178573
  9. latency average: 0.112 ms
  10. tps = 8928.611607 (including connections establishing)
  11. tps = 8930.597763 (excluding connections establishing)

  12. -bash-4.1$ pgbench -S -n -c 40 -T 20
  13. transaction type: SELECT only
  14. scaling factor: 10
  15. query mode: simple
  16. number of clients: 40
  17. number of threads: 1
  18. duration: 20 s
  19. number of transactions actually processed: 152800
  20. latency average: 5.236 ms
  21. tps = 7620.938509 (including connections establishing)
  22. tps = 8490.798375 (excluding connections establishing)

  23. -bash-4.1$ pgbench -P 1 -n -c 40 -T 20
  24. transaction type: TPC-B (sort of)
  25. scaling factor: 10
  26. query mode: simple
  27. number of clients: 40
  28. number of threads: 1
  29. duration: 20 s
  30. number of transactions actually processed: 10143
  31. latency average: 78.727 ms
  32. latency stddev: 318.873 ms
  33. tps = 502.796187 (including connections establishing)
  34. tps = 507.197524 (excluding connections establishing)

  35. -bash-4.1$ pgbench -P 1 -n -T 20
  36. transaction type: TPC-B (sort of)
  37. scaling factor: 10
  38. query mode: simple
  39. number of clients: 1
  40. number of threads: 1
  41. duration: 20 s
  42. number of transactions actually processed: 8113
  43. latency average: 2.462 ms
  44. latency stddev: 5.968 ms
  45. tps = 405.617044 (including connections establishing)
  46. tps = 405.730862 (excluding connections establishing)

2. RDS

2.1 环境

数据库内存:1024M
最大IOPS:400
RDS:PostgreSQL 9.4.4
通过前面的ECS连RDS

2.2 scale因子为100时pgbench的测试结果

pgbench -s 100初始化到建索引的步骤时总是失败,并且收到了RDS发生主备切换的短信。 

点击(此处)折叠或打开

  1. postgres=> create index pgbench_accounts_pkey on pgbench_accounts(aid);
  2. server closed the connection unexpectedly
  3.  This probably means the server terminated abnormally
  4.  before or while processing the request.
  5. The connection to the server was lost. Attempting reset: Succeeded.
另外。通过观察RDS的监控画面,发现初始化IOPS使用量已经达到400的上限。

2.3 scale因子为10时pgbench的测试结果

初始化花了2分钟。

点击(此处)折叠或打开

  1. -bash-4.1$ pgbench -i -s 10
  2. NOTICE: table \"pgbench_history\" does not exist, skipping
  3. NOTICE: table \"pgbench_tellers\" does not exist, skipping
  4. NOTICE: table \"pgbench_accounts\" does not exist, skipping
  5. NOTICE: table \"pgbench_branches\" does not exist, skipping
  6. creating tables...
  7. 100000 of 1000000 tuples (10%) done (elapsed 1.83 s, remaining 16.48 s).
  8. 200000 of 1000000 tuples (20%) done (elapsed 19.65 s, remaining 78.58 s).
  9. 300000 of 1000000 tuples (30%) done (elapsed 27.08 s, remaining 63.18 s).
  10. 400000 of 1000000 tuples (40%) done (elapsed 43.28 s, remaining 64.92 s).
  11. 500000 of 1000000 tuples (50%) done (elapsed 62.33 s, remaining 62.33 s).
  12. 600000 of 1000000 tuples (60%) done (elapsed 64.12 s, remaining 42.75 s).
  13. 700000 of 1000000 tuples (70%) done (elapsed 84.43 s, remaining 36.19 s).
  14. 800000 of 1000000 tuples (80%) done (elapsed 89.05 s, remaining 22.26 s).
  15. 900000 of 1000000 tuples (90%) done (elapsed 104.94 s, remaining 11.66 s).
  16. 1000000 of 1000000 tuples (100%) done (elapsed 124.75 s, remaining 0.00 s).
  17. vacuum...
  18. set primary keys...
  19. done.

下面是测试结果

点击(此处)折叠或打开

  1. -bash-4.1$ pgbench postgres -n -S -T 20
  2. transaction type: SELECT only
  3. scaling factor: 10
  4. query mode: simple
  5. number of clients: 1
  6. number of threads: 1
  7. duration: 20 s
  8. number of transactions actually processed: 5075
  9. latency average: 3.941 ms
  10. tps = 253.728116 (including connections establishing)
  11. tps = 253.951345 (excluding connections establishing)

  12. -bash-4.1$ pgbench postgres -n -S -c 40 -T 20
  13. transaction type: SELECT only
  14. scaling factor: 10
  15. query mode: simple
  16. number of clients: 40
  17. number of threads: 1
  18. duration: 20 s
  19. number of transactions actually processed: 119146
  20. latency average: 6.714 ms
  21. tps = 5872.307162 (including connections establishing)
  22. tps = 6024.203600 (excluding connections establishing)

  23. -bash-4.1$ pgbench postgres -n -T 20
  24. transaction type: TPC-B (sort of)
  25. scaling factor: 10
  26. query mode: simple
  27. number of clients: 1
  28. number of threads: 1
  29. duration: 20 s
  30. number of transactions actually processed: 776
  31. latency average: 25.773 ms
  32. tps = 38.773930 (including connections establishing)
  33. tps = 38.805683 (excluding connections establishing)

  34. -bash-4.1$ pgbench postgres -n -c 40 -T 20
  35. transaction type: TPC-B (sort of)
  36. scaling factor: 10
  37. query mode: simple
  38. number of clients: 40
  39. number of threads: 1
  40. duration: 20 s
  41. number of transactions actually processed: 950
  42. latency average: 842.105 ms
  43. tps = 46.935648 (including connections establishing)
  44. tps = 48.162375 (excluding connections establishing)

ECS和RDS分别在北京A区和B区,网络延时高达1ms,这可能是上面的单并发的Select Only 的tps很低的原因。除此以外,进行TPC-B 40并发测试时,监控画面上显示的IOPS峰值最高只达到了200。

3. 参考

http://blog.chinaunix.net/uid-20726500-id-5090498.html



阅读(4207) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~