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

Performance Optimization #19

Open
lukevp opened this issue May 26, 2020 · 2 comments
Open

Performance Optimization #19

lukevp opened this issue May 26, 2020 · 2 comments

Comments

@lukevp
Copy link
Contributor

lukevp commented May 26, 2020

In .net core, HttpClient is meant to be a singleton with the same lifecycle as an endpoint.

This is the canonical guide for the issues this causes, but it is significant and can make .net core software really unstable as time goes on. It also prevents connection pooling, which means lower performance for users of this library.
https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

It appears like the call chain in FusionAuthClient for all methods is to call buildClient() which calls buildAnonymousClient which creates a new instance of DefaultRESTClient for every request. Is this something you would consider improving on? I'm not super clear on if this library is code generated from another, I would be willing to help with this but not sure the best way to make this change.

@epbensimpson
Copy link
Contributor

I've been running into socket exhaustion issues when trying to update large numbers of users, which I assume is caused by this. I've implemented a solution that pools the HttpClient based on the host, which in my case means only 1 will be created. It could be changed to only use a single HttpClient but that would involve changing how the request URI is built and I don't want to open that can of worms.

@mark-robustelli
Copy link

PRs netcore 71 and fusionauth-client-builder 75.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants