首页 > 其他分享 >使用SIPp进行压力测试

使用SIPp进行压力测试

时间:2023-01-03 20:47:10浏览次数:54  
标签:xml call ip tag sipp 测试 压力 SIPp local

本文更新于2022-05-14,使用SIPp v3.5.3。

官网:http://sipp.sourceforge.net/

中文文档:http://sipp.sourceforge.net/doc/cn-reference.pdf

安装

其它版本请于官网下载。

wget https://github.com/SIPp/sipp/releases/download/v3.5.3/sipp-3.5.3.tar.gz
tar -xzf sipp-3.5.3.tar.gz
cd sipp-3.5.3/
./build.sh

sudo cp sipp /usr/local/bin/sipp

使用

sipp HOST[:PORT] [OPTIONS]

OPTIONS可为:

  • -aa:对INFO、NOTIFY、OPTIONS、UPDATE自动回复200 OK。
  • -d:每个呼叫的持续时间,单位为毫秒。
  • -inf CSVFILENAME:CSV数据文件。
  • -p PORT:sipp监听的端口。默认为5060(与freeswitch默认的internal Profile端口相同)。
  • -r N:每秒发起的请求数。
  • -rtp_echo:将收到的RTP流原样返回。
  • -s USERNAME:被呼方用户名。默认为service。
  • -sf XMLFILENAME:XML场景文件。
  • -sn SCENARIO:使用默认的场景文件。uac作为UAC(即SIP客户端)。

运行时可使用1、2、3、4按键切换界面的显示信息。

示例

注册测试

sipp 192.168.1.1:5060 -aa -sf reg.xml -inf users.csv -r 10 -p 6060

reg.xml场景文件的内容如下(官网有示例文件http://sipp.sourceforge.net/doc/branchc.xml,不过需修改才能使用):

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="register">
  <send retrans="500">
    <![CDATA[
      REGISTER sip:[remote_ip] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      Max-Forwards: 70
      Contact: sip:[field0]@[local_ip]:[local_port]
      To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>
      From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
      Call-ID: [call_id]
      CSeq: 1 REGISTER
      Expires: 3600
      User-Agent: SIPp
      Content-Length: 0
    ]]>
  </send>

 <recv response="401" auth="true">
 </recv>

<send retrans="500">
    <![CDATA[
      REGISTER sip:[field0]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      Max-Forwards: 70
      Contact: sip:[field0]@[local_ip]:[local_port]
      [field1]
      To: [field0] <sip:[field0]@[remote_ip]:[remote_port]>
      From: [field0] <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]
      Call-ID: [call_id]
      CSeq: 2 REGISTER
      Expires: 3600
      User-Agent: SIPp
      Content-Length: [len]
    ]]>
  </send>

  <recv response="200">
  </recv>

  <!-- Keep the call open for a while in case the 200 is lost to be     -->
  <!-- able to retransmit it if we receive the 200 again.               -->
  <timewait milliseconds="500"/>

  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>

users.csv数据文件的内容如下(该文件提供注册用户的用户名和密码,SEQUENTIAL表示顺序执行):

SEQUENTIAL
1001;[authentication username=1001 password=1234]
1002;[authentication username=1002 password=1234]
1003;[authentication username=1003 password=1234]

呼叫测试(使用默认场景)

sipp 192.168.1.1:5080 -sn uac -r 1 -d 10000 -rtp_echo -s 9664

需先在public Dialplan中为9664添加相应的路由。

呼叫测试(使用场景文件)

sipp 192.168.1.1:5080 -sf uac.xml -r 1 -d 10000 -rtp_echo -s 9664

需先在public Dialplan中为9664添加相应的路由。

uac.xml场景文件可以在官网查看:http://sipp.sourceforge.net/doc/uac.xml.html。文件内容如下:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<!-- This program is free software; you can redistribute it and/or      -->
<!-- modify it under the terms of the GNU General Public License as     -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version.                    -->
<!--                                                                    -->
<!-- This program is distributed in the hope that it will be useful,    -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
<!-- GNU General Public License for more details.                       -->
<!--                                                                    -->
<!-- You should have received a copy of the GNU General Public License  -->
<!-- along with this program; if not, write to the                      -->
<!-- Free Software Foundation, Inc.,                                    -->
<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
<!--                                                                    -->
<!--                 Sipp default 'uac' scenario.                       -->
<!--                                                                    -->

<scenario name="Basic Sipstone UAC">
  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
  <!-- generated by sipp. To do so, use [call_id] keyword.                -->
  <send retrans="500">
    <![CDATA[

      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
      To: sut <sip:[service]@[remote_ip]:[remote_port]>
      Call-ID: [call_id]
      CSeq: 1 INVITE
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Subject: Performance Test
      Content-Type: application/sdp
      Content-Length: [len]

      v=0
      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
      s=-
      c=IN IP[media_ip_type] [media_ip]
      t=0 0
      m=audio [media_port] RTP/AVP 0
      a=rtpmap:0 PCMU/8000

    ]]>
  </send>

  <recv response="100"
        optional="true">
  </recv>

  <recv response="180" optional="true">
  </recv>

  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
  <!-- are saved and used for following messages sent. Useful to test   -->
  <!-- against stateful SIP proxies/B2BUAs.                             -->
  <recv response="200" rtd="true">
  </recv>

  <!-- Packet lost can be simulated in any send/recv message by         -->
  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
  <send>
    <![CDATA[

      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
      Call-ID: [call_id]
      CSeq: 1 ACK
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Subject: Performance Test
      Content-Length: 0

    ]]>
  </send>

  <!-- This delay can be customized by the -d command-line option       -->
  <!-- or by adding a 'milliseconds = "value"' option here.             -->
  <pause/>

  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
  <send retrans="500">
    <![CDATA[

      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
      Call-ID: [call_id]
      CSeq: 2 BYE
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Subject: Performance Test
      Content-Length: 0

    ]]>
  </send>

  <recv response="200" crlf="true">
  </recv>

  <!-- definition of the response time repartition table (unit is ms)   -->
  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

  <!-- definition of the call length repartition table (unit is ms)     -->
  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>

</scenario>

标签:xml,call,ip,tag,sipp,测试,压力,SIPp,local
From: https://www.cnblogs.com/garvenc/p/stress_testing_with_sipp.html

相关文章

  • 性能测试技术笔记(二):如何准备测试环境和数据
    这篇文章,继续分享工作笔记中关于性能测试的内容。上一篇文章聊了如何快速上手压测工作的几个切入点和注意事项,这些内容可以帮助我们更快的介入项目。但实际工作中,前期的......
  • 弱网测试qnet
    一、客户端/服务端连接说明游戏客户端和服务端连接简化如下:网络问题可能出现在上面的每个环节:手机端:2G,3G等地方互联网端:光纤挖断服务器端:服务器高负载若未考......
  • 测试
    precode.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px5px}.hljs{background:#23241f;color:#f8f8f2}.h......
  • 端对端自动化测试文档
    概述官方网址:https://playwright.dev/什么是playwright?playwright,端对端自动化测试,选择该技术栈用于端对端测试,有几大原因:支持所有浏览器快速可靠的运行强大的自动......
  • 文件IO操作开发笔记(一):使用Qt的QFile对磁盘文件存储进行性能测试以及测试工具
    前言  在做到个别项目对日志要求较高,要求并行写入的数据较多,尽管写入数据的线程放在子线程,仍然会造成界面程序的假死(实际上Qt还是在跑,只是磁盘消耗超过瓶颈,造成假死(注意:......
  • 性能测试技术笔记(一):如何快速上手压测工作
    新年第一个工作日,继续整理之前的技术笔记。前面通过三篇的内容,将自动化测试相关的技术笔记做了整理汇总。这篇内容,主要是我刚开始做性能测试时的一些记录,对新手或者刚进......
  • 跨域问题测试
    浏览器随便打开一个地址 ,打开控制台varxhr=newXMLHttpRequest();xhr.open('GET','http://127.0.0.1:9000/dev/tsscPlanDay/saveTSscPlanDay');xhr.setRequestHe......
  • 浅谈 | 高低温环境下的车载屏幕功能耐久与触屏精度自动化测试
    随着汽车科技的发展,汽车电子产品的智能化程度在不断提升,车载屏幕等交互终端的应用性能越来越受用户关注。由于汽车常年所处的环境多变,恶劣气候会影响汽车电子产品的性能。......
  • RHCSA模拟测试
    考试信息:IPADDR:172.25.254.x(X在这里指您的工作站编号加100)NETMASK:255.255.255.0GATEWAY:172.25.254.250DNS:172.25.254.250需要在图形界面里面添加dnsyum源地址......
  • 为什么做软件测试要进行Code Review?
    为什么做软件测试要进行CodeReview?这是很多开发同学、甚至部分测试员都很疑惑的一个问题。在测试中结合进行CodeReview可以大大提升测试的质量和效率。 1、......