SIP Stress Testing -Part 3 (SIPp)

.

Introduction

This is Part 3 of “SIP Stress Testing” topic. In Part 1, I have talked about the definition of the stress, opensipsctl (command line tool), and OpenSIPS-CP (web tool) and how they are used in testing. In Part 2 i have talked about SIPSAK (command line tool) which is used as SIP traffic generator. In this part i will talk about SIPp which is an emulation tool which generates SIP traffic and gives some statistics. The current version (3.4) have these features:

  • Establishes and releases multiple calls with the INVITE and BYE methods.
  • Read custom XML scenarios files which described simple to complex call flows.
  • Dynamic display of statistics.
  • Support of IPv6, TLS, SCTP.
  • Support of SIPauthentication, conditional scenarios, UDP retransmissions, error robustness.
  • Call specific variable.
  • Posix regular expression to extract and re-inject any protocol fields.
  • Custom actions (log, system command exec, call stop).
  • Emulate live users using external CV file .
  • Send RTP traffic (audio/video).

SIPp Installation

Pre-requisites to compile SIPp on Fedora Red Hat:

  • Install C++ compiler: # yum install gcc-c++
  • Install ncurses-devel: # yum install  ncurses-devel
  • For TLS support,  install OpenSSL (version > 0.9.8): #yum install openssl-devel
  • For pcap play support, install libpcap and libnet : #yum install  libnet libnet-devel  libpcap libpcap-devel
  • For SCTP support, install lksctp: #yum install lksctp-tools lksctp-tools-devel
  • For distributed pauses, Install GNU Scientific Libraries (gsl): #yum install gsl gsl-devel

Please check your system for the corresponding libraries names.

Download the source code of SIPp:

To compile SIPp, we have four options:

  • Without TLS, SCTP, or PCAP support.
  • With TLS support.
  • With PCAP support
  • With SCTP support

I will combine these options to compile SIPp which supports TLS, SCTP, and PCAP:

  • # tar -xvzf sipp-3.3.990.tar.gz
  • # cd sipp-3.3.990/
  • # ./configure –with-sctp –with-pcap –with-openssl
  • # make
  • # make install

Controlling SIPp Interactively

You can control SIPp through the keyboard. For example pressing on ‘1’, will display the scenario screen, and pressing ‘2’ will display the statistics screen and so on.

SIPp can alse be controlled via a UDP socket. The default base port is 8888 for the first instance and it will increase by 1 for each following SIPp instance (8889, 8890,…). Use the option -cp to change the base port. For example to put SIPp in pause state, we execute this shell command: # echo p > /dev/udp/x.y.z.t/8888 where x.y.z.t is the IP address of the SIPp instance.

Check SIPs Network State

If we have SIPp instance running on the machine (UAS instance :# sipp -sn uas -i 10.0.0.9) and we want to check the network state of that instance, we execute “netstat” command as following:

# netstat -lpn  |grep sipp

The output will be like this

udp        0      0 0.0.0.0:8888            0.0.0.0:*                           14144/sipp
udp        0      0 10.0.0.9:5067           0.0.0.0:*                           14144/sipp
udp        0      0 10.0.0.9:6000           0.0.0.0:*                           14144/sipp
udp        0      0 10.0.0.9:6002           0.0.0.0:*                           14144/sipp

Where:

  • 8888 is the port for SIPp control. Use the option -cp in the command line to change the base number.
  • 5067 is the port for SIP signaling. Use the option -p in the command line to change it.
  • 6000 is  the default local RTP echo port.Use the option -mp in the command line to change it. RTP/UDP packets received on this port are echoed to their sender
  • 6002 is the RTP echo port +2. RTP/UDP packets coming on this port are also echoed to their sender.

SIP User Agent Definition

  • User Agent Client (UAC): It is a logical entity that creates a new SIP request. This role (the role of being UAC) lasts only for the duration of the transaction (SIP transaction).
  • User Agent Server (UAS): It is a logical entity that generates a response to a SIP request. This role (the role of being UAS) lasts  only for the duration of the transaction (SIP transaction).

UACUAS Example

SIP traffic between two SIP user agents on the same host (IP: 10.0.0.9). The traffic is passed directly from the user agent client (UAC) to the user agent server (UAS) without passing a SIP proxy.

Scenario Definition

We want to generate SIP traffic with this specification:

  • Number of calls per second (call rate) = 100 cps. This can be specified as a parameter in the “sipp” command line after the option -r. This rate can be changed interactively (i.e. during the test) by pressing keys on the keyboard. For example pressing ‘+’ will increase the rate by 1 (‘-‘ decrease by 1, ‘*’ increase by 10, ‘/’ decrease by 10).
  • Rate Period in milliseconds for the call rate=10000 ms. This can be specified in the “sipp” command line after the option -rp.

To have n calls every m milliseconds, we mix the previous command line parameters together. So it will be like this –r n -rp m. Here in this scenario, i want to generate 100 calls per 10 seconds so the parameters will be -r 100 -rp 10000.

  • The UAC and UAS are on the same machine. For UAC, i will choose the port 5061 for SIP signaling. For UAS, i will choose the port 5067 for SIp signaling.
  • I will use IPv4 addresses.
  • Call Flow between UAC and UAS: The default behaviour of the UAC (what UAC sends and what it expects as response for each request it sends) is defined in the scenario file (uac.xml). As it is the default scenario so i don’t need to pass the name of the xml file as a parameter in the command line “sipp”. This is the default call flow of the UAC and UAS :

scenarios

In the default scenario, authentication is not used and there is no record routing.

Here is the XML scenario file of the UAS  uas.xml.You can create your own custom XML scenarios as i will do in the next article. In this case you have to pass the names of the XML files which describes the call flows as parameters to “sipp” command (after the option -sf).

Run the UAC and UAS

SIPp will generate SIP traffic according to scenario defined above. SIPp has an embedded SIP user agent client (UAC) which will generate this traffic. Open one terminal and execute this command “# sipp -sn uac 10.0.0.9:5067  -r 100 -rp 10000  -i 10.0.0.9 -p 5061” to run the SIP client (uac). According to this, the UAC (10.0.0.9:5061) will send 100 calls per 10 seconds to the UAS (10.0.0.9:5067).

SIPp has an embedded user agent server (UAS). Open another terminal on the same host and execute this command “# sipp -sn uas -i 10.0.0.9 -p 5067“. This will run the UAS on 10.0.0.9:5067.

Be sure that the ports you want to use are free (not used by another application). This article is like a tutorial so run your UAC and UAS on different machine. Note that we are using the same command “sipp” to run the UAC and UAS. Remember SIPp is an emulation tool for testing the SIP protocol.

Scenario Screenshots

The scenario screen display the call flow as well as some information. This is the scenario screen of the UAC:

Here is the scenario screen of the UAS:

Several screens are available to monitor SIP traffic. You can change the screen by pressing 1 to 9 keys on the keyboard. For example click key ‘2’ to display the statistics screen. Here is the statistics screen of the UAC:

Here is the statistics screen of the UAS:

As you can see the number of successful calls is 150 and the number of failed calls is 0.

UACSIP ProxyUAS Example

SIP traffic between two SIP user agents. The traffic is passing the proxy from the user agent client (UAC) to the user agent server (UAS).  We will take the same previous scenario but with proxy. The UAC, UAS, and the proxy are all on the same machine. The proxy will be OpenSIPS. The routing script of the proxy must work properly with UAC and UAS.

SIPp-Example2

Register and Run the UAS

Assume OpenSIPS is running on 10.0.0.9:5060. We will send packets continuously to the UAS through the proxy. So we need UAS to stay registered during the test (OpenSIPs always knows UAS IP address). So we will register UAS manually by adding a static mapping in the OpenSIPS ‘s “Location” table and this entry will be permanent (available at any time).  

Do as following:

  • Go to OpenSIPS’s sbin directory: # cd /usr/local/opensips_1_11/sbin/
  • Add UAS with the user name = 1234Test: # opensipsctl ul add 1234Test@10.0.0.9 sip:1234Test@10.0.0.9:5067. This will add an entry for this user in the location table.

opensipsctl

We have 10.0.0.9 added in OpenSIPS “Domain table” (# opensipsctl domain add 10.0.0.9).

  • Run the UAS:  sippsn uas -rsa 10.0.0.9:5060  -i 10.0.0.9 -p 5067. The address which comes after the option -rsa  is the remote sending address (Here it is the OpenSIPS proxy).

Now the UAS is ready. You can check its status by executing “# ./opensipsctl ul show”. The output will be as this:

Domain:: location table=512 records=1
AOR:: 1234Test
Contact:: sip:1234Test@10.0.0.9:5067 Q=1
Expires:: permanent
Callid:: dfjrewr12386fd6-343@opensips.mi
Cseq:: 1
User-agent:: OpenSIPS MI Server
State:: CS_SYNC
Flags:: 0
Cflags::
Methods:: 4294967295

As you can see this is a static entry and it is permanent (No need for refreshment). The OpenSIPS now always can route all requests destined to UAS (Request-URI=1234Test@10.0.0.9:5060 (OpenSIPS URI)).

Avoid Authentication of SIP Requests and Loose Routing for Sequential Requests:

Here i am taking the default routing script of OpenSIPS which is generated for residential service. Do the following changes:

  • Avoid loose routing of SIPp packets by skipping the loose routing section where the client is sipp ($fU is “sipp”):

 if (has_totag()  && ($fU!=“sipp”)) {

// Do the loose routing

}

  • Avoid Authentication for SIPp packets: Comment these lines in your routing script:

  # if (!proxy_authorize(“”, “subscriber”)) {
#                   proxy_challenge(“”, “0”);
#                   exit;
# }
# if (!db_check_from()) {
#                sl_send_reply(“403″,”Forbidden auth ID”);
#               exit;
# }

# consume_credentials();
# caller authenticated

  • Restart OpenSIPS (# systemctl restart opensips.service)

Run The UAC

Run this command : #sipp  -sn uac 10.0.0.9:5060 -s 1234Test -i 10.0.0.9 -p 5061 -d 20000 -r 100 -rp 10000

The option ‘-s’ sets the username part of the request URI. The option -d controls the length of calls (duration of pause).

Screenshots

The following is the scenario screens of UAS:

Server-Scenario-Ex2and the statistics screen of the UAS:

Server-Stat-Ex2

Troubleshooting

If you got some errors, enable logging by setting the option -trace_err in command line. For example enable logging at UAC side:

#sipp -trace_err -sn uac 10.0.0.9:5060 -s 1234Test -i 10.0.0.9 -p 5061

Press the key ‘q’ to quit and check the log file. The scenarios of the UAC and UAS and the routing script of the proxy, should be compatible with each other regarding what have been received and what should be sent otherwise you will get unexpected messages.

What does play a role in the results of this test ?

  • The operating system (CPU, Memory, Scheduler,….etc): Fedora Red Hat
  • The Proxy (internal design, routing script, Private and shared memory) : OpenSIPS
  • The traffic generator Performance (internal design): SIPp
  • The network design: UAS, Proxy, and UAS are on the same machine (This article is like a tutorial).

Now you can do what is called tuning (change the parameters that affect the performance). Best is using tools that help you to do the tuning and give you some statistics.


The Part 4 of “SIP Stress Testing” topic will also be about SIPp.  It will be writing custom scenario for the example UAC-SIP Proxy-UAS above.


More Information


Advertisements

8 comments on “SIP Stress Testing -Part 3 (SIPp)

  1. 🙂 Thanks for the reply. I just want to do performance testing on opensips and measure CPU and memory usage for a project. I guess pidstat will be enough for it.

    Like

  2. Please please tell me that you made that part 4 on custom sipp scenarios 😀 the article is very helpfull and with your permission I would like to use it as documentation for my masters degree thesis. Thanks again for your work and please contact me either on facebook or here if you have anything at all regarding usefull sipp guides
    https://web.facebook.com/josip.spajic.9

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s