Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Reuse HttpClient and HttpClientHandler in Web Cmdlets #6156

Copy link
Copy link
@markekraus

Description

@markekraus
Issue body actions

HttpClient and HttpClientHandler, while implementing IDisposable, are intended to be reused. not re using HttpClient results in significant overhead and loses out on the ability to reuse TCP pools. We currently create and dispose HttpClient and HttpClientHandler instances on every call to the web cmdlets. With large numbers of HTTP requests this can get expensive.

We should investigate the introduction of a single HttpClient/HttpClientHandler. One of my specific concerns is that it may not play nicely in multi-threading scenarios. a static instance of these is supposed ot be thread safe, but, I have no clue if a change in one thread to HttpClientHandler.Credentials (for example) will have an impact on the handler in another thread. *shrugs

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-DuplicateThe issue is a duplicate.The issue is a duplicate.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.