Skip to content

Every stats scraping will create big temporary bytes slices #40092

@Patrick0308

Description

@Patrick0308

(This is used to request new product features, please visit https://discuss.istio.io for questions on using Istio)

Describe the feature request
When the size of envoy metrics is big, every stats scraping will create a big temporary bytes slice. This puts pressure on the golang gc.
see allocate_space profiler graph:
image
file: profile (2).pb.gz

One alternative solution:
Using a global stats bytes buffer. And reseting buffer on beginning of the pilot-agent scrap requests. If the size of metrics becomes smaller, we truncate the buffer on the end of scrap requests. Protect global stats bytes buffer access by a mutex.

Pros:
1. Avoids frequent object creation.
Cons:
1. No concurrent data access.
2. Not release buffer if never be scraped.

Describe alternatives you've considered

Affected product area (please put an X in all that apply)

[ ] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Extensions and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure

Affected features (please put an X in all that apply)

[ ] Multi Cluster
[ ] Virtual Machine
[ ] Multi Control Plane

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions