Performance testing monitoring metrics and analytics

1. What key indicators need to be monitored for software performance testing?

The purpose of software performance testing mainly has the following three points:

1. Evaluate the current performance of the system and determine whether the system meets the expected performance requirements.

2. Find possible performance problems in software systems, locate performance bottlenecks and solve problems.

3. Determine the performance of the software system, predict the load and pressure tolerance of the system, and evaluate the system performance before application deployment.

For users, they are most concerned about the current system:

1. Does it meet the online performance requirements?

2. What is the ultimate load of the system?

3. How stable is the system?

Therefore, in view of the purpose of the above performance test and the concerns of users, in order to achieve the above purpose and answer the concerns of users, it is necessary to first perform a performance test and clarify which key indicators need to be collected and monitored. Usually, the performance test monitoring indicators are mainly It is divided into: resource indicators and system indicators. As shown in the figure below, resource indicators are directly related to hardware resource consumption, while system indicators are directly related to user scenarios and requirements.

Description of key indicators for performance test monitoring:

1. Resource indicators

CPU usage: refers to the percentage of CPU time consumed by user processes and system processes. In a long-term case, the generally acceptable upper limit does not exceed 85%.

Memory utilization: Memory utilization = (1-free memory/total memory size)*100%, generally at least 10% of available memory is available, and the acceptable upper limit for memory utilization is 85%.

Disk I/O: Disks are mainly used to access data, so when it comes to IO operations, there are two corresponding operations. When storing data, it corresponds to writing IO operations, and when fetching data, it corresponds to It is a read IO operation. Generally, % Disk Time (the percentage of time the disk is used for read and write operations) is used to measure the disk read and write performance.

Network bandwidth: It is generally measured by the counter Bytes Total/sec, which is expressed as the rate at which bytes are sent and received, including frame characters. To judge whether the network connection speed is the bottleneck, you can use the value of this counter to compare with the current network bandwidth.

2. System indicators

Number of concurrent users: The number of users who submit requests to the system at the same time at a physical moment.

Number of online users: The number of users accessing the system within a certain period of time, and these users do not necessarily submit requests to the system at the same time.

Average Response Time: The average response time for the system to process transactions. The response time of a transaction is the time from when the client submits an access request to when the client receives a response from the server. For pages that respond quickly to the system, the general response time is about 3 seconds.

事务成功率:性能测试中,定义事务用于度量一个或者多个业务流程的性能指标,如用户登录、保存订单、提交订单操作均可定义为事务,如下图所示:

单位时间内系统可以成功完成多少个定义的事务,在一定程度上反应了系统的处理能力,一般以事务成功率来度量,计算公式如下所示:

超时错误率:主要指事务由于超时或系统内部其它错误导致失败占总事务的比率。

二、如何监控关键指标?

1.资源指标监控

主要针对各服务器系统平台(Windows、Linux、Unix等)资源使用进行监控。

可以使用系统自带的性能监控工具或者第三方工具进行监控,如Windows系统自带的“系统性能监视器”,如下图所示:

Linux系统下,free、vmstat、sar、iostat等命令监控内存、CPU、磁盘IO等的使用情况,如下图所示:

第三方监控工具,如spotlight,spotlight是quest公司开发的一款可以针对多种系统平台及数据库进行监控的可视化工具,如下图所示:

Nmon是IBM提供的监控AIX和Linux系统资源的免费工具,可以对收集的资源信息通过Excel进行统计分析形成直观的统计图,如下图所示:

2.系统指标监控

系统指标监控一般通过性能测试工具(如LoadRunner、Jmeter等)以图形化方式监控,如下图所示,并发用户数与平均响应时间关系图。

三、如何分析监控的关键指标?

通过第二部分监控收集到性能度量关键指标,如何进行分析,并判断是否存在性能瓶颈呢?以下主要从资源指标与系统指标两方面进行阐述。

1.资源指标分析

判断CPU是否是瓶颈的方法:一般情况下CPU满负荷工作,有时候并不能判定为CPU出现瓶颈,比如Linux总是试图要CPU尽可能的繁忙,使得任务的吞吐量最大化,即CPU尽可能最大化使用。因此,一般判断CPU为瓶颈,主要从两方面:一是CPU空闲持续为0,二是运行队列大于CPU核数(经验值3-4倍),即可判定存在瓶颈,对于CPU高消耗主要由什么引起的,可能是应用程序不合理造成,也可能是硬件资源不足,需要具体问题具体分析,比如问题SQL语句引起,则需要跟踪并优化引起CPU使用过高的SQL语句。

判断内存是否是瓶颈的方法:一般至少有10%可用内存,内存使用率可接受上限为85%。当空闲内存变小时,系统开始频繁地调动磁盘页面文件,空闲内存过小可能是内存不足或内存泄漏引起,需要根据系统实际情况监控分析。

判断磁盘I/O是否是瓶颈的方法:磁盘I/O对于数据库服务器、文件服务器、流媒体服务器系统来说,更容易成为瓶颈,一般从以下几个方面对磁盘I/O进行分析判断:

① 计算每磁盘I/O数

每磁盘I/O数可用来与磁盘的I/O能力进行对比,如果经过计算得到的每磁盘I/O数超过了磁盘标称的I/O能力,则说明确实存在磁盘的性能瓶颈,每磁盘I/O计算方法如下表:

② 监控磁盘读写,如果磁盘长时间进行大数据量读写操作,且cpu等待超过20%,则说明磁盘I/O存在问题,考虑提高磁盘I/O读写性能。

判断网络带宽是否是瓶颈的方法:判断网络带宽是否是系统运行性能瓶颈的首要条件是网络带宽是否会影响系统交易执行性能。例如:减小网络带宽,并发用户数、响应时间与事务通过率等性能指标是否不能接受;或者增加网络带宽,并发用户数、响应时间与事务通过率等性能指标会得到明显提高。

在实际性能测试中,如果发现始终报连接超时,而实际手工访问可以正常访问,可以通过ping应用服务器IP或网关IP,如果出现网络严重延迟或丢包,则说明网络不稳定,需要检查网络。

通过对资源指标四个指标的分析,实际上各个方面都是互相依赖的,不能孤立的单从某个方面进行排查。当一个方面出现性能问题时,往往会引发其他方面的性能问题,例如,大量的磁盘读写势必消耗CPU和IO资源,而内存的不足会导致频繁地进行内存页写入磁盘、磁盘写到内存的操作,造成磁盘IO瓶颈,同时,大量的网络流量也会造成CPU过载,所以,在分析性能问题时,需要从各个方面进行考虑。

2.系统指标分析

并发用户数:系统能够支持的用户数是系统容量的重要标志,并发用户数用于度量系统在高并发量访问下,系统的并行处理能力,一般如果系统中存在死锁、资源争用,在并发访问下,由于请求处于队列等待中,系统响应就会随着时间变慢。

一般情况下,选用高吞吐量、高数据库I/O、高商业风险的业务功能进行并发用户访问测试。

判断系统能够承受的最大并发用户数,通常以满足以下条件为准:

1、业务功能操作平均响应时间在合理范围之内

2、事务成功率在合理范围之内

3、 系统运行无故障(无异常宕机)

4、系统资源指标使用在合理范围内

平均响应时间:对于客户端用户来说,最直观的体验就是访问该页面快或者慢,即响应时间的长短。比如在持续并发性能测试过程中,客户感知访问应用很慢,监控到的平均响应时间也逐渐变长,这时就需要先借助于监控到的资源指标,首先排除资源方面的限制因素,再从应用本身进行定位,如可以采用页面细分工具(如httpwatch、Loadrunner Anaysis中的页面组件细分)分析响应比较慢的页面。

事务成功率、超时出错率:事务成功率越高,则表明系统处理能力越大;而失败事务主要由于系统响应慢,导致访问业务功能超时,或者系统业务功能异常,不能正常访问等,需要根据事务错误提示信息,具体分析。

综上所述,软件性能测试是执行、监控—〉分析—〉调优不断进行的过程,即监控是为分析提供更多的参考数据,分析是为了进行调优,调优是解决当前系统存在的性能瓶颈,为用户提供更好、更快的客户体验。由于分析、调优需要根据具体问题进行具体分析,本文未做过多说明,只对通用的关键指标进行监控分析,建议在实际工作中可从资源指标与系统指标两个方面,层层检测、步步排查,性能问题就无处藏身,一旦找到出现问题的原因,性能问题也就迎刃而解!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174153&siteId=291194637