Skip to content

reuse HttpClient object / SNAT port exhaustion #87

@cmstroscio

Description

@cmstroscio

Hello,

We've been seeing SNAT port exhaustion in our DXA application when traffic is heavy and we have a lot of requests to the RWS content delivery endpoint. One of the recommendations from Azure, where we host our origin servers, is "For C# applications, ensure that the HttpClient object is created once and reused again."

See: https://docs.microsoft.com/en-us/azure/architecture/antipatterns/improper-instantiation/#how-to-fix-the-problem.

I have been told:
Lots of http client usages (including DXA) would recreate the http client which is what is causing the issue. This needs to be a shared instance.. the only way to fix this would be to make code changes in DXA. DXA is open source and not supported It would need to be done in the area below:

https://github.com/RWS/dxa-web-application-dotnet/blob/develop/Sdl.Web.Tridion/ApiClient/ApiClientFactory.cs#L166

Thanks
Marshall

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions