{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39017","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39017/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39017/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39017/events","html_url":"https://github.com/kubernetes/kubernetes/issues/39017","id":196659927,"number":39017,"title":"PATCH is the most expensive operation in apiserver","user":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"labels":[{"id":173493835,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/sig/api-machinery","name":"sig/api-machinery","color":"d2b48c","default":false},{"id":125010198,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/sig/scalability","name":"sig/scalability","color":"d2b48c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-12-20T12:24:14Z","updated_at":"2016-12-27T20:56:34Z","closed_at":null,"body":"While running large cluster tests, I'm observing PATCH to be the biggest part of profiles. This involves both CPU as well as memory allocations.\r\n\r\nOn the unrelated node, memory allocations are relatively crucial for us now - after my PR https://github.com/kubernetes/kubernetes/pull/38961 that only reduce amount of memory allocations in cacher, the latency metrics in apiserver in 5000-node kubemark dropped by 5-30% depending on the metric.\r\n\r\nThat said, we are pretty much using strategicpatch now. How this is implemented on the server side now is:\r\n```\r\nInput: current runtime.Object, patch string\r\n1. serialize current to json\r\n2. deserialize it to map[string]interface{}\r\n3. deserialize patch to map[string]interface{}\r\n4. merge maps\r\n5. serialize the result to json\r\n6. deserialize it to runtime.Object (already patched).\r\n```\r\n\r\nThis is pretty expensive because it requires double json serialization & deserialization (and most memory allocations came from that).\r\n\r\nIt would be good to optimize this somehow (though I don't have any good idea yet).\r\n\r\n@kubernetes/sig-api-machinery-misc @smarterclayton @kubernetes/sig-scalability-misc "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/269381577","html_url":"https://github.com/kubernetes/kubernetes/issues/39017#issuecomment-269381577","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/39017","id":269381577,"user":{"login":"wojtek-t","id":10743879,"avatar_url":"https://avatars.githubusercontent.com/u/10743879?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek-t","html_url":"https://github.com/wojtek-t","followers_url":"https://api.github.com/users/wojtek-t/followers","following_url":"https://api.github.com/users/wojtek-t/following{/other_user}","gists_url":"https://api.github.com/users/wojtek-t/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek-t/subscriptions","organizations_url":"https://api.github.com/users/wojtek-t/orgs","repos_url":"https://api.github.com/users/wojtek-t/repos","events_url":"https://api.github.com/users/wojtek-t/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek-t/received_events","type":"User","site_admin":false},"created_at":"2016-12-27T20:56:34Z","updated_at":"2016-12-27T20:56:34Z","body":"So you suggest applying patch at the string/bytes level? It sounds dfferent that what you described in https://github.com/kubernetes/kubernetes/issues/39017#issuecomment-268680624\r\n(though it sounds more promissing)."}}
{"actor":{"display_login":"wojtek-t"}}