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

[BUG] Everything is too slow #8

Closed
synalice opened this issue Jun 9, 2022 · 2 comments · Fixed by #12
Closed

[BUG] Everything is too slow #8

synalice opened this issue Jun 9, 2022 · 2 comments · Fixed by #12
Labels
bug Something isn't working

Comments

@synalice
Copy link
Owner

synalice commented Jun 9, 2022

If you are having issues with the program's speed (containers take around 5 seconds to be created) — you are not the one. It is being worked on, but for now there doesn't seem to be a solution for this. The issue seems to be somewhere within the Docker API.

A possible workaround would be to pre-create a "pool" of containers, but this seems like a very ugly solution, and it doesn't fix the issue that all other operations on Docker's API take too much time.

@synalice synalice added the bug Something isn't working label Jun 9, 2022
@synalice
Copy link
Owner Author

Update
The reason why the performance is so bad is mostly due to a config.EnsureImage() method that gets called from the config.NewConfigBuilder.Image().

The reason why calling config.EnsureImage() affects the performance so much is because it calls a docker's API, and doing this always takes a bit of time. But it's not so simple. While all other methods and functions (like ones regarding the removal of volumes and containers) also take some time — config.EnsureImage() is the worst.

config.EnsureImage() is supposed to check if an image you are trying to use for a config already exists on your machine, or if it is absent and needs to be pulled from the registry. Under the hood config.EnsureImage() calls for docker's Client.ImagePull().

The actual problem is that if the image actually does exist, and you don't need to pull it, Client.ImagePull() takes a tremendously long time to finish. At least for me, that seems to be too long for something so trivial — checking if an image is there or not.

For now, I will make it so that config.NewConfigBuilder.Image() doesn't call config.EnsureImage() which means you'll have to make sure that an image you are trying to use actually exists on your machine. Although, it not that big of a deal since you will get an error if an image you are trying to use is not there.

@synalice synalice linked a pull request Jun 10, 2022 that will close this issue
@synalice synalice removed a link to a pull request Jun 10, 2022
@synalice synalice linked a pull request Jun 10, 2022 that will close this issue
@synalice synalice pinned this issue Jun 10, 2022
@synalice
Copy link
Owner Author

The performance is still not as good as I'd want it to be, but now I understand what is the issue and will try to pay more attention to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant