[SR-Users] async_workers vs. async workers modparam in case of async_route()

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 22 15:02:36 CET 2016



On 22/11/2016 06:20, Alex Balashov wrote:
> On 11/21/2016 06:44 AM, Daniel-Constantin Mierla wrote:
>
>> At this moment, from what I remember by heart, mysql module and async
>> (when using async_task_route()) use async_workers from the core.
>
> What about sql_query_async()? I assume that uses core async_workers too.

Yes -- it's actually mysql that uses them. For postgress I am not sure
if it was developed...

>
>>
>> I don't recall exactly, but somehow I planned to switch async module to
>> use only processes from the core, but I thought that it can break
>> existing configs.
>>
>> To answer further, you don't need to keep them in sycn and you don't
>> need core async workers if you use only async_route() (or async_sleep(),
>> but this one has some traps highlighted in the readme, so I try not to
>> promote it that much).
>
> What kind of traps? :-) I don't really see anything in the docs for
> async_asleep() that sets off alarm bells in my mind.

A return from inside the route block done after async_sleep() is like an
exit. Also, the private memory variables (e.g., $var(...)) are not
propagated with the same values after this function. Well these are
common for async switching.

>
> At the moment I'm only using async_route(), yet this is the process
> situation:
>
> [root at allegro-4 routes]# kamcmd -s /tmp/kamailio_ctl ps
> 27621    main process - attendant
> 27623    udp receiver child=0 sock=10.150.20.6:5060
> 27624    udp receiver child=1 sock=10.150.20.6:5060
> 27625    udp receiver child=2 sock=10.150.20.6:5060
> 27626    udp receiver child=3 sock=10.150.20.6:5060
> 27627    udp receiver child=4 sock=10.150.20.6:5060
> 27629    udp receiver child=5 sock=10.150.20.6:5060
> 27630    udp receiver child=6 sock=10.150.20.6:5060
> 27632    udp receiver child=7 sock=10.150.20.6:5060
> 27635    slow timer
> 27638    timer
> 27639    secondary timer
> 27641    Async Task Worker
> 27642    Async Task Worker
> 27644    Async Task Worker
> 27647    Async Task Worker
> 27650    Async Task Worker
> 27652    Async Task Worker
> 27654    Async Task Worker
> 27656    Async Task Worker
> 27658    MI FIFO
> 27661    ctl handler
> 27663    RTIMER USEC EXEC
> 27664    RTIMER USEC EXEC
> 27666    RTIMER USEC EXEC
> 27669    RTIMER USEC EXEC
> 27672    RTIMER USEC EXEC
> 27674    RTIMER USEC EXEC
> 27676    RTIMER USEC EXEC
> 27678    ASYNC MOD TIMER
> 27680    ASYNC MOD TIMER
> 27682    ASYNC MOD TIMER
> 27684    ASYNC MOD TIMER
> 27686    ASYNC MOD TIMER
> 27688    ASYNC MOD TIMER
> 27690    ASYNC MOD TIMER
> 27692    ASYNC MOD TIMER
> 27694    Dialog KA Timer
> 27696    Dialog Clean Timer
> 27700    tcp main process
>
> So it is safe to remove the async_workers declaration entirely or set
> it to 0, and I can still benefit from 8 async processes for
> async_route()?
>
Yes.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com




More information about the sr-users mailing list