Hi,
I just want to ask regarding the children number and listening interfaces set in Kamailio configuration.
I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I'm using SQLOPS). My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ?
Regards, Ali Taher
Hello,
note that other processes are created by kamailio, not only sip worker processes. For example, there will be timer processes.
The dedicated worker processes are only for UDP sockets, not for tcp/tls (here is a single pool of workers for all tcp/tls sockets). If you do not receive traffic on a specific udp socket, then do not listen to it, you have a group of processes not doing anything. If you need to listen on a socket, but have less traffic (e.g., used for monitoring), then use workers parameter before listen, so you get less worker processes for that udp socket.
Cheers, Daniel
On 01.09.20 12:03, Ali Taher wrote:
Hi,
I just want to ask regarding the children number and listening interfaces set in Kamailio configuration.
I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I’m using SQLOPS).
My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ?
Regards,
Ali Taher
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Thanks for your answer.
Please note that I have set 3 connection strings in SQLOPS module for 3 Postgres databases. How many connections per database does Kamailio open? (knowing that children=12 and only one listening interface).
Regards, Ali Taher
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Tuesday, September 1, 2020 1:18 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ali Taher ataher@vanrise.com Subject: Re: [SR-Users] worker processes
Hello,
note that other processes are created by kamailio, not only sip worker processes. For example, there will be timer processes.
The dedicated worker processes are only for UDP sockets, not for tcp/tls (here is a single pool of workers for all tcp/tls sockets). If you do not receive traffic on a specific udp socket, then do not listen to it, you have a group of processes not doing anything. If you need to listen on a socket, but have less traffic (e.g., used for monitoring), then use workers parameter before listen, so you get less worker processes for that udp socket.
Cheers, Daniel On 01.09.20 12:03, Ali Taher wrote: Hi,
I just want to ask regarding the children number and listening interfaces set in Kamailio configuration.
I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I'm using SQLOPS). My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ?
Regards, Ali Taher
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
hello,
what do you mean by "3 connection strings"? Maybe you can give similar example here.
Cheers, Daniel
On 01.09.20 12:33, Ali Taher wrote:
Thanks for your answer.
Please note that I have set 3 connection strings in SQLOPS module for 3 Postgres databases. How many connections per database does Kamailio open? (knowing that children=12 and only one listening interface).
Regards,
Ali Taher
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Tuesday, September 1, 2020 1:18 PM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ali Taher ataher@vanrise.com *Subject:* Re: [SR-Users] worker processes
Hello,
note that other processes are created by kamailio, not only sip worker processes. For example, there will be timer processes.
The dedicated worker processes are only for UDP sockets, not for tcp/tls (here is a single pool of workers for all tcp/tls sockets). If you do not receive traffic on a specific udp socket, then do not listen to it, you have a group of processes not doing anything. If you need to listen on a socket, but have less traffic (e.g., used for monitoring), then use workers parameter before listen, so you get less worker processes for that udp socket.
Cheers, Daniel
On 01.09.20 12:03, Ali Taher wrote:
Hi, I just want to ask regarding the children number and listening interfaces set in Kamailio configuration. I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I’m using SQLOPS). My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ? Regards, Ali Taher _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com http://www.asipto.com www.twitter.com/miconda http://www.twitter.com/miconda -- www.linkedin.com/in/miconda http://www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Hi Daniel,
I meant that I'm defining 3 connection strings using sqlcon parameter of sqlops module as shown below:
modparam("sqlops","sqlcon","cb=>postgres://postgres:kamailio@localhost:5432/cataleya") modparam("sqlops","sqlcon","mi=>postgres://postgres:kamailio@localhost:5432/cataleya_mitto") modparam("sqlops","sqlcon","sp=>postgres://postgres:kamailio@localhost:5432/cataleya_spactron")
regards, Ali Taher
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Tuesday, September 1, 2020 1:52 PM To: Ali Taher ataher@vanrise.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] worker processes
hello,
what do you mean by "3 connection strings"? Maybe you can give similar example here.
Cheers, Daniel On 01.09.20 12:33, Ali Taher wrote: Thanks for your answer.
Please note that I have set 3 connection strings in SQLOPS module for 3 Postgres databases. How many connections per database does Kamailio open? (knowing that children=12 and only one listening interface).
Regards, Ali Taher
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Tuesday, September 1, 2020 1:18 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ali Taher ataher@vanrise.commailto:ataher@vanrise.com Subject: Re: [SR-Users] worker processes
Hello,
note that other processes are created by kamailio, not only sip worker processes. For example, there will be timer processes.
The dedicated worker processes are only for UDP sockets, not for tcp/tls (here is a single pool of workers for all tcp/tls sockets). If you do not receive traffic on a specific udp socket, then do not listen to it, you have a group of processes not doing anything. If you need to listen on a socket, but have less traffic (e.g., used for monitoring), then use workers parameter before listen, so you get less worker processes for that udp socket.
Cheers, Daniel On 01.09.20 12:03, Ali Taher wrote: Hi,
I just want to ask regarding the children number and listening interfaces set in Kamailio configuration.
I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I'm using SQLOPS). My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ?
Regards, Ali Taher
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
Hello,
in this case there are 3 distinct connections per process, so you have to multiply the number of processes by 3 to get the overall number of connections. You can run 'kamctl ps' to see all the processes of a kamailio instance.
Actually a few kamailio processes may not open database connections, a matter of their purpose if they are created by specific modules, but for a rough upper limit, this is the formula.
Cheers, Daniel
On 01.09.20 16:25, Ali Taher wrote:
Hi Daniel,
I meant that I’m defining 3 connection strings using sqlcon parameter of sqlops module as shown below:
modparam("sqlops","sqlcon","cb=>postgres://postgres:kamailio@localhost:5432/cataleya")
modparam("sqlops","sqlcon","mi=>postgres://postgres:kamailio@localhost:5432/cataleya_mitto")
modparam("sqlops","sqlcon","sp=>postgres://postgres:kamailio@localhost:5432/cataleya_spactron")
regards,
Ali Taher
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Tuesday, September 1, 2020 1:52 PM *To:* Ali Taher ataher@vanrise.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* Re: [SR-Users] worker processes
hello,
what do you mean by "3 connection strings"? Maybe you can give similar example here.
Cheers, Daniel
On 01.09.20 12:33, Ali Taher wrote:
Thanks for your answer. Please note that I have set 3 connection strings in SQLOPS module for 3 Postgres databases. How many connections per database does Kamailio open? (knowing that children=12 and only one listening interface). Regards, Ali Taher *From:* Daniel-Constantin Mierla <miconda@gmail.com> <mailto:miconda@gmail.com> *Sent:* Tuesday, September 1, 2020 1:18 PM *To:* Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> <mailto:sr-users@lists.kamailio.org>; Ali Taher <ataher@vanrise.com> <mailto:ataher@vanrise.com> *Subject:* Re: [SR-Users] worker processes Hello, note that other processes are created by kamailio, not only sip worker processes. For example, there will be timer processes. The dedicated worker processes are only for UDP sockets, not for tcp/tls (here is a single pool of workers for all tcp/tls sockets). If you do not receive traffic on a specific udp socket, then do not listen to it, you have a group of processes not doing anything. If you need to listen on a socket, but have less traffic (e.g., used for monitoring), then use workers parameter before listen, so you get less worker processes for that udp socket. Cheers, Daniel On 01.09.20 12:03, Ali Taher wrote: Hi, I just want to ask regarding the children number and listening interfaces set in Kamailio configuration. I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I’m using SQLOPS). My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ? Regards, Ali Taher _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda> Funding: https://www.paypal.me/dcmierla
-- Daniel-Constantin Mierla -- www.asipto.com http://www.asipto.com www.twitter.com/miconda http://www.twitter.com/miconda -- www.linkedin.com/in/miconda http://www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Hi Daniel,
So in my case :
* Server vcpus = 24 * Max_worker_processes in postgres = 24 * Max_parallel_workers in postgres = 24 * Children in Kamailio config = 12 * 1 udp listener
I noticed that there is 48 database connections established by Kamailio (16 x 3) , can this cause an issue knowing that maximum worker processes is 24 ?
Regards, Ali Taher
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Tuesday, September 1, 2020 6:48 PM To: Ali Taher ataher@vanrise.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] worker processes
Hello,
in this case there are 3 distinct connections per process, so you have to multiply the number of processes by 3 to get the overall number of connections. You can run 'kamctl ps' to see all the processes of a kamailio instance.
Actually a few kamailio processes may not open database connections, a matter of their purpose if they are created by specific modules, but for a rough upper limit, this is the formula.
Cheers, Daniel On 01.09.20 16:25, Ali Taher wrote: Hi Daniel,
I meant that I'm defining 3 connection strings using sqlcon parameter of sqlops module as shown below:
modparam("sqlops","sqlcon","cb=>postgres://postgres:kamailio@localhost:5432/cataleya") modparam("sqlops","sqlcon","mi=>postgres://postgres:kamailio@localhost:5432/cataleya_mitto") modparam("sqlops","sqlcon","sp=>postgres://postgres:kamailio@localhost:5432/cataleya_spactron")
regards, Ali Taher
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Tuesday, September 1, 2020 1:52 PM To: Ali Taher ataher@vanrise.commailto:ataher@vanrise.com; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org Subject: Re: [SR-Users] worker processes
hello,
what do you mean by "3 connection strings"? Maybe you can give similar example here.
Cheers, Daniel On 01.09.20 12:33, Ali Taher wrote: Thanks for your answer.
Please note that I have set 3 connection strings in SQLOPS module for 3 Postgres databases. How many connections per database does Kamailio open? (knowing that children=12 and only one listening interface).
Regards, Ali Taher
From: Daniel-Constantin Mierla miconda@gmail.commailto:miconda@gmail.com Sent: Tuesday, September 1, 2020 1:18 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org; Ali Taher ataher@vanrise.commailto:ataher@vanrise.com Subject: Re: [SR-Users] worker processes
Hello,
note that other processes are created by kamailio, not only sip worker processes. For example, there will be timer processes.
The dedicated worker processes are only for UDP sockets, not for tcp/tls (here is a single pool of workers for all tcp/tls sockets). If you do not receive traffic on a specific udp socket, then do not listen to it, you have a group of processes not doing anything. If you need to listen on a socket, but have less traffic (e.g., used for monitoring), then use workers parameter before listen, so you get less worker processes for that udp socket.
Cheers, Daniel On 01.09.20 12:03, Ali Taher wrote: Hi,
I just want to ask regarding the children number and listening interfaces set in Kamailio configuration.
I am given to understand that the total number of worker processes there will be (children_setting * listeners) , so assuming I have set children=12 and listen=udp:172.16.1.12:5060 (which is the interface IP where the SIP packets as received), in this case there will be 12 worker processes and 12 database connections to postgresql (I'm using SQLOPS). My question is if I set listen=udp:0.0.0.0:5060 , knowing that I have 3 interfaces, in this case the number of worker processes will be 36. Is this good configuration ? will the other 24 processes be used or they are reserved to the 2 other interfaces which are not receiving any SIP packets and then will be useless ?
Regards, Ali Taher
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
On 2020-09-01 12:08, Ali Taher wrote:
I noticed that there is 48 database connections established by Kamailio (16 x 3) , can this cause an issue knowing that maximum worker processes is 24 ?
Postgres's ability to serve clients and accommodate queries isn't limited by the number of max_worker_processes. The default is 8 if this value is unset, yet any stock PostgreSQL instance can accommodate more than 8 concurrent connections, clearly. max_worker_processes != max_connections.
As far as the wisdom of setting process limits to equal the number of available CPU cores ("VCPUs"), there's no absolute answer to that. The general danger with doing this is just that a particularly expensive or destructive statement can consume all of the hardware resources, with no safety margins for other processes, and perhaps not even enough for someone to log in and resolve the problem. So, the general recommendation is not allow PostgreSQL to consume every single VCPU or max out any other resource, and that's why most Linux distributions' server packages come with these types of settings conservatively tuned.
-- Alex
Hi Alex,
That is clear. I decreased the max worker processes to 20 to be on the safe side. But what is confusing me is what about the 18 worker processes ran by Kamailio, will they overlap with postgres processes or they are the same , knowing that Kamailio role in my case is just getting routing decision by running a query on the database and send it back to the SBC. Excuse my lack of knowledge in how linux processes work.
Regards, Ali Taher
-----Original Message----- From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Alex Balashov Sent: Tuesday, September 1, 2020 8:22 PM To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] worker processes
On 2020-09-01 12:08, Ali Taher wrote:
I noticed that there is 48 database connections established by Kamailio (16 x 3) , can this cause an issue knowing that maximum worker processes is 24 ?
Postgres's ability to serve clients and accommodate queries isn't limited by the number of max_worker_processes. The default is 8 if this value is unset, yet any stock PostgreSQL instance can accommodate more than 8 concurrent connections, clearly. max_worker_processes != max_connections.
As far as the wisdom of setting process limits to equal the number of available CPU cores ("VCPUs"), there's no absolute answer to that. The general danger with doing this is just that a particularly expensive or destructive statement can consume all of the hardware resources, with no safety margins for other processes, and perhaps not even enough for someone to log in and resolve the problem. So, the general recommendation is not allow PostgreSQL to consume every single VCPU or max out any other resource, and that's why most Linux distributions' server packages come with these types of settings conservatively tuned.
-- Alex
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On 2020-09-01 13:34, Ali Taher wrote:
That is clear. I decreased the max worker processes to 20 to be on the safe side. But what is confusing me is what about the 18 worker processes ran by Kamailio, will they overlap with postgres processes or they are the same , knowing that Kamailio role in my case is just getting routing decision by running a query on the database and send it back to the SBC. Excuse my lack of knowledge in how linux processes work.
This isn't a question of Linux processes, but rather the concurrency model of any given software system, and the manner in which it does multiple processes to do what it does. The strategies are very different.
Kamailio works on a "pre-forked worker process" model where the kernel distributes incoming packets to one or more child processes. There is no "distributor" thread/process; they all just call accept()/recvfrom() or whatever, and something falls out from the kernel's incoming packet queue for the bound socket.
This type of architecture is fairly close to 1:1 in terms of the volume of messages that can be handled at the same time, and it is deliberately architected this way, by design, because it allows relatively little to be shared among the processes. This reduces the contention among the processes over shared data structures, which maximises throughput.
If you're interested in this topic as it relates to Kamailio specifically, you may consider giving my article from several years ago a read:
http://www.evaristesys.com/blog/tuning-kamailio-for-high-throughput-and-perf...
But there are many ways to implement multi-process concurrency, all with their own trade-offs. There can also be multiple layers to multi-process concurrency, where processes in turn spawn LWPs (Light Weight Processes, aka POSIX threads). Without knowing PostgreSQL internals deeply, I can't provide deep insight into the relationship between `max_worker_processes` and the number of queries or statements which can execute concurrently. I can only say that it the relationship between Kamailio child processes or their DB connections is not at all 1:1 to the size of the worker thread process pool in PG. As far as I know, the workload is distributed in some manner among the available worker processes, whatever their number.
In short: you do not need to worry about dimensioning the PostgreSQL max_worker_processes in some way that is precisely interrelated to the number of Kamailio child processes. Treat them as logically independent of each other.
-- Alex