microsoft/BotFramework-DirectLineJS

Implementation of "keepAliveAgent" with bot and qnamaker service

Bradrajkumar opened this issue · 4 comments

hi team,

FYI
this is a feature request.
i am using node.js for bot service integrated with QnaMaker. i need the complete code implementation of using "keepAliveAgent" in node.js application. i tried to find out some reference of usage of "keepAliveAgent" with node.js application with bot-framework and Qnamaker but unable to track it down.
it will be truly appreciable if either i will get source code of complete implementation on this point or please post it here so that i can take reference to implement the same.

Hey @Bradrajkumar ,
Could you please provide more details about what you are trying to do? This will help me understand your usage of "keepAliveAgent" and provide you the right information.
Regards,
Kashyap

Hi Kashyap,

  • my Bot Framework application is in node.js.
  • i have integrated Qna Maker with it.
  • it seems like my application is using outbound Api calls and this result in overhead of application which results in "EADDRINUSE", ENOBUF, etc. overall i can say that TCP connection is resetting abruptly and in unexpected way.
  • i am trying to use this "keepAliveAgent" in my code so that TCP connection can get reused and should not go out of maximum sockets.
    hope this information make you understand my scenario. please look into the code snippet which i used:-

Initialization
const HttpsAgent = require('agentkeepalive').HttpsAgent;
const keepaliveAgent = new HttpsAgent({
maxSockets: 160,
maxFreeSockets: 10,
timeout: 60000,
freeSocketTimeout: 30000
});
while calling the QNA Maker
const url = ${endpoint}/knowledgebases/${kbId}/generateanswer;
//Implementation of keep agent alive
const options = {
host: url,
port: 443,
path: '',
method: 'POST',
agent: keepaliveAgent,
};
const headers = {
"Content-Type": "application/json",
Authorization: "EndpointKey " + key,
Options:options
};

Thanks @Bradrajkumar - This issue microsoft/botbuilder-js#183 is deals with the same problem. Looks like you have already participated there. I think we should close this as duplicate.

Closing this as it is a duplicate