-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Endpoints api object needs change to allow useful merge patching #47787
Comments
This can help a lot in the performance of the endpoint controller which is currently using PUTs instead of PATCHs. Related issue: #47597 |
Maybe we can use the 'Addresses' list itself as the key but I'm not sure if that's going to be unique (though I'd hope so) and if it's fine to have a list as a key. |
without contention, patch is actually more expensive both client-side (because patch computation is required) and server-side (because patch application and conflict-detection is required). do we have contention on writing endpoints? I expected the endpoints controller to largely be the only writer |
I thought the main issue was the extremely short resync interval, not write conflicts |
I suggested PATCH to do blind overwrite, which avoids having to round trip between client and server, which reduces latency, which means the endpoints controller clears work faster, and moves more CPU to the master, where there is less latency to etcd. |
I agree with @smarterclayton - we want to avoid unnecessary GETs. The issue here is that we'd need to do some API changes to accomplish that. The question here is - are we doing things like this? |
does a json merge patch that overwrites the entire subsets list not work as expected? |
@liggitt We are currently PUT'ing the endpoints object which IIUC is as good as merging the entire subsets list (as that's pretty much the whole endpoints object). This is needing us to send huge endpoints objects over the wire each time. Also (as @smarterclayton pointed out), this could be bad if just a single endpoint is flapping states. |
Seems like it's not possible to merge patch individual elements of arrays as per RFC 7386 (the one that our jsonpatch vendored package follows). Quoting from the document: However IIUC we've solved this problem in k8s by using some field of the array elements' struct as the patchMergeKey, so individual array elements can be keyed on that field. |
I think that would be a breaking API change |
That's true. However if we want to be able to merge patch, we need the elements of the array to be somehow keyed. Another option I could think of was to use the index of the array element as it's key. This won't need any API change, but it's not a very clean way. Because a patch operation like "update element at index 5" might end up reaching after some other element got inserted there. What's worse is it won't be detected as a conflict and you'll end up wrongly updating unless there's some other safety mechanism. |
Closing this issue as it is infeasible without breaking API change. Let's reopen it in future if need be. |
Why bother with "patch individual address"? I was thinking more of "send
all of subsets as one patch".
…On Wed, Jun 28, 2017 at 6:55 PM, Shyam JVS ***@***.***> wrote:
Closed #47787 <#47787>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#47787 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p88bfmhfdw3dGO2W6h3X6Iljtcpuks5sItnZgaJpZM4N_nw7>
.
|
Isn't that pretty much equivalent to normal update? There's not much data except those addresses. |
@smarterclayton Yes, the reason for starting the issue was to do smarter patching than patching the whole list (which is basically the entire ep object). Unless there are some other benefits of patching I might be missing? |
Conflict detection is done on the server, so round trip latency is lower
and CPU used by deserialization is lower (mostly). Every round trip to the
API server is expensive because it involves 4 more serialize/deserialize
operations
…On Thu, Jun 29, 2017 at 5:59 AM, Shyam JVS ***@***.***> wrote:
@smarterclayton <https://github.com/smarterclayton> Yes, the reason for
starting the issue was to do smarter patching than patching the whole list
(which is basically the entire ep object). Unless there are some other
benefits of patching I might be missing?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#47787 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p5vHRR3crIvkw878zUCr6ctSv_Tvks5sI3WcgaJpZM4N_nw7>
.
|
OK, I clearly don't understand what you mean by "send all of subsets as one patch". Isn't it pretty much equivalent to plain update (assuming that metadata didn't change), except that instead of using protobuf we'd use JSON? |
Problem: Endpoints object currently is unsuitable for doing any reasonable PATCH operation (i.e. at the level of individual list entries, because a PATCH on the entire list is as good as a PUT of the endpoints object and hence useless).
Reason: There is no way of key'ing individual entries in the endpoints list currently because we do not have one entry for each <IP, Port> pair but rather have one entry for all the IPs having the same set of ports. This is represented as a cartesian product:
We need to key the EndpointSubset struct somehow.
Also, the compaction of size => some extra computation for the patch object (but I guess we are fine with it?)
cc @kubernetes/sig-api-machinery-misc @kubernetes/sig-scalability-misc @smarterclayton @gmarek
The text was updated successfully, but these errors were encountered: