Skip to content

Slow deepcopy #247

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

Closed
nosammai opened this issue Mar 28, 2023 · 4 comments · Fixed by #300
Closed

Slow deepcopy #247

nosammai opened this issue Mar 28, 2023 · 4 comments · Fixed by #300

Comments

@nosammai
Copy link

Hello!

I have been running into some issues with CPU usage on my app that is doing some big/busy watches. I ran a profile and noticed that the deepcopy of the Configuration object in the openapi generated client is taking up the majority of the CPU time, as well as the rebuilding of the loggers that it subsequently triggers.

I tested disabling the copy of the Configuration by replacing this line with return cls._default, and it reduced the startup time of my application by about 7-10x. I have no idea what the ramifications of not copying that object are, but it seems to still be working okay so far.

I'm curious if anyone else has run into these perf issues. I'm not sure I am knowledgeable enough to produce an actual fix for this, but was curious of the ramifications of not making that copy. It seems like most of the stuff in that Configuration object is related to the endpoint being connected to, so I'm wondering if it needs to be copied if my application is only connecting to a single kubernetes cluster?

Thanks!

@tomplus
Copy link
Owner

tomplus commented Mar 28, 2023

Hello @nosammai

Thanks for reporting this issue and your investigation. It looks like you hit the same issue which exists in the synchronous client: kubernetes-client/python#1921

You can use your workaround, it safe for me too.
The final solution is upgrading the generator to the next version which I'm working on now.

@nosammai
Copy link
Author

Thanks for the info @tomplus, looking forward to the official fix! would you prefer to keep this issue open in case others run into similar problems or close it out?

@tomplus
Copy link
Owner

tomplus commented Mar 29, 2023

I agree, let's keep it opened.

@tomplus
Copy link
Owner

tomplus commented Jan 28, 2024

As I decided not to upgrade the generator for now so I've applied a patch for it. It'll be available in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants