[sr-dev] git:master: core: option to set number of workers per listen socket

Daniel-Constantin Mierla miconda at gmail.com
Thu Jan 12 19:55:44 CET 2012


Module: sip-router
Branch: master
Commit: edf5e385caac8b73b167dfb1604a489a6feb5bfd
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=edf5e385caac8b73b167dfb1604a489a6feb5bfd

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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=edf5e385caac8b73b167dfb1604a489a6feb5bfd



More information about the sr-dev mailing list