Skip to content

REST Request can be sped up a great deal by keeping an SSL context #631

Closed
@serge-rgb

Description

@serge-rgb

Describe the bug

I am developing an app with Polygon as the market data provider. I need to make a high number of REST requests so I use many threads. I noticed a big performance impact so I did some profiling (see screenshot below)

I used a C/C++ profiler, so the Python part of the callstack is obscured, but you can see in the expanded call stack that the app is spending most of its time reading SSL certificate files.

I found a fix that passes a ssl_context to the PoolManager when creating the base client. This greatly increased the performance of the REST client. I'm opening this issue to submit a pull request.

To Reproduce

Create a python app that makes many REST requests and look at the CPU usage spike

Expected behavior

Better perf

Screenshots
Profiler_aoZobjKaLS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy