Skip to content

Improve memory efficiency of config data structures #24154

@yurykats

Description

@yurykats

When XDS config is converted from protobuf into C++ data structures, those data structures are not always as memory efficient as the protobufs, leading to large memory consumption.

Optional sub-messages are often stored as full blown objects, even when the config for them isn't present.

An example of that is RetryPolicy in RDS:

Each of them are 200+ bytes.

Another example are HeaderParsers. There are 2 (request/response) in each Route and each VirtualHost. Even if no headers are present in the config, RDS ends up creating HeaderParser instances:

HeaderParserPtr header_parser(new HeaderParser());

A better approach would be to keep a unique_ptr member and only initialize it when config is present. If not, a reference to a default ConstSingleton object can be used.

Metadata

Metadata

Assignees

Labels

area/perfenhancementFeature requests. Not bugs or questions.stalestalebot believes this issue/PR has not been touched recently

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions