-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add benchmark test for parsing openapi in protobuf format #4396
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mengqiy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
IMO we should start with still parsing JSON. Because users can provide their current openapi schema in JSON we will need to continue to support JSON parsing regardless. I can work on this. Once that is working, we can take a look at using proto. While doing so we should make sure that users can still provide additional schema in JSON. We also should allow users to provide their input schema in proto form. We currently accept both JSON and yaml, so supporting a third type of format should be fine. How did you retrieve the proto format of the openapi data? I'm thinking that if we start parsing proto schemas, we should support a |
Also, I did a check to see if introducing |
This looks great! (Could you fix the presubmit?) |
To retrieve the openapi in proto, see: https://kubernetes.io/docs/concepts/overview/kubernetes-api/#openapi-v2 For your convenience, I use the following: To retrieve it from a GKE cluster using gcloud: To retrieve it using kubectl + curl: I can't use |
We should support parsing both JSON and proto. Our baked-in openapi schema should be in proto, since it can be much faster. And users are more likely to provide JSON. |
I reverted the change in go.mod that upgrade the kube-openapi dependency. It should be passing this time. |
Related: #3248 /lgtm |
The following is the benchmark results:
If we switch to
github.com/googleapis/gnostic/openapiv2
, but still parsing JSON, we can get 2.3X faster.If we switch to
github.com/googleapis/gnostic/openapiv2
and use proto completely, we can get 40.5X faster.If switching to
github.com/googleapis/gnostic/openapiv2
, we will need to make some big change tokyaml/openapi
.Related issue: #3670