Hello,
the master branch has a new feature that allow setting number of worker
processes to handle received traffic per listen socket.
So far there were global parameters that were applied to all sockets
(e.g., 'children' value set the number of workers for all udp sockets).
So far each UDP and SCTP socket had its own pool of workers (e.g.,
children=4 and 2 udp sockets resulted in 8 processes), while for tcp and
tls was a single pool of workers (e.g., having children (or
tcp_children) set 8, resulted in 8 processes no matter how many tcp/tls
sockets).
The new features is based on using a new config parameter, named
"socket_workers", before a "listen" parameter. The value of
socket_workers will overwrite the value of *children parameter. For UDP
and SCTP will result in creating a number of "socket_workers" processes.
For TCP and TLS will add an extra set of "socket_workers" processes,
that will handle traffic only on those specific sockets.
The value of "socket_workers" is reset with the next listen socket
added. If "socket_workers" is not set, the value of "*children"
parameter is used in backward compatible fashion.
Some typical scenarios where this feature may become handy:
- set a lower number for loopback or internal/replication sockets, as
the traffic there is low (e.g, maybe for keepalive monitoring on
loopback, or it is only REGISTER requests replication done over the
replication sockets)
- set a dedicated group of tcp/tls workers for handling http/xmlrpc/xcap
traffic - handling such traffic may be time consuming, in this way you
avoid delays on routing SIP over tcp/tls
- fine tune the number of over all forked processes by a SIP server
instance, thus controlling better the resources used from the physical
server (e.g., overall private memory used by sip server is a matter of
how many forked processes are there)
You can see details about the new parameter and examples on the wiki page:
* http://www.kamailio.org/wiki/cookbooks/devel/core?&#socket_workers
Cheers,
Daniel
--
Daniel-Constantin Mierla -- http://www.asipto.comhttp://linkedin.com/in/miconda -- http://twitter.com/miconda
Module: sip-router
Branch: master
Commit: edf5e385caac8b73b167dfb1604a489a6feb5bfd
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=edf5e38…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Jan 12 18:55:22 2012 +0100
core: option to set number of workers per listen socket
- new cfg global parameter: socket_workers - set the number of worker
processes for the next listen socket
- used before listen on udp and sctp socket - overwrites
children/sctp_children value for that socket
- used bofer listen on tcp and tls socket - adds extra tcp workers,
these handling traffic only on that socket
- socket_workers is reset with next listen socket that is added, thus
use it for each listen socket where you want custom number of workers
- if this parameter is not used at all, it is the same behaviour as so
far
Example for udp sockets:
children=4
socket_workers=2
listen=udp:127.0.0.1:5080
listen=udp:127.0.0.1:5070
listen=udp:127.0.0.1:5060
- it will start 2 workers to handle traffic on udp:127.0.0.1:5080 and 4
for each of udp:127.0.0.1:5070 and udp:127.0.0.1:5060. In total there
are 10 worker processes
Example for tcp sockets:
children=4
socket_workers=2
listen=tcp:127.0.0.1:5080
listen=tcp:127.0.0.1:5070
listen=tcp:127.0.0.1:5060
- it will start 2 workers to handle traffic on tcp:127.0.0.1:5080 and 4
to handle traffic on both tcp:127.0.0.1:5070 and tcp:127.0.0.1:5060.
In total there are 6 worker processes
---
cfg.lex | 2 +
cfg.y | 5 ++-
globals.h | 2 +
ip_addr.h | 2 +
main.c | 49 ++++++++++++++++++++-------
socket_info.c | 4 ++
tcp_init.h | 1 +
tcp_main.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++----------
8 files changed, 135 insertions(+), 33 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=edf…