Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate AgentKeepAlive fix into botframework-connector #183

Closed
Stevenic opened this issue Apr 13, 2018 · 12 comments · Fixed by #2891
Closed

Integrate AgentKeepAlive fix into botframework-connector #183

Stevenic opened this issue Apr 13, 2018 · 12 comments · Fixed by #2891
Assignees
Labels
backlog The issue is out of scope for the current iteration but it will be evaluated in a future release. BF Customer Ask "Convenience" asks made by our customers and don’t accrue to any major feature draft The issue definition is still being worked on and it is not ready to start development. feature-request A request for new functionality or an enhancement to an existing one. no parity This issue applies only to this platform P2 Nice to have triaged Reviewed by the Triage Team

Comments

@Stevenic
Copy link
Contributor

High volume azure hosted bots can start getting timeouts due to an SNAT issue. We have a blog post for how to fix this but I think we could build the fix into the connector such that's it easier to turn on and configure. I'm not sure it should be on by default but I'm all for making it easy to enable.

@Stevenic Stevenic self-assigned this Apr 13, 2018
@Stevenic Stevenic added the P2 Nice to have label Apr 17, 2018
@Stevenic Stevenic added this to the Release milestone Apr 17, 2018
@sgellock sgellock removed this from the Release milestone Aug 17, 2018
@sgellock sgellock added the backlog The issue is out of scope for the current iteration but it will be evaluated in a future release. label Aug 17, 2018
@sgellock sgellock added Discussion triaged Reviewed by the Triage Team 4.3 February 14, 2019 Release and removed backlog The issue is out of scope for the current iteration but it will be evaluated in a future release. labels Dec 1, 2018
@justinwilaby
Copy link
Contributor

The challenge here is to get both proxy support and keep-alive working together. It seems that now you can have just one or the other.

@sgellock sgellock added 4.4 April 15, 2019 Release and removed 4.3 February 14, 2019 Release labels Feb 13, 2019
@damadei
Copy link

damadei commented Feb 26, 2019

Guys, any news on this? I'm doing a benchmark with the partner and we are seeing 1/2 of the performance from a Node.js bot compared to a .NET Core one. If somebody can point me where this call is made I could try to implement the change to check if this is the cause of the performance difference I'm seeing and submit a PR.

@EricDahlvang
Copy link
Member

Hey @damadei

Thank you for your willingness to help out with this issue. I'd like to work with you it, and I've emailed you offline.

@EricDahlvang
Copy link
Member

It seems that the reason BotBuilder-dotnet does not have these issues is due to the caching of ConnectorClients https://github.com/Microsoft/botbuilder-dotnet/blob/master/libraries/Microsoft.Bot.Builder/BotFrameworkAdapter.cs#L59 as well as using a static HttpClient https://github.com/Microsoft/botbuilder-dotnet/blob/master/libraries/Microsoft.Bot.Builder/BotFrameworkAdapter.cs#L886 These two patterns, or something similar, should also be implemented in BotBuilder-js.

@stevengum
Copy link
Member

@EricDahlvang Azure/ms-rest-js#308 and axios/axios#1831

@benbrown benbrown added blocked Current progress is blocked on something else. 4.5 and removed 4.4 April 15, 2019 Release labels Mar 27, 2019
@sgellock sgellock added 4.6 4.6 release and removed 4.5 labels Jun 21, 2019
@sgellock
Copy link
Member

Now that we are off autorest, we can modify the code that could address this. moving out of 4.5

@cleemullins cleemullins added backlog The issue is out of scope for the current iteration but it will be evaluated in a future release. and removed 4.6 4.6 release labels Sep 13, 2019
@stevengum stevengum self-assigned this Mar 12, 2020
@stevengum
Copy link
Member

This is still blocked; the last release of the 1.x line of @azure/ms-rest-js does not contain a way to inject a custom Agent with keepAlive configured to true (AxiosHttpClient.sendRequest()).

@stevengum
Copy link
Member

Actually, previous comment only applies for using the built-in Node.js HttpClient (AxiosHttpClient in 1.x of ms-rest-js).

If #2013 is addressed and ServiceClientOptions is surfaced to developers, they would be able to provide their own HttpClient which could use their own HTTP request library with Agent support.

@EricDahlvang
Copy link
Member

With #2013 merged, it is now possible to provide a custom @ms-rest-js.HttpClient as a parameter to BotFrameworkAdapter:

const adapter = new BotFrameworkAdapter({
    appId: process.env.MicrosoftAppId,
    appPassword: process.env.MicrosoftAppPassword,
    clientOptions: { httpClient: new CustomAxiosHttpClient() } 
});

However, this is still very inconvenient and cumbersome to implement. The AxiosHttpClient provided by the 1.x version of ms-rest-js contains some custom error handling, abort logic, stream support, etc. Much of this is not needed by the sdk, but in order to use agent keepAlive our recommendation for R9 will be to copy this file into the bot and modify axios.create() to include:

httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true }),

We could make this easier.

Lastly, we need to consider options for providing keepAlive agents to QnAMaker, LUIS, and storage providers.

@gabog gabog added BF Customer Ask "Convenience" asks made by our customers and don’t accrue to any major feature no parity This issue applies only to this platform R10 Release 10 - August 17th, 2020 and removed blocked Current progress is blocked on something else. labels Jun 9, 2020
@gabog gabog added this to R10 Story Backlog in Bot Framework SDK - BF Customer Ask Jun 9, 2020
@gabog gabog removed the R10 Release 10 - August 17th, 2020 label Jun 30, 2020
@gabog gabog moved this from R10 Repo Issues to Backlog Repo Issues in Bot Framework SDK - BF Customer Ask Jun 30, 2020
@Bradrajkumar
Copy link

Bradrajkumar commented Aug 27, 2020

Hi Team,
i am facing one issue of connection reset an need the same requirement so that i can take a reference to implement the code base directly in my solution.
FYI
I am not using any node module named : - @ms-rest-js.
any input or complete solution will be truly helpful for me.

@EricDahlvang
Copy link
Member

Hi @Bradrajkumar

Currently, the sdk provides and httpClient parameter in BotFrameworkAdapter's ConnectorClientOptions:

const adapter = new BotFrameworkAdapter({
    appId: process.env.MicrosoftAppId,
    appPassword: process.env.MicrosoftAppPassword,
    clientOptions: { httpClient: new CustomAxiosHttpClient() } 
});

Here is a CustomAxiosHttpClient implementation:

customAxiosHttpClient_js.txt

Unfortunately, the sdk does not currently expose an agent parameter for QnAMaker or Luis implementations which are using node-fetch

@gabog gabog added draft The issue definition is still being worked on and it is not ready to start development. feature-request A request for new functionality or an enhancement to an existing one. and removed discussion labels Sep 2, 2020
@stevengum
Copy link
Member

🚀 Azure/ms-rest-js#404 🚀

joshgummersall pushed a commit that referenced this issue Oct 13, 2020
Bot Framework SDK - BF Customer Ask automation moved this from Backlog Repo Issues to R10 Done Oct 13, 2020
stevengum pushed a commit that referenced this issue Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog The issue is out of scope for the current iteration but it will be evaluated in a future release. BF Customer Ask "Convenience" asks made by our customers and don’t accrue to any major feature draft The issue definition is still being worked on and it is not ready to start development. feature-request A request for new functionality or an enhancement to an existing one. no parity This issue applies only to this platform P2 Nice to have triaged Reviewed by the Triage Team
Projects
No open projects
Development

Successfully merging a pull request may close this issue.