-
Notifications
You must be signed in to change notification settings - Fork 124
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
[2.5.11] Added typer to store #402
Conversation
057b9f4
to
55bf1ba
Compare
ff60e98
to
994701d
Compare
994701d
to
e2cdad8
Compare
965d33f
to
d7812fc
Compare
d7812fc
to
2ca10c5
Compare
marking as draft until 2.5.11 |
2ca10c5
to
3cd816b
Compare
3cd816b
to
18e65b4
Compare
aaca61a
to
4d90494
Compare
@paynejacob , did we decide to drop |
@snasovich yes we removed that functionality because it wasn't going to benefit the UI. ill update the description. |
4d90494
to
b32c167
Compare
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.
LGTM, kudos for adding a unit test for this
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.
lgtm, not a norman expert but the approach seems correct.
Note that this PR is actually for 2.6 release. The name is confusing due to how Norman was versioned and timeline of Rancher releases. The one for 2.5.x is this one: #405 |
rancher/rancher#34721
rancher/rancher#30718
rancher/rancher#25487
Problem
For a deep dive on this problem see here. TLDR; Norman is slow listing large resources because the Kubernetes dynamic client parses the response from the Kubernetes API multiple times when the type is
unstructured.Unstructured
. This can lead to high memory consumption and excessive processing time deseralizing responses.Solution
Stores can be optionally passed a typer. If the typer recognizes the resource associated with the given store it will return the Golang stuct for the given resource. This allows the client to deseralize the response more efficiently.
Testing
For a testing environment I used a k3d cluster with rancher running locally. All requests were done with curl piping the output to
/dev/null
. To test this I generated 200 configmaps with 8KB of data each. I then listed them with theapplication/json
content type three times and averaged the response time. With no changes it took an average of13,341 ms
to list configmaps. Applying these changes but not registeringConfigMapList
with the typer the response time averaged12,719 ms
. Registering theConfigMapList
with the typer brought it down to7,764 ms
.Notes:
~700 ms
. This was not measured with every test but the request to the API is not affected.Accept: application/protobuf
, combined with these changes I was able to get responses as low as2,000 ms
. Protobuf is only available if the typer recognizes the resources and significantly limits our ability to debug calls between Rancher and Kubernetes. With these limitations I don't think it is worth adding but could be worth exploring in the future as a further optimization.