Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApiClient creates new threadpool with number of active threads even though it isn't used #52

Closed
yuvipanda opened this issue Dec 3, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@yuvipanda
Copy link

In https://github.com/tomplus/kubernetes_asyncio/blob/master/kubernetes_asyncio/client/api_client.py#L69, a new ThreadPool is created per ApiClient. A lot of other objects (such as Watch) create an ApiClient per use, leading to lots of ThreadPools being created. ThreadPools aren't free - on my machine, merely instantiating a ThreadPool object (similar to what's happening here) starts 8 threads.

Very soon this becomes too many threads, and CPU usage / time for everything shoots up way high - bringing everything else to a halt.

In this client, the ThreadPool shouldn't be used at all, so we should remove it.

@yuvipanda
Copy link
Author

Also, <3 thank you very much for this library!

@tomplus
Copy link
Owner

tomplus commented Dec 3, 2018

@yuvipanda Thanks. I'm happy to see that this library is useful for you.

You are right, in an asynchronous world these threads become obsolete but I keep it for compatibility reasons. I can port this swagger-api/swagger-codegen#8061 - so the thread pool will be created on demand (probably never). WDYT?

@yuvipanda
Copy link
Author

@tomplus yes, that sounds awesome :) would be lovely to renew push to get that merged too.

@tomplus
Copy link
Owner

tomplus commented Dec 9, 2018

It's been fixed in the latest version - v8.0.1.

@tomplus tomplus closed this as completed Dec 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants