[sr-dev] fork process during developing module

Henning Westerholt hw at kamailio.org
Wed Mar 13 21:50:40 CET 2019


Am Dienstag, 12. März 2019, 12:46:57 CET schrieb Mojtaba:
> I just ask this question for more understanding during developing new
> module in Kamailio,
> A you know better than me, we could use register_procs and fork_process
> functions to create new fork process in Kamailio project. I just did the
> same things for first handover interface in hiops module. Finally you could
> see list of all process with "kamctl ps" command.
> I want to do the same things for third handover interface in hiops module,
> But i think it would not be nice to see  a lot of list of process in
> output! This conditions would be occurred if someone set the
> hi3_worker_process parameter in hiops module to 100.
> Am i right? Don't you think it is better to use nested fork process instead?
> What do you think?

Hi Mojtaba,

normally you only need to fork one or two processes in a kamailio module, e.g. 
like for a dedicated timer process etc.. You should not fork many processes, 
as all of them will hold the configured PKG memory. Because of the multi-
process architecture of Kamailio I would also not suggest to use a nested 
fork. Kamailio with its initialization structure (mod_init for the init before 
the fork, child_init for the init after the fork) was not designed for that in 
my opinion.

If you see a need for one or many dedicated process(es) for e.g. handover 
interface handling, then I would suggest to use a dedicated separate daemon, 
like e.g. the sipcapture or rtpproxy/rtpengine modules. Kamailio could 
communicate over a socket or a similar interface with this daemon.

Best regards,

Henning 


-- 
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://skalatan.de/services
Kamailio security assessment - https://skalatan.de/de/assessment



More information about the sr-dev mailing list