api: Add 'detail' field in ListPods and ListImages request. #1786
Conversation
Any performance data to suggest why we shouldn't just make this the default behaviour? |
@jonboulle Will make some benchmark tomorrow. |
af31e0f
to
f00d78c
Compare
Benchmark result: BenchmarkListSinglePodDetail 30 44337812 ns/op
BenchmarkListSinglePodNoDetail 2000 731483 ns/op
BenchmarkList10PodsDetail 3 469036344 ns/op
BenchmarkList10PodsNoDetail 500 4590260 ns/op
BenchmarkInspectPodIn10Pods 30 35155285 ns/op
BenchmarkListSingleImageDetail 30 43079439 ns/op
BenchmarkListSingleImageNoDetail 30 41183525 ns/op
BenchmarkList10ImagesDetail 50 47760750 ns/op
BenchmarkList10ImagesNoDetail 30 41520293 ns/op
BenchmarkInspectImageIn10Images 30 45591321 ns/op
ok github.com/coreos/rkt/tests 283.566s |
e427946
to
500f810
Compare
195b7b8
to
334d86c
Compare
Fixed the benchmark:
From the result I saw:
|
Seems fine to me |
@@ -332,8 +332,15 @@ func (s *v1AlphaAPIServer) ListPods(ctx context.Context, request *v1alpha.ListPo | |||
return | |||
} | |||
|
|||
if !filterPod(pod, manifest, request.Filter) { | |||
if request.Detail { | |||
if err := fillAppInfo(s.store, p, pod); err != nil { // Do not return partial pods. |
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 calling fillAppInfo
only if the pod is not filtered by filterPod
?
Can you explain in The idea to add this |
@alban I think we need to be able to run the bench with something like Besides, there's not plan to run them in semaphore as it takes a long time. |
ping ? |
|
||
if request.Detail { | ||
if err := fillAppInfo(s.store, p, pod); err != nil { // Do not return partial pods. | ||
return |
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.
The following comment was hidden by GitHub:
Why not calling
fillAppInfo
only if the pod is not filtered byfilterPod
?
Can you just say that in the
|
@alban Fixed, added readme. |
LGTM after a rebase :) |
This enables the API service to return detailed pod/image infos if required. So for some use case where the users want to get N pods' detailed info, this saves N grpc round trips.
Rebased |
} | ||
|
||
func BenchmarkList1PodNoDetail(b *testing.B) { | ||
benchPods(b, 1, false, true, false) |
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 know this is just test/benchmark code, but benchPods() use of these bools makes for pretty unreadable code.
@vcaputo I updated the tests, splitted into smaller functions. How does this look like? |
@vcaputo I am merging this one, if there are more comments wrt to tests, I can iterate later. |
api: Add 'detail' field in ListPods and ListImages request.
This enables the API service to return detailed pod/image infos
if required. So for some use case where the users want to get N
pods' detailed info, this saves N grpc round trips.
cc @jonboulle @alban
cc @dgonyeo you might take advantage of this to not to inspect each pod later.