Hello,

i'm trying to use freeswitch as a redirecting server meaning FS has to
receive an INVITE and according to some rules it will redirect calls to
other destinations.


CALLING_USER                FREESWITCH                        SOMEWHERE

INVITE ------------------------------->
           <------------------------------ 100 Trying
           <------------------------------ 302 Moved Temporary
ACK    ------------------------------->
INVITE--------------------------------------------------------------------------------->



Well, wverything works well except i have perfromance issues .... on my HW
FS cannot do more than 40 CPS (INVITE answered by 302 Moved Temporary). When
i increase the rate, FS starts delaying 302 response. Right at 50 CPS i see
"calls" being build up in FS and the delay begining to grow.

When i observe the machine, load average is almost nothing (load average:
1.41, 0.61, 0.60) CPU never goes to 100%, and i see only one thread taking
most load... all others are just sitting there with 1-5 % CPU time.
This looks to me as FS handles 302 messages in a single thread?!?!


tculj...@fs:/usr/local/freeswitch/conf/dialplan$ top -H

top - 10:41:37 up 167 days, 20:42,  3 users,  load average: 1.41, 0.61, 0.60
Tasks:  83 total,   2 running,  81 sleeping,   0 stopped,   0 zombie
Cpu(s): 25.3%us,  1.5%sy,  0.0%ni, 30.3%id, 42.7%wa,  0.0%hi,  0.2%si,
0.0%st
Mem:   2074520k total,   571244k used,  1503276k free,   259604k buffers
Swap:  2650684k total,     3020k used,  2647664k free,   153868k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+
COMMAND
 4814 root      20   0 34188  20m 3780 S   38  1.0   3:10.29
freeswitch
 4800 root      20   0 34188  20m 3780 S    6  1.0   0:08.26
freeswitch
 4798 root      20   0 34188  20m 3780 R    5  1.0   0:24.46
freeswitch
 4787 root      20   0 34188  20m 3780 S    2  1.0   0:11.24
freeswitch
 4794 root      20   0 34188  20m 3780 S    1  1.0   0:11.42
freeswitch
 4803 root      20   0 34188  20m 3780 S    1  1.0   0:11.74
freeswitch
 4788 root      20   0 34188  20m 3780 S    1  1.0   0:02.96
freeswitch
 4804 root      20   0 34188  20m 3780 S    1  1.0   0:01.64
freeswitch
 4807 root      20   0 34188  20m 3780 S    1  1.0   0:01.68
freeswitch
 4811 root      20   0 34188  20m 3780 S    1  1.0   0:02.50 freeswitch



cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Xeon(R) CPU            5140  @ 2.33GHz
stepping        : 6
cpu MHz         : 2333.560
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm
constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16
xtpr dca lahf_lm
bogomips        : 4670.78
clflush size    : 64
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Xeon(R) CPU            5140  @ 2.33GHz
stepping        : 6
cpu MHz         : 2333.560
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm
constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16
xtpr dca lahf_lm
bogomips        : 4666.82
clflush size    : 64
power management:



uname -a
Linux l01sipindir1 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686
GNU/Linux



Of course, i've tuned the machine up

ulimit -c unlimited
ulimit -d unlimited
ulimit -f unlimited
ulimit -i unlimited
ulimit -n 999999
ulimit -q unlimited
ulimit -u unlimited
ulimit -v unlimited
ulimit -x unlimited
ulimit -s 240
ulimit -l unlimited
ulimit -a


Started FS with minimum modules but still 40 CPS seems to be the limit.


So, is there any way to improve performance?


Tihomir.
<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files --> 
<profile name="external">
  <!-- This profile is only for outbound registrations to providers -->
  <gateways>
    <X-PRE-PROCESS cmd="include" data="external/*.xml"/>
  </gateways>

  <aliases>
    <alias name="outbound"/>
  </aliases>

  <domains>
    <domain name="$${domain}" parse="true"/>
  </domains>

  <settings>
    <param name="debug" value="0"/>
    <param name="sip-trace" value="no"/>
    <param name="rfc2833-pt" value="101"/>
    <param name="sip-port" value="5080"/>
    <param name="dialplan" value="XML"/>
    <param name="context" value="public"/>
    <param name="dtmf-duration" value="100"/>
    <param name="codec-prefs" value="$${outbound_codec_prefs}"/>
    <param name="hold-music" value="$${hold_music}"/>
    <param name="use-rtp-timer" value="true"/>
    <param name="rtp-timer-name" value="soft"/>
    <param name="manage-presence" value="false"/>
    <param name="aggressive-nat-detection" value="true"/>
    <param name="inbound-codec-negotiation" value="generous"/>
    <param name="nonce-ttl" value="60"/>
    <param name="auth-calls" value="false"/>
    <param name="rtp-timeout-sec" value="1800"/>
    <param name="rtp-ip" value="$${local_ip_v4}"/>
    <param name="sip-ip" value="$${local_ip_v4}"/>
    <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
    <param name="ext-sip-ip" value="$${external_sip_ip}"/>
    <param name="rtp-timeout-sec" value="300"/>
    <param name="rtp-hold-timeout-sec" value="1800"/>
    <!--<param name="enable-3pcc" value="true"/>-->
  </settings>
</profile>
<!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
<profile name="internal" domain="$${domain}">
  <!--aliases are other names that will work as a valid profile name for this profile-->
  <aliases>
    <alias name="$${domain}"/>
    <alias name="default"/>
  </aliases>
  <!-- Outbound Registrations -->
  <gateways>
    <X-PRE-PROCESS cmd="include" data="internal/*.xml"/>
  </gateways>
  
  <domains>
    <!-- indicator to parse the directory for domains with parse="true" to get gateways-->
    <!--<domain name="$${domain}" parse="true"/>-->
    <!-- indicator to parse the directory for domains with parse="true" to get gateways and alias every domain to this profile -->
    <!--<domain name="all" alias="true" parse="true"/>-->
  </domains>
  
  <settings>
    <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
    <param name="debug" value="0"/>
    <param name="sip-trace" value="no"/>
    <param name="context" value="public"/>
    <param name="rfc2833-pt" value="101"/>
    <!-- port to bind to for sip traffic -->
    <param name="sip-port" value="5060"/>
    <param name="dialplan" value="XML"/>
    <param name="dtmf-duration" value="100"/>
    <param name="codec-prefs" value="$${global_codec_prefs}"/>
    <param name="use-rtp-timer" value="true"/>
    <param name="rtp-timer-name" value="soft"/>
    <!-- ip address to use for rtp -->
    <param name="rtp-ip" value="$${local_ip_v4}"/>
    <!-- ip address to bind to -->
    <param name="sip-ip" value="$${local_ip_v4}"/>
    <param name="hold-music" value="$${hold_music}"/>
    <param name="apply-nat-acl" value="rfc1918"/>
    <param name="aggressive-nat-detection" value="true"/>
    <!--<param name="enable-timer" value="false"/>-->
    <!--<param name="enable-100rel" value="false"/>-->
    <!--<param name="apply-inbound-acl" value="domains"/>-->
    <!--<param name="apply-register-acl" value="domains"/>-->
    <!--<param name="dtmf-type" value="info"/>-->
    <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
    <!--enable to use presense and mwi -->
    <param name="manage-presence" value="true"/>
    <!-- This setting is for AAL2 bitpacking on G726 -->
    <!-- <param name="bitpacking" value="aal2"/> -->
    <!--max number of open dialogs in proceeding -->
    <!--<param name="max-proceeding" value="1000"/>-->
    <!--session timers for all call to expire after the specified seconds -->
    <!--<param name="session-timeout" value="120"/>-->
    <!--<param name="multiple-registrations" value="true"/>-->
    <!--set to 'greedy' if you want your codec list to take precedence -->
    <param name="inbound-codec-negotiation" value="generous"/>
    <!-- if you want to send any special bind params of your own -->
    <!--<param name="bind-params" value="transport=udp"/>-->
    <!--<param name="unregister-on-options-fail" value="true"/>-->

    <!-- TLS: disabled by default, set to "true" to enable -->
    <param name="tls" value="false"/>
    <!-- additional bind parameters for TLS -->
    <param name="tls-bind-params" value="transport=tls"/>
    <!-- Port to listen on for TLS requests. (5061 will be used if unspecified) -->
    <param name="tls-sip-port" value="5061"/>
    <!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
    <param name="tls-cert-dir" value="$${base_dir}/conf/ssl"/>
    <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
    <param name="tls-version" value="tlsv1"/>
    
    <!--If you don't want to pass through timestampes from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)-->
    <!--<param name="rtp-rewrite-timestamps" value="true"/>-->
    <!--<param name="pass-rfc2833" value="true"/>-->
    <!--If you have ODBC support and a working dsn you can use it instead of SQLite-->
    <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
    
    <!--Uncomment to set all inbound calls to no media mode-->
    <!--<param name="inbound-bypass-media" value="true"/>-->

    <!--Uncomment to set all inbound calls to proxy media mode-->
    <!--<param name="inbound-proxy-media" value="true"/>-->
    
    <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
    <!--<param name="inbound-late-negotiation" value="true"/>-->
    
    <!-- this lets anything register -->
    <!--  comment the next line and uncomment one or both of the other 2 lines for call authentication -->
    <param name="accept-blind-reg" value="true"/>

    <!-- accept any authentication without actually checking (not a good feature for most people) -->
    <param name="accept-blind-auth" value="true"/>
    
    <!-- supress CNG on this profile or per call with the 'supress_cng' variable -->
    <!-- <param name="supress-cng" value="true"/> -->
    
    <!--TTL for nonce in sip auth-->
    <param name="nonce-ttl" value="60"/>
    <!--Uncomment if you want to force the outbound leg of a bridge to only offer the codec 
	that the originator is using-->
    <!--<param name="disable-transcoding" value="true"/>-->
    <!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
    <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
    <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
    <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
    <param name="auth-calls" value="false"/>
    <!-- on authed calls, authenticate *all* the packets not just invite -->
    <param name="auth-all-packets" value="false"/>
    <!-- <param name="ext-rtp-ip" value="$${external_rtp_ip}"/> -->
    <!-- <param name="ext-sip-ip" value="$${external_sip_ip}"/> -->
    <!-- rtp inactivity timeout -->
    <param name="rtp-timeout-sec" value="300"/>
    <param name="rtp-hold-timeout-sec" value="1800"/>
    <!-- VAD choose one (out is a good choice); -->
    <!-- <param name="vad" value="in"/> -->
    <!-- <param name="vad" value="out"/> -->
    <!-- <param name="vad" value="both"/> -->
    <!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
    <!--all inbound reg will look in this domain for the users -->
    <!--<param name="force-register-domain" value="cluecon.com"/>-->
    <!-- disable register and transfer which may be undesirable in a public switch -->
    <!--<param name="disable-transfer" value="true"/>-->
    <!--<param name="disable-register" value="true"/>-->
    <!--<param name="enable-3pcc" value="true"/>-->
    <!-- use stun when specified (default is true) -->
    <!--<param name="stun-enabled" value="true"/>-->
    <!-- use stun when specified (default is true) -->
    <!-- set to true to have the profile determine stun is not useful and turn it off globally-->
    <!--<param name="stun-auto-disable" value="true"/>-->
  </settings>
</profile>

<?xml version="1.0" encoding="utf-8"?>
<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
<include>
  <context name="default">

	<extension name="show_info">
		<condition field="destination_number" expression="12...@public">
			<action application="answer"/>
			<action application="info"/>
			<action application="sleep" data="250"/>
			<action application="hangup"/>
		</condition>
	</extension>

 <!-- <extension name="my test">
      <action application="bridge" data="sofia/sip/[email protected]:5060"/>
</extension> -->

  </context>
</include>
<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
<include>
  <context name="public">

      <extension name="LNP">
		<condition field="destination_number" expression="(^300000)(.*)">
		      <action application="lnp_getprefix" data="in $2, out reroutingalias"/>
      			<action application="redirect" data="sip:${[email protected]:5060"/> 
      		</condition>
	</extension>


	<extension name="LBS">
		<condition field="destination_number" expression="(^300010)(.*)">
	  		<action application="lbs_getpublicphone" data="in ${caller_id_number}, in $2, out reroutingalias"/>
      			<action application="redirect" data="sip:${[email protected]:5060"/> 
	      </condition>
	</extension>
	
	<extension name="CPS">
		<condition field="destination_number" expression="(^300020)(.*)">
	  		<action application="cps_verifyphone" data="in ${caller_id_number}, in $2, out radiusacc"/>
		 </condition>
	      <condition field="radiusacc" expression="1">
      			    <action application="redirect" data="sip:${[email protected]:5060"/> 
			    <anti-action application="respond" data="403 Forbidden"/> 
		</condition>
	</extension>



   <extension name="ServiceLookup">
      <condition field="destination_number" expression="(^300030)(.*)">
         <!--action application="lookup_service_destination" data="in ${caller_id_number:6:16}, in ${caller_id_number:0:6}, in $2, in $1, in pgw01.ot.hr:5060, out red_contact, out authResult"/-->
         <action application="log" data="INFO ######################## ServiceLookup ########################\n"/>
         <action application="log" data="INFO ######################## contact = '${red_contact}' ##############\n"/>
         <action application="log" data="INFO ######################## CallerNum = '${caller_id_number:6:16}' ##########\n"/>
         <action application="log" data="INFO ######################## RADIUS auth = '${authResult}' ##########\n"/>
         <!--action application="ring_ready"/-->
         <!--action application="pre_answer"/-->

         <action application="execute_extension" data="doRedirect XML public"/>
	</condition>
   </extension>


   <extension name="doRedirect">
      <condition field="destination_number" expression="^doRedirect$"/>
      <condition field="${authResult}" expression="^0$|^60$">
         <action application="log" data="INFO ######################## RADIUS auth OK!!!' ##########\n"/>
         <!--action application="redirect" data="sip:${red_contact}"/-->
         <!--action application="answer"/-->
         <action application="redirect" data="sip:[email protected]:5060"/>
         <!--anti-action application="answer"/-->
         <!--anti-action application="sleep" data="2000"/-->
         <action application="hangup" data="USER_BUSY"/> 
         <anti-action application="redirect" data="sip:[email protected]:5060"/>
         <anti-action application="log" data="INFO ######################## RADIUS auth NOK!! ##########\n"/>
         <!--anti-action application="respond" data="403 Forbidden"/-->
         <anti-action application="hangup" data="USER_BUSY"/> 
      </condition>
   </extension>

  </context>
</include>
<configuration name="switch.conf" description="Core Configuration">

  <cli-keybindings>
    <key name="1" value="help"/>
    <key name="2" value="status"/>
    <key name="3" value="show channels"/>
    <key name="4" value="show calls"/>
    <key name="5" value="sofia status"/>
    <key name="6" value="reloadxml"/>
    <key name="7" value="console loglevel 0"/>
    <key name="8" value="console loglevel 7"/>
    <key name="9" value="sofia status profile internal"/>
    <key name="10" value="fsctl pause"/>
    <key name="11" value="fsctl resume"/>
    <key name="12" value="version"/>
  </cli-keybindings> 
  
  <settings>
    <!--Colorize the Console -->
    <param name="colorize-console" value="true"/>
    <!--Most channels to allow at once -->
    <param name="max-sessions" value="4000"/>
    <!--Most channels to create per second -->
    <param name="sessions-per-second" value="500"/>
    <!-- Default Global Log Level - value is one of debug,info,notice,warning,err,crit,alert -->
    <param name="loglevel" value="0"/>
    <!--Try to catch any crashes that can be recoverable (in the context of a call)-->
    <param name="crash-protection" value="false"/>
    <!--<param name="max_dtmf_duration" value="192000"/>-->
    <!--<param name="default_dtmf_duration" value="8000"/>-->
    <param name="auth-calls" value="false"/>
    <param name="manage-presence" value="false"/>

    <!--
         If you want to send out voicemail notifications via Windows you'll need to change the mailer-app
         variable to the setting below:
     
       <param name="mailer-app" value="msmtp"/>
 
         Donot change mailer-app-args.
         You will also need to download a sendmail clone for Windows (msmtp). This version works without issue:
         http://msmtp.sourceforge.net/index.html. Download and copy the .exe to %winddir%\system32.
         You'll need to create a small config file for smtp credentials (host name, authentication, tls, etc.) in
         %USERPROFILE%\Application Data\ called "msmtprc.txt". Below is a sample copy of this file:
 
         ###################################
         # The SMTP server of the provider.
         account provider
         host smtp.myisp.com
         from [email protected]
         auth login
         user johndoe
         password mypassword
 
         # Set a default account
         account default : provider
       ###################################
         
 -->    
    <param name="mailer-app" value="sendmail"/>
    <param name="mailer-app-args" value="-t"/>
    <param name="dump-cores" value="yes"/>
    <!--RTP port range -->
    <!--<param name="rtp-start-port" value="16384"/>-->
    <!--<param name="rtp-end-port" value="32768"/>-->
  </settings>

</configuration>

<configuration name="modules.conf" description="Modules">
  <modules>
    
    <!-- Loggers (I'd load these first) -->
    <load module="mod_console"/>
    <!--load module="mod_logfile"/-->
    <!-- <load module="mod_syslog"/> -->

    <!--<load module="mod_yaml"/>-->

    <!-- Multi-Faceted -->
    <!-- mod_enum is a dialplan interface, an application interface and an api command interface -->
    <load module="mod_enum"/>

    <!-- XML Interfaces -->
    <!-- <load module="mod_xml_rpc"/> -->
    <!-- <load module="mod_xml_curl"/> -->
    <!-- <load module="mod_xml_cdr"/> -->

    <!-- Event Handlers -->
    <!--load module="mod_cdr_csv"/-->
    <!-- <load module="mod_event_multicast"/> -->
    <load module="mod_event_socket"/>
    <!-- <load module="mod_zeroconf"/> -->

    <!-- Directory Interfaces -->
    <load module="mod_ldap"/>


    <!-- Endpoints -->
    <!-- <load module="mod_dingaling"/> -->
    <!-- <load module="mod_iax"/> -->
    <!-- <load module="mod_portaudio"/> -->
    <!-- <load module="mod_alsa"/> -->
    <load module="mod_sofia"/>
    <!-- <load module="mod_wanpipe"/> -->
    <!-- <load module="mod_woomera"/> -->
    <!-- <load module="mod_openzap"/> -->

    <!-- Applications -->
    <load module="mod_commands"/>
    <!--load module="mod_conference"/-->
    <load module="mod_dptools"/>
    <load module="mod_expr"/>
    <!--load module="mod_fifo"/-->
    <!--load module="mod_voicemail"/-->
    <!--load module="mod_limit"/-->
    <!--load module="mod_esf"/-->
    <!--load module="mod_fsv"/-->
 

    <!-- SNOM Module -->
    <!--<load module="mod_snom"/>-->

    <!-- Dialplan Interfaces -->
    <!-- <load module="mod_dialplan_directory"/> -->
    <load module="mod_dialplan_xml"/>
    <!--load module="mod_dialplan_asterisk"/-->

    <!-- Codec Interfaces -->
    <load module="mod_voipcodecs"/>
    <load module="mod_g723_1"/>
    <load module="mod_g729"/>
    <load module="mod_amr"/>
    <!--load module="mod_ilbc"/-->
    <!--load module="mod_speex"/-->
    <!--load module="mod_h26x"/-->

    <!-- File Format Interfaces -->
    <!--load module="mod_sndfile"/-->
    <load module="mod_native_file"/>
    <!--For icecast/mp3 streams/files-->
    <!--<load module="mod_shout"/>-->
    <!--For local streams (play all the files in a directory)-->
    <load module="mod_local_stream"/>
    <load module="mod_tone_stream"/>

    <!-- Timers -->

    <!-- Languages -->
    <!--load module="mod_spidermonkey"/-->
    <!-- <load module="mod_perl"/> -->
    <!-- <load module="mod_python"/> -->
    <!-- <load module="mod_java"/> -->
    <!--load module="mod_lua"/-->

    <!-- ASR /TTS -->
    <!-- <load module="mod_flite"/> -->
    <!-- <load module="mod_pocketsphinx"/> -->
    <!-- <load module="mod_cepstral"/> -->
    <!-- <load module="mod_openmrcp"/> -->
    <!-- <load module="mod_rss"/> -->
    
    <!-- Say -->
    <load module="mod_say_en"/>
    <!-- <load module="mod_say_zh"/> -->
  </modules>
</configuration>
_______________________________________________
FreeSWITCH-users mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Reply via email to