envoy-mobile icon indicating copy to clipboard operation
envoy-mobile copied to clipboard

size: strip envoy api's v2 protos

Open junr03 opened this issue 6 years ago • 5 comments

According to my most recent binary size test the compiled v2 protos accounted for ~10% of the compiled binary (v3 equivalently accounting for another 10%).

Given that Envoy Mobile has migrated to using only v3 config we should investigate creating an option in envoy to only compile in the protos for the currently in use api version. Although here we are talking about v2 and v3 specifically, this solution should apply to subsequent version changes.

@htuch and @lizan will have good ideas about how to go about doing this in agreement with Envoy's vision for api usage, so we should connect with them.

My rough idea for getting started is:

  1. Right now all the api_proto_package targets for v3 contain their v2 counter parts. For instance, here. There should be a bazel option to not include that dependency. This would get us started in not including the v2 protos at compile time.
  2. For runtime we need to look a bit more if dropping the protos is safe.
    • Last I checked, call sites of this getEarlierVersionDescriptor check for null, so we should be able to not have the v2 protos safely.
    • We need to see how xDS subscriptions decide which version to use with upstream servers, and make sure the correct setting gets applied to only speak one version of the api, and for that version to be the same as the currently "in use" api.

junr03 avatar Feb 28 '20 00:02 junr03

These are all my current thoughts on this space. Nothing too fleshed out, but enough to get started. @buildbreaker I am assigning to you, as discussed internally, while I am out.

junr03 avatar Feb 28 '20 00:02 junr03

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 17 '20 18:04 stale[bot]

After running a fresh analysis 10/2020 this issue continues to be the greatest investment we can make. Compiled protos account ~34% of the binary size so dropping v2 protos should see a >15% reduction.

junr03 avatar Oct 28 '20 16:10 junr03

@junr03 given the plan to remove v2 in Q1 next year, do you think it makes sense to add this support to minify now or wait?

htuch avatar Nov 09 '20 19:11 htuch

Envoy (and envoy-mobile) doesn't (or won't) include v2 anymore since https://github.com/envoyproxy/envoy/pull/18817

Reflejo avatar Oct 28 '21 23:10 Reflejo