几个性能测试工具

 

我个人认为一个优秀的软件工程师必须掌握一定的测试技能。可能有的开发工程师认为测试是测试工程师的事情,不是开发工程师的事情。这种开发工程师是缺一条腿的,离开了测试工程师,你如何证明你的程序没有问题。

下面是我这两天搜集的性能测试工具,如果大家知道别的工具,可以在回复中分享出来。

Web Bench

Web Bench is very simple tool for benchmarking WWW or proxy servers. Uses fork() for simulating multiple clients and can use HTTP/0.9-HTTP/1.1 requests. This benchmark is not very realistic, but it can test if your HTTPD can realy handle that many clients at once (try to run some CGIs) without taking your machine down. Displays pages/min and bytes/sec. Can be used in more aggressive mode with -f switch.

Web Bench是一个简单的web或者web代理服务的基准测试工具。(它)使用fork()模拟多个客户端并且可以发起HTTP/0/9-HTTP/1.1 的请求。这个基准测试不是非常符合实际情况,但是可以测试出你的HTTP服务是否可以处理多个客户同时访问而不会把你的机器弄挂掉。这个工具可以获得服务 的两个指标:每分钟响应请求数量(pages/min)和每秒钟传输数据量(bytes/sec)。使用-f选项可以运行在主动模式下(不等待服务器响应直接发送下一个请求)。

安装方法参考:(总结)Web性能压力测试工具之WebBench详解

命令参数:

image

使用webbench测试elong,taobao,baidu的结果(可能受电脑性能、网络的因素影响):

image

ab - Apache HTTP server benchmarking tool

ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.

ab 命令会创建很多的并发访问线程,模拟多个访问者同时对某一URL地址进行访问。它的测试目标是基于URL的,因此,既可以用来测试Apache的负载压 力,也可以测试nginx、lighthttp、tomcat、IIS等其它Web服务器的压力。ab命令对发出负载的计算机要求很低,既不会占用很高 CPU,也不会占用很多内存,但却会给目标服务器造成巨大的负载,其原理类似CC攻击。自己测试使用也须注意,否则一次上太多的负载,可能造成目标服务器因资源耗完,严重时甚至导致死机。

网上有些文章说安装apache2后一般情况下在Apache的bin目录下。我在Ubunut 14.04上测试,并不是这样。要在Ubuntu上使用ab,需要apache2-utils。

image

ab的用法参考:ab - Apache HTTP server benchmarking tool,(总结)Web性能压力测试工具之ApacheBench(ab)详解

Siege

Siege is an http load testing and benchmarking utility. It was designed to let web developers measure their code under duress, to see how it will stand up to load on the internet. Siege supports basic authentication, cookies, HTTP and HTTPS protocols. It lets its user hit a web server with a configurable number of simulated web browsers. Those browsers place the server “under siege.”

Siege(英 文意思是围攻)是一个压力测试和评测工具,设计用于WEB开发这评估应用在压力下的承受能力:可以根据配置对一个WEB站点进行多用户的并发访问,记录每 个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。 Siege 支持基本的认证,cookies, HTTP 和 HTTPS 协议。

Siege的安装和用法可以参考:Siege Manual,Using Siege to Tune Apache on GNU/Linux,(总结)Web性能压力测试工具之Siege详解,压力测试工具siege的用法

我的Ubuntu 14.04上的使用如下:

image

测试本地的tomcat的测试结果:

image

Apache JMeter

Apache JMeter是一个专门为运行和服务器装载测试而设计的、100%的纯Java桌面运行程序。原先它是为Web/HTTP测试而设计的,但是它已经扩展以 支持各种各样的测试模块。它和用于HTTP和SQL数据库(使用JDBC)的模块一起运送。它可以用来测试静止资料库或者活动资料库中的服务器的运行情 况,可以用来模拟对服务器或者网络系统加以重负荷以测试它的抵抗力,或者用来分析不同负荷类型下的所有运行情况。它也提供了一个可替换的界面用来定制数据 显示,测试同步及测试的创建和执行。

JMeter的工作原理:JMeter可以作为Web服务器与浏览器之间的代理网关,以便捕获浏览器 的请求和Web服务器的响应,这样就很容易地生成性能测试脚本,有了性能测试脚本,JMeter就可以通过线程组来模拟真实用户对Web服务器的访问压 力,这与LoadRunner的工作原理基本一致。

image

下面是JMeter的官方简介:

The Apache JMeter™ desktop application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

What can I do with it?

Apache JMeter may be used to test performance both on static and dynamic resources (Files, Web dynamic languages - PHP, Java, ASP.NET, etc. -, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

What does it do?

Apache JMeter features include:

  • Ability to load and performance test many different server/protocol types:
    • Web - HTTP, HTTPS
    • SOAP
    • FTP
    • Database via JDBC
    • LDAP
    • Message-oriented middleware (MOM) via JMS
    • Mail - SMTP(S), POP3(S) and IMAP(S)
    • MongoDB (NoSQL)
    • Native commands or shell scripts
    • TCP
  • Complete portability and 100% Java purity .
  • Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
  • Careful GUI design allows faster Test Plan building and debugging.
  • Caching and offline analysis/replaying of test results.
  • Highly Extensible core:
    • Pluggable Samplers allow unlimited testing capabilities.
    • Several load statistics may be choosen with pluggable timers .
    • Data analysis and visualization plugins allow great extensibility as well as personalization.
    • Functions can be used to provide dynamic input to a test or provide data manipulation.
    • Scriptable Samplers (BeanShell, BSF-compatible languages and JSR223-compatible languages)

JMeter的用户手册:http://jmeter.apache.org/usermanual/index.html

推荐一本书籍:《零成本实现Web性能测试》

JMeter的脚本录制工具:Badboy

Web Polygraph

Web Polygraph这个软件也是一个用于测试WEB性能的工具,这个工具是很多公司的标准测试工具,包括微软在分析其软件性能的时候,也是使用这个工具做为基准工具的。很多招聘测试员的广告中都注明需要熟练掌握这个测试工具。

Web Polygraph is a freely available performance testing tool for caching proxies, origin server accelerators, L4/7 switches, content filters, and other Web intermediaries. Polygraph's features include:

  • high-performance HTTP clients and servers
  • realistic HTTP, FTP and SSL traffic generation
  • HTTP and SOCKS5 proxy support, with chaining
  • HTTP Basic, NTLM, and Negotiate proxy authentication
  • LDAP-friendly generation of user credentials
  • flexible content simulation
  • ready-to-use standard workloads for benchmarking
  • powerful domain-specific configuration language
  • portable open-source implementation
  • friendly commercial support

TCPCopy

Although the real live flow is important for the test of Internet server applications, it is hard to simulate it as online environments are too complex. To support more realistic testing of Internet server applications, we propose a live flow reproduction tool – TCPCopy, which could generate the test workload that is similar to the production workload. TCPCopy consists of two components: the TCPCopy Client (tcpcopy) and the TCPCopy Server (intercept). The TCPCopy Client (tcpcopy) is deployed on the production system and it copies live flow data, does necessary modifications and sends them to the test system in real-time. The TCPCopy Server (intercept) is deployed on the test system and it returns necessary response information to the TCPCopy Client (tcpcopy). To the test server, the reproduced workload is just from end-users. Currently, TCPCopy has been widely used by companies in China.

TCPCopy has little influence on the production system except occupying additional CPU, memory and bandwidth. Moreover, the reproduced workload is similar to the production workload in request diversity, network latency and resource occupation.

Traditional architecture

tcpcopy

Advanced architecture

tcpcopy

Tsung

Tsung is an open-source multi-protocol distributed load testing tool

It can be used to stress HTTP, WebDAV, SOAP, PostgreSQL, MySQL, LDAP and Jabber/XMPP servers. Tsung is a free software released under the GPLv2license.

The purpose of Tsung is to simulate users in order to test the scalability and performance of IP based client/server applications. You can use it to do load and stress testing of your servers. Many protocols have been implemented and tested, and it can be easily extended.

It can be distributed on several client machines and is able to simulate hundreds of thousands of virtual users concurrently (or even millions if you have enough hardware ...).

Tsung is developed in Erlang, an open-source language made by Ericsson for building robust fault-tolerant distributed applications.

curl-loader

curl-loader (also known as "omes-nik" and "davilka") is an open-source tool written in C-language, simulating application load and application behavior of thousands and tens of thousand HTTP/HTTPS and FTP/FTPS clients, each with its own source IP-address. In contrast to other tools curl-loader is using real C-written client protocol stacks, namely, HTTP and FTP stacks of libcurl and TLS/SSL of openssl, and simulates user behavior with support for login and authentication flavors.

The goal of the project is to deliver a powerful and flexible open-source testing solution as a real alternative to Spirent Avalanche and IXIA IxLoad.

The tool is useful for performance loading of various application services, for testing web and ftp servers and traffic generation. Activities of each virtual client are logged and collected statistics includes information about resolving, connection establishment, sending of requests, receiving responses, headers and data received/sent, errors from network, TLS/SSL and application (HTTP, FTP) level events and errors.

Virtual clients are grouped together to the so-called batches of clients, performing the same sort of activities, like:

  • authentication login;
  • user activity simulation by fetching several URLs with configurable timeouts in between;
  • logoff.

The tool can be easily extended to generate sftp, telnet, tftp, ldap, ssh, scp etc other application protocols, supported by the great libcurl library.

Grinder

Grinder 是一个开源的JVM负载测试框架,它通过很多负载注射器来为分布式测试提供了便利。 支持用于执行测试脚本的Jython脚本引擎HTTP测试可通过HTTP代理进行管理。根据项目网站的说法,Grinder的 主要目标用户是“理解他们所测代码的人——Grinder不仅仅是带有一组相关响应时间的‘黑盒’测试。由于测试过程可以进行编码——而不是简单地脚本 化,所以程序员能测试应用中内部的各个层次,而不仅仅是通过用户界面测试响应时间。

LoadRunner(商业软件)

LoadRunner 是一种预测系统行为和性能的工业标准级负载测试工具。通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找问题,LoadRunner 能够对整个企业架构进行测试。通过使用LoadRunner , 企业能最大限度地缩短测试时间, 优化性能和加速应用系统的发布周期。企业的网络应用环境都必须支持大量用户,网络体系架构中含各类应用环境且由不同供应商提供软件和硬件产品。难以预知的 用户负载和愈来愈复杂的应用环境使公司时时担心会发生用户响应速度过慢, 系统崩溃等问题。这些都不可避免地导致公司收益的损失。Mercury Interactive 的 LoadRunner 能让企业保护自己的收入来源, 无需购置额外硬件而最大限度地利用现有的IT 资源, 并确保终端用户在应用系统的各个环节中对其测试应用的质量, 可靠性和可扩展性都有良好的评价。LoadRunner 是一种适用于各种体系架构的自动负载测试工具, 它能预测系统行为并优化系统性能。LoadRunner 的测试对象是整个企业的系统, 它通过模拟实际用户的操作行为和实行实时性能监测, 来帮助您更快的查找和发现问题。此外,LoadRunner 能支持广范的协议和技术, 为您的特殊环境提供特殊的解决方案。

kylinpet(国产商业工具)

kylinPET(performance emulation tool,麒麟宠物)是一款功能强大的性能测试工具;界面友好、操作方便,资源占用率低;自带TCP/IP协议栈,支持虚拟大量IP;支持IPv4、 IPv6的多种业务测试;支持WEB/WebService业务与Flex(HTTP)、IMS业务(SIP)、IPTV业务(RTSP/IGMP /MLD)、XMPP、Socket业务、数据库、JMS、FTP/SFTP、WEB视频(包括FLV/MP4/HTTP Live Streaming/HTTP Smooth Streaming/HTTP Dynamic Streaming)、WebSocket、JAVA;支持多种协议组合。

image

总结一些性能测试的做法

  • 为了减少网络延迟和带宽限制对性能测试的影响,最好在内网进行测试。
  • 性能测试一般在优化前和优化后,测试两轮,这样能够比较出优化前后的效果。
  • 性能测试最好跑的时间长一些,观察程序是否存在内存泄漏、资源未释放等问题。
  • 有的公司为了避免影响线上环境,只在测试环境做性能测试。我所在的公司性能测试一般在线下线上都会做,线上做性能测试可以了解生产环境的性能情况。

参考:

  • (总结)Web性能压力测试工具之Siege详解
  • 利用tcpcopy引流做模拟在线测试
  • (总结)Web性能压力测试工具之WebBench详解
  • (总结)Web性能压力测试工具之ApacheBench(ab)详解
  • 十个免费的Web压力测试工具
  • 如何在低速率网络中测试 Web 应用
  • 性​能​测​试​管​理

转载于:https://www.cnblogs.com/zhengah/p/5051542.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/399178.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Bootstrap页面布局14 - BS按钮群组

首先看看这个代码&#xff1a; <div classbtn-group><button typebutton classbtn>计算机</button><button typebutton classbtn>网络</button><button typebutton classbtn>桌面项目</button> </div> 将功能相近的按钮分成一…

type const mysql_Mysql Explain之type详解

select version()&#xff1a;5.7.21MySQL 提供了一个 EXPLAIN 命令, 它可以对 SQL 语句进行分析, 并输出 SQL 执行的详细信息, 以供开发人员针对性优化.例如分析一条 SELECT 语句EXPLAIN 结果中的type字段Tips&#xff1a;常见的扫描方式system&#xff1a;系统表&#xff0c;…

Android Intent传递数据

刚开始看郭大神的<>,实现以下里面的一些例子.Intent传递数据. 我们利用显示的方式进行Intent的启动. 1.启动intent并输入数据. Intent intentnew Intent(MainActivity.this,TwoActivity.class);intent.putExtra("data", "hello two");startActivity(…

WCF中的标准绑定

使用过WCF的童鞋们都很清楚&#xff0c;绑定是必须的。我将这些绑定总结了下。 一、标准绑定简要说明 1.basicHttpBinding基于WS-I Basic Profile 1.1 的web服务,所需的.Net Framework版本为 3.0 以上。 2.wsHttpBinding针对改进的web服务的绑定,包括WS-Security,WS-Transactio…

PM2.5空气质量指数(AQI)是如何计算的

源&#xff1a;PM2.5空气质量指数(AQI)是如何计算的 阅读目录 AQI如何计算  空气污染指数分级标准AQI如何计算 具体要计算PM2.5空气质量指数(AQI)&#xff0c;SENBE申贝技术人员向您介绍如何计算的公式。比如当实测浓度小于等于0.035时&#xff0c;根据实测浓度50/0.035计算。…

C++对于大型图片的加载缩放尝试

Qt对于图片的操作主要集中在这几个类 QImage ,QImageReader ,QPixmap 其中QImage这个类对图片的缩放有几个很不错的技巧&#xff0c;不过对于大图片却并不好使&#xff0c;当我们去看QImage的实现代码时&#xff0c;会发现其中读取QImageReader来加载图片&#xff0c;当我们去看…

PHP移动互联网开发笔记(3)——运算符

一、PHP的运算符PHP中有丰富的运算符集&#xff0c;它们中大部分直接来自于C语言。按照不同功能区分&#xff0c;运算符可以分为&#xff1a;算术运算符、字符串运算符、赋值运算符、位运算符、条件运算符&#xff0c;以及逻辑运算符等。当各种运算符在同一个表达式中时&#x…

xadmin与mysql数据库_十八、Django3.0学习之引入xadmin

一、将xadmin导入Django工程中1.1 xadmin下载地址&#xff1a; https://github.com/sshwsfc/xadmin/tree/django2或者&#xff1a;链接&#xff1a;https://pan.baidu.com/s/1VJPsN5GOW_xbiPb8t43oRg提取码&#xff1a;nkei1.2 下载压缩包1.3 到zip目录下&#xff0c;进行pip3 …

WebApi个人理解概要

WebApi概要Global文件的作用&#xff1a; 12345678910111213141516public class MvcApplication : System.Web.HttpApplication{protected void Application_Start(){//1.注册区域路由AreaRegistration.RegisterAllAreas();//2.注册webApi的路由WebApiConfig.Register(GlobalCo…

帮 C/C++ 程序员彻底了解链接器

为什么80%的码农都做不了架构师&#xff1f;>>> http://blog.jobbole.com/96225/ 转载于:https://my.oschina.net/lieefu/blog/547083

12306订票助手java_12306订票助手

权限信息 com.android.alarm.permission.SET_ALARM 读取日历活动和机密信息 添加或修改日历活动&#xff0c;并在所有者不知情的情况下向邀请对象发送电子邮件 完全的网络访问权限 查看网络连接 查看WLAN连接 读取您的USB存储设备中的内容 修改或删除您的USB存储设备中的内容 a…

linux安装软件包(pip, distribute, nose, virtualenv)

一、 先安装pip 1. 先去python官网下载pip&#xff0c;网站&#xff1a;https://pypi.python.org/pypi/pip#downloads&#xff0c;点击下图中的“download” 2. 然后选择下图标注的包&#xff0c;链接可以通过f12获取&#xff0c;具体如下&#xff1a; 3. 然后再linux终端输入&…

event对象获取方法

为什么80%的码农都做不了架构师&#xff1f;>>> http://www.jb51.net/article/42691.htm 转载于:https://my.oschina.net/zxin/blog/547902

【iOS开发每日小笔记(一)】UIPickerView 自动选择某个component的某个row

这篇文章是我的【iOS开发每日小笔记】系列中的一片&#xff0c;记录的是今天在开发工作中遇到的&#xff0c;可以用很短的文章或很小的demo演示解释出来的小心得小技巧。它们可能会给用户体验、代码效率得到一些提升&#xff0c;或是之前自己没有接触过的技术&#xff0c;很开心…

在Hadoop上运行基于RMM中文分词算法的MapReduce程序

原文&#xff1a;http://xiaoxia.org/2011/12/18/map-reduce-program-of-rmm-word-count-on-hadoop/ 在Hadoop上运行基于RMM中文分词算法的MapReduce程序 23条回复我知道这个文章标题很“学术”化&#xff0c;很俗&#xff0c;让人看起来是一篇很牛B或者很装逼的论文&#xff0…

Web服务的调用

1、创建服务引用 例如&#xff1a;天气预报 2、在代码添加引用空间 TvProgram.ChinaTVprogramWebService tpnew TvProgram.ChinaTVprogramWebService(); DataSet dstp.getAreaDataSet();3、引用具体方法 private void comBox1_SelectedIndexChanged(object sender,EventArgs e)…

aref无效 lisp_aref无效 lisp_Common Lisp专题4:数组

1)用make-array创建数组&#xff1a;CL-USER> (make-array 5 :initial-element nil)#(NIL NIL NIL NIL NIL)CL-USER> (make-array 5 :initial-contents (a e i o u))#(A E I O U)CL-USER> (setf arr (make-array 5 :initial-contents (a e i o u)))#(A E I O U)CL-USE…

Visual Studio 快捷键汇总

常见方法&#xff1a; 强迫智能感知&#xff1a;CtrlJ。智能感知是Visual Studio最大的亮点之一&#xff0c;选择Visual Studio恐怕不会没有这个原因。 撤销&#xff1a;CtrlZ。除非你是天才&#xff0c;那么这个快捷键也是最常用的。强迫显示参数信息&#xff1a;Ctrl-Shift-空…

nodejs解析apk

项目再github上的目录&#xff1a;https://github.com/chen2009277025/nodejs_apkToolnodejs无可厚非是新兴的后端语言&#xff0c;因为他的开发语言是javascript&#xff0c;javascript语言的自身优势&#xff0c;让nodejs迅速的火遍大江南北。很多的nodejs的开发插件如雨后春…

VC2013 代码图,依赖项关系图,等出错解决办法.

环境WIN10VS2013SQL2015 当VS2013代码图,依赖项关系图等出现 数据库连接错误时 去http://www.microsoft.com/zh-cn/download/details.aspx?id29062 下载 SqlLocalDB.MSI进行安装 怀疑是先装了SQL2015后安装VS2013时默认未安装SqlLocalDB.MSI导致.转载于:https://www.cnblogs.c…