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
PS Improvements: ignore linked names and image lookup cache. #18177
Conversation
Since: r.Form.Get("since"), | ||
Before: r.Form.Get("before"), | ||
Filters: r.Form.Get("filters"), | ||
IgnoreLinks: httputils.BoolValue(r, "ignoreLinks"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use trunc here too. For me it sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually implemented this at the beginning with trunc, but I think having a dedicated flag is better because we're not using it for anything else but ignoring the links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno, trunc
sounds pretty fit for this and doesn't add anything to API. And it means same things from cli point of view. I'd better to try to keep it same if possible and now I don't see any requests for separate flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're not sending the trunc flag to the api currently, we need a new flag regardless. All truncating is client side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, funny. Okay.
Some timings with a few big images: root@docker-flames:~# time sh -c "./docker ps -a --format '{{.Image}}' | sort | uniq"
alpine
golang
quay.io/coreos/etcd
ubuntu
real 0m0.063s
user 0m0.076s
sys 0m0.004s 218 containers in that previous list: root@docker-flames:~# time sh -c "./docker ps -a | wc -l"
218
real 0m0.079s
user 0m0.100s
sys 0m0.028s |
edffe20
to
32161a4
Compare
If we do #16032 then link lookup will be fast anyway. |
@cpuguy83 yeah, maybe we should try to merge it :) |
@cpuguy83 I know. There is still no need to look for links when we don't even display those names by default. |
32161a4
to
2fa87c0
Compare
- Ignore linked container names in the api when they are not necessary. This avoids an O(N) traversal of the container tree when we're not going to display the linked names for containers. `docker ps` ignores those names by default, so we don't need them in 99% of the cases. - Cache image name lookup. Same image names are going to be resolved to the same id for a given list of containers. We can cache the result of the first operation avoiding an O(N) lookup of images. Signed-off-by: David Calavera <david.calavera@gmail.com>
2fa87c0
to
b5b38e6
Compare
sounds ok for me |
@calavera instead of having |
@tiborvass we currently have that |
I see what you mean. The right solution here would be to allow API clients to specify filters, a bit like |
closing this until new order. |
@calavera Cache fix still can be used I think. |
This avoids an O(N) traversal of the container tree when we're not
going to display the linked names for containers.
docker ps
ignoresthose names by default, so we don't need them in 99% of the cases.
to the same id for a given list of containers. We can cache the result
of the first operation avoiding an O(N) lookup of images.
Signed-off-by: David Calavera david.calavera@gmail.com