[OpenSIPS-Users] how to identify a children process

2009-12-08 Thread Italo Dacosta
Hello,

I would like to know if there is a way to identify a children process in
 the code. I know I could use something like getpid() to uniquely
identify the process in the code but I was wondering if there is already
a variable storing such information that I could use for that purpose.


Also, I have notice that each children process establishes a connection
to the database when using digest authentication. When doing queries to
the database, each children process use a different connection variable
to talk to the database, or they use the same one?
If each children process use a different connection variable, how does
it know what connection variable to use?

Thanks,
ID

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] OpenSIPS maximum performance in a multiprocessor machine (SMP)

2009-09-17 Thread Italo Dacosta


Adrian Georgescu wrote:

 Exactly to the point. Optimizing on how many transaction OpenSIPS can  
 do natively is useless. In real cases when you enable the whole chain  
 of things that make a complete SIP service running with accounting,  
 DNS lookups, dips in external databases, number portability, LCR if  
 you score 50 cps you are lucky.
 

 The point is that OpenSIPS is fast enough for its main purpose, there  
 are the other parts or processes that slows it down and is very little  
 you can do to optimize on that. The round trip time for all database  
 queries will add up enough to slow the proxy down to tens cps  
 depending how many you do and how far the queries systems are.


Adrian,

Thank you for your insightful comments. I will take them into account in
my experiments.

ID



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] OpenSIPS maximum performance in a multiprocessor machine (SMP)

2009-09-17 Thread Italo Dacosta


Stanis?aw Pitucha wrote:

 I just thought about something different. What kind of link are you
 using on each side and what throughput can you get (using for example
 `iperf`) on that host. Assuming that your INVITE messages are just
 below 700B:
 
 20k-msg/s * 700B == 104Mbit
 
 Maybe you've just saturated your 100Mbit connection? Are you sure that
 the whole path is 1Gbit? Can Iperf do more than 100Mbit at all?

Stanislaw: yes, that what my first thought too. However, the whole path
is Gbit Ethernet. I measured it with Iperf and I can measure more than
100 Mbit (around 900 Mbit). I also checked the network switch
utilization, and everything is fine (no packets dropped, etc). Thank you
for your suggestion anyway.

ID

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] OpenSIPS maximum performance in a multiprocessor machine (SMP)

2009-09-16 Thread Italo Dacosta

Sau'l Ibarra wrote:
 Yo may also install irqbalance, so that interrupts get balanced across
 all the cores.

Saul: thanks for the suggestion. I installed irqbalance in the proxy.
However, I couldn't see any performance improvement. The only thing I
noticed is that now most of the irqs are handled by CPU 0 instead of CPU
7. My guess is that most of the interrupts are being generated by the
network card. Because there is only one network card, irqbalance can not
distribute the irqs among the CPUs. It seems that irqbalance has not a
configuration file that I could modify to try to balance irqs in this
scenario.

Bogdan-Andrei Iancu wrote:
 Note that usrloc has data structures that are shared between all procs. 
 Sharing means locking for synchronized access. By default usrloc uses a 
 hash with 512 entries, each entry having its one lock.
 Typically access to such shared data may be a bottleneck - procs 
 blocking in lock trying to access some resource. So, to increase the 
 level of parallelism and hash entry collisions, you could try increase 
 the size of this hash table:
http://www.opensips.org/html/docs/modules/devel/usrloc.html#id271533
 Try a value of 12 for example.

Bogdan: thanks for your suggestions and the information provided. I
changed the usrloc hash table size to 12 but I didn't notice any changes
in the proxy's performance. I am using a small number of callees (around
16), so I don't think that this operation is causing the performance
bottleneck.

My next step is to profile OpenSIPS with oprofile. Any other suggestions
are welcome.

Thanks,
ID


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] OpenSIPS maximum performance in a multiprocessor machine (SMP)

2009-09-16 Thread Italo Dacosta


Adrian Georgescu wrote:
 Hi Italo,
 
 Just out of curiosity. How much is enough for you as scalability goes?  
 Doing 20K cps will yield how many established sessions in 3 minutes  
 time? More simultaneous calls then all traffic generated by a whole  
 country?

Adrian,

That is a good question and I agree with your point. However, what I am
trying to understand is how efficiently OpenSIPS is using the hardware
resources available and if its performance can be optimized.

I am using a basic configuration for my tests (stateless server, no
authentication, no DNS). In a more realistic scenario, the additional
functionality will reduce proxy's performance considerably.

I am interested in the performance with authentication. Given SIP's
flexibility, I can think of scenarios where more SIP messages are
authenticated (not only INVITEs and REGISTERs), and where more services
require authentication (i.e., IM, presence). In this scenario, if the
performance of the proxy is not good enough, an option could be to
upgrade the hardware or add load balancing tools. I would like to know
if we can do better without adding more hardware or components.

Also, having extra-performance is a good thing, specially in situations
when unexpected loads happens (i.e., flash crowds, emergencies, DoS
attacks).

I will appreciate any more thoughts or comments regarding this subject.

Thanks,
Italo


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] OpenSIPS maximum performance in a multiprocessor machine (SMP)

2009-09-14 Thread Italo Dacosta
Hello,

I am running some performance tests with OpenSIPS 1.5.2. Basically, I
wan to measure the maximum call rate that OpenSIPS can handle. I am
using a machine with the following configurations:
• 8 processors (2GHz Quad-Core AMD Opteron),
• 16 GB memory
• Gigabit Ethernet
• Ubuntu 8.04 (Linux 2.6.24-19-server #1 SMP).

I am using a stateless proxy configuration with 4 children processes,
just required modules (i.e., not billing) and a very simple routing logic:

route{
lookup(location);
forward();
exit;
}


I am also using SIPp 3.1 to generate the test call traffic.

With the above configuration  the proxy is able to reach around 20,000
calls per second (cps). However, I have noticed that the CPUs in the
server are not all completely utilized. Below is the output of the
mpstat tool when the maximum CPU utilization was measured (100 - %
idle).  The mpstat output shows that only CPU #7 reaches 95%
utilization. The other CPUs have around 60-70% utilization. CPU #7 also
have the largest number of interrupts per second ( I guess that CPU 7 is
handling the network interrupts).

CPU   %user   %nice%sys  %irq   %soft  %steal   %idleintr/s
all   24.400.00   19.48   0.12   19.280.00   36.73  11765.40
0   22.200.00   23.200.00   10.600.00   44.00  0.00
1   32.400.00   18.200.00   10.400.00   39.00  0.00
2   22.400.00   20.800.00   10.000.00   46.80  0.00
3   30.200.00   21.800.008.400.00   39.60  0.00
4   24.600.00   22.400.00   10.200.00   42.80  0.00
5   33.600.00   20.800.00   11.800.00   33.80  6.00
6   24.200.00   24.000.009.000.00   42.80 17.80
75.600.004.601.00   83.800.005.00  11742.60
80.000.000.000.000.000.000.00  0.00

My questions is why OpenSIPS does not use all the CPUs to their maximum
(95% utilization) and therefore, handle higher call rates. I would like
to know what is causing OpenSIPS to stop handling higher call rates
given that there are still resources available (CPU, memory, network).
In other words, what is the bottleneck at this point. ( I originally
though it was the SIPp clients generating the load, but I increase the
number of clients and got the same results).

I would appreciate any advice or ideas on how to maximize OpenSIPs
performance in the above scenario.

Thanks in advance,
ID

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] OpenSIPS maximum performance in a multiprocessor machine (SMP)

2009-09-14 Thread Italo Dacosta
Ok - that's the first problem. Number of children == number of
processes. You cannot handle more than 4 messages at one time right
now.

I forgot to mention that I tested with several number of children
already. Surprisingly, increasing the number of processes seems to
reduce performance. With 8 children processes the maximum call rate I
measured was around 17,000 cps. I think that the performance is lower
due to the overheads associated with context switching.

As I have observed, OpenSIPS uses 4 additional processes in addition to
the children processes (two timer-related processes, one for the mi_fifo
 module mgt. interface, and the parent process?). Therefore, if I use 4
children processes, a total of 8 processes will be running. However, I
am not sure that these additional processes are CPU intensive as the
processes handling SIP messages.

Also - what modules are enabled and how does your usrloc find the
location - is it db query, or something else? If you use anything
external for lookup, I'd change children to 16 (if memory only, then
8)

usrloc is using memory (database mode is disabled). These are the
modules enabled:

loadmodule db_mysql.so
loadmodule signaling.so
loadmodule sl.so
loadmodule tm.so
loadmodule rr.so
loadmodule maxfwd.so
loadmodule usrloc.so
loadmodule registrar.so
loadmodule textops.so
loadmodule mi_fifo.so
loadmodule uri_db.so
loadmodule uri.so
loadmodule xlog.so


 I am also using SIPp 3.1 to generate the test call traffic.

On the same host, or on a separate one? From my experience sipp can
eat loads of cpu and it's threading is less than good. So in a perfect
scenario, you want sipp on a separate host and check whether it's not
cpu-starved there.

Each SIPp instance (28 in total) is running in a separate machine.
OpenSIPS is the only application running in the machine described before.

 With the above configuration  the proxy is able to reach around
20,000 calls per second (cps).

What do you mean by that? What happens if you try to send more? What
do you mean by calls - your config allows only for an 
INVITE/NOTIFY/something else to be sent via proxy - is that all you're
testing (i.e. are you testing messages with lookup per second)? Then
you can find the maximal possible throughput by using ~10 children
doing only {forward();} - you'll not get better performance than that.

I am using the default scenarios in SIPp (UAC and UAS). Basically, a
call session is established between two SIPp instances and then the call
is immediately terminated by the caller (see
http://sipp.sourceforge.net/doc/reference.html#UAC)

I am using SIPp statistics to measure the number of calls per second
established.

Yes - cpu 7 handles most irq, so it's probably the network card -
check it in /proc/interrupts. If your card supports it, you can change
/proc/irq/XXX/smp_affinity (where XXX is the network card irq) to use
all cpus. It will either help or kill the performance - depending on
many things.

Good idea. I will try to change the processor affinity to see what happens.

If it was network, you'd get very high %wait / %irq. To get a real
answer to your question, you could simply run opensips under a
profiler.

Yes, I was also thinking about that. I am planning to use oprofile. Do
you have any recommendation?


I hope that helps a little.
It does help. Thanks a lot.

ID




___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users