You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the agent creates a bunch of threads on initialization, to do background work:
a transport thread for sending data to APM Server
a config thread to periodically fetch central config
a metrics thread to periodically collect metrics
This is somewhat wasteful, and it's not a great look when users notice that using our agent increases the thread count of their app substantially.
Describe the solution you'd like
I think it should be doable to only have one background thread, which runs an asyncio event loop. All tasks that need to run in the background can then be scheduled on that event loop.
One fairly large road block is that urllib3 does not have support for asyncio, and probably won't anytime soon. We would have to switch to another HTTP client library, aiohttp or httpx come to mind. On the plus side, this change might make it easier to finally implement streaming HTTP requests to APM Server and bring us to parity with other backend agents in this respect.
This architecture might even allow us to move other things into the background thread, like reading source files for stack traces.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently, the agent creates a bunch of threads on initialization, to do background work:
This is somewhat wasteful, and it's not a great look when users notice that using our agent increases the thread count of their app substantially.
Describe the solution you'd like
I think it should be doable to only have one background thread, which runs an asyncio event loop. All tasks that need to run in the background can then be scheduled on that event loop.
One fairly large road block is that urllib3 does not have support for asyncio, and probably won't anytime soon. We would have to switch to another HTTP client library, aiohttp or httpx come to mind. On the plus side, this change might make it easier to finally implement streaming HTTP requests to APM Server and bring us to parity with other backend agents in this respect.
This architecture might even allow us to move other things into the background thread, like reading source files for stack traces.
The text was updated successfully, but these errors were encountered: