Closed
Description
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