性能测试

JerryXia 发表于 , 阅读 (16)

性能测试

我的blog - php性能优化: http://blog.daydaygo.top/post/php-performance-optimization
慕课网 - 高性能产品的必由之路—性能测试工具: http://www.imooc.com/learn/278

横向扩展; 数据库优化; 性能(更多请求)
使用技术手段, 模拟大量用户访问, 分析系统 性能/负载

  • 指标

TTLB(time to last byte): 平均响应时间
平均时间响应时间: 2/5/10 原则
性能指标: cpu, 内存, I/O, 带宽

  • why

系统性能评估
识别性能瓶颈, 协助性能调优
突发流量方案
系统运维成本

  • 分类

负载测试(load test): 正常业务下
压力测试(stress test): 极端情况下

  • tool

top, 使用 htop 替代
free
sysstat: 保存系统状态到日志中
fio: 测试 I/O 极限
nmon: performance monitoring tool for Linux
nagios: 一款开源的免费网络监控工具(感觉非常非常旧了, 公司之前的运维就用的这个)

JMeter

对比 ab, 真心感觉太复杂了, 即使 restful 场景, 也没有这么多的设置

jmeter 基本概念: thread samples
自动化一般方法: 录制 + 回放

jmeter 简单测试流程: 按照下面的结构设置, 使用 http(s) test script recorder 开启代理, 并在 浏览器 Internet 设置使用此代理连接, 这时访问的 url 都会显示到 workbench 中, 将需要执行测试的 url 复制粘贴到 test plan 下相应的 thread group 中, 设置每个url需要的参数(如果需要), 运行, 在 view result tree 查看是否正确拿到数据, 确定 test plan 之后, 在 thread group 中设置 连接数 / 并发数 等

test plan    thread group        http request default        recording controllerworkbench    http(s) test script recorder        view result tree    transaction controller        http request default        recording controller        ...

rango 压测 swoole

rango 压测 swoole: http://rango.swoole.com/archives/254

rango: 框架的消耗是纯CPU消耗, 在搞并发场景下, 性能越差的框架, cpu 的负载就越高

运行压力测试时, 要实时监控系统负载(top): cpu 内存 IO 带宽

打造高效的测试团队 - 携程C4技术分享沙龙

慕课网 <携程C4技术分享沙龙> http://www.imooc.com/learn/327

有些课程确实是闲暇无聊的时候看到的, 权当时间消磨的纪念