envoyproxy / envoyproxy/envoy

mobile: avoid YAML/JSON parsing step during Envoy initialization

Open
#24,976 5 comments 0 reactions 0 assignees View on GitHub
enhancement mobile no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 22h
Merged PRs (30d)
430

Description

**Stop configuring Envoy Engine with the use of a huge string config.**

As it is now Envoy engine builder on all platforms configures Envoy by creating a huge string config which is then passed to the engine where it's parsed by YAML and/or JSON parsers. This string is based off the content of config.cc file and it's manipulated by engine_builder

This has a few negative consequences:

- YAML/JSON parsing steps are expensive - they can cause a big performance impact and there is often no way around them.
- We often end up having to modify the config using string manipulation operations which cause further performance impact i.e. add tens/hundreds of virtual cluster configs requires a lot of string concatenation operations.
- Working with a huge string is error prone, no type (or any other really) checks that can help you to catch issues before you learn that the app just crashes on app launch

We noticed a big performance impact of string manipulation/parsing operations when adding around 700-900 virtual cluster configs to Envoy builder and starting the engine:

Screenshot 2023-01-03 at 2 48 13 PM copy

The flame chart was captured on Android platform. Eyeballing the attached flame chart that was used to capture the initialization of Envoy Engine we can see that parsing JSON/YAML accounted for around 3-40% of the whole Envoy engine initialization time.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.