Poor ARI performance with nodejs client


I’m using asterisk 14.6.0, I wrote a queue with nodejs, ARI, when system have some load, it took too much time for asterisk to call an ARI app

I call ARI from agi script on 09:38:15

[Jul 23 09:38:15] VERBOSE[16584][C-002702cb] res_agi.c: AGI Script Executing Application: (stasis) Options: (ari-queue-1,_180736124e3f7e204bec702acc711ccf1915,2611,ahbs12.mshuoke.com,59af8a4c0051f0aa0aa33e36,,,,,,)

but in ARI, first log was printed on [Jul 23 09:38:18] which means it took 3 seconds, for some calls, it’s even 7 or 8 seconds, is there a way to optimize this ?

2018-07-23 09:38:18 +08:00: [1532309886.6412710] Balance?????:1
2018-07-23 09:38:18 +08:00: [1532309886.6412710] Join queue stasis: _180736124e3f7e204bec702acc711ccf1915 channel: Local/13347110234@from_api_leg1-001d978a;1

there’s nothing before print Balance log in ARI code

ari.connect(ariurl, ariuser, aripass)
.then(function (client) {

    function queueJoinCb(event, channel){
        console.log("[%s] Balance?????:"+wkid,channel.id);
    client.on('StasisStart', queueJoinCb);

here’s system information:

server is 16core 32g memory on alicloud

[root@as3 ari-queue]# head /etc/asterisk/stasis.conf
initial_size = 30        ; Initial size of the threadpool.
;                          ; 0 means the threadpool has no threads initially
;                          ; until a task needs a thread.
idle_timeout_sec = 120     ; Number of seconds a thread should be idle before
;                          ; dying. 0 means threads never time out.
max_size = 0             ; Maximum number of threads in the Stasis threadpool.
;                          ; 0 means no limit to the number of threads in the
;                          ; threadpool.
[root@as3 ~]# asterisk -rx 'core show channels count'
531 active channels
208 active calls
2675626 calls processed
Asterisk ending (0).

system load is about 4-6

top - 13:33:26 up 10 days, 18:12,  6 users,  load average: 4.23, 4.43, 3.44

You are using an unsupported version of Asterisk, it’s unlikely anyone will support that. Before digging in you really should upgrade to a supported one.