sipp 对asterisk 进行压力测试

测试环境

asterisk  192.168.106.170

版本astrisk1.8

sipp   192.168.106.141

sipp版本3.3

asterisk配置

sip.conf

[general]

        context=default

        allowoverlap=no

        allowguest=no

        udpbindaddr=0.0.0.0

        tcpenable=no

        tcpbindaddr=0.0.0.0

        srvlookup=yes

        language=cn

        callevents=yes

        limitonpeers=no

        jbenable=yes





[sipp]



        host=192.168.106.141

        type=friend



        disallow=all

        allow=g729

        allow=g723

        allow=ulaw

        allow=alaw

        context=sipp

extension.conf

[general]

        static=yes

        writeprotect=no

        clearglobalvars=no



[globals]



[sipp]

        exten => 7777,1,Answer

        exten => 7777,2,SetMusicOnHold(default)

        exten => 7777,3,WaitMusicOnHold(2000)

        exten => 7777,4,Hangup

sipp客户端配置

uac-media.xml

<?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 'uac' scenario with pcap (rtp) play           -->

<!--                                                                    -->



<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:[field1]@[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:[field1]@[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[local_ip_type] [local_ip]

      t=0 0

      m=audio [media_port] RTP/AVP 0

      a=rtpmap:18 G729

     

    ]]>

  </send>



  <recv response="100" 

         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:[field1]@[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:[field1]@[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>





  <!-- Play a pre-recorded PCAP file (RTP stream)                       -->

  <nop>

      <action>

            <exec play_pcap_audio="pcap/g711a.pcap"/>

                </action>

                  </nop>





  <!-- Pause 800 seconds, which is approximately the duration of the      -->

  <!-- PCAP file                                                        -->

  <pause milliseconds="800000"/>





  <!--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:[field1]@[remote_ip]:[remote_port] SIP/2.0

      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]

      From: sipp <sip:[field0]@[local_ip]:[local_port]>;tag=[call_number]

      To: sut <sip:[field1]@[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>

44.csv

SEQUENTIAL

4444;7777;[authentication username=4444 password=8888]


之后执行命令

 

./sipp -sf uac-media.xml -inf 44.csv -p 5060 -i 192.168.106.141 -m 100000 192.168.106.170 -l 2000

显示

Last Error: Aborting call on UDP retransmission timeout for Call-ID '281...

------------------------------ Scenario Screen -------- [1-9]: Change Screen --

  Call-rate(length)   Port   Total-time  Total-calls  Remote-host

  10.0(0 ms)/1.000s   5060     313.57 s         3135  192.168.106.170:5060(UDP)



  9 new calls during 0.952 s period      0 ms scheduler resolution

  1322 calls (limit 2000)                Peak was 1332 calls, after 300 s

  1 Running, 1659 Paused, 62 Woken up

  1702 dead call msg (discarded)         1444 out-of-call msg (discarded)     

  3 open sockets                        



                                 Messages  Retrans   Timeout   Unexpected-Msg

      INVITE ---------->         3135      10823     1680               

         100 <----------         1140      0         0         0        

         200 <----------  E-RTD1 1140      1803      0         0        

         ACK ---------->         1140      1803                         

       Pause [    13:20]         1140                          133      

       Pause [      0ms]         0                             0        

         BYE ---------->         0         0         0                  

         200 <----------         0         0         0         0        



------------------------------ Test Terminated --------------------------------

asterisk服务器显示

SIP/sipp-00000cb7    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000a18    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000cb4    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000a3e    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000cb5    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000a3d    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000ab4    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000cb2    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000ab5    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000cb3    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000a3f    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000ab6    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000cb0    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000a3a    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000ab7    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000cb1    7777@sipp:3          Up      WaitMusicOnHold(2000)         

SIP/sipp-00000ab0    7777@sipp:3          Up      WaitMusicOnHold(2000)         

1000 active channels

1000 active calls

3783 calls processed

[root@test asterisk]# asterisk -rx"core show channels"

 

你可能感兴趣的:(压力测试)