elastic / beats

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
https://www.elastic.co/products/beats
Other
12.14k stars 4.91k forks source link

[GCP] Optimize `metrics` metricset and metadata collection #40582

Open gpop63 opened 3 weeks ago

gpop63 commented 3 weeks ago

Overview

We've observed performance issues with the GCP metrics metricset when collecting data from a large number of projects with many instances. This affects services with or without additional metadata collection.

Current behavior:

Google's official recommendations for optimizing API calls (https://cloud.google.com/resource-manager/docs/performance) suggest:

Test Results (instances.aggregatedList)

api_response_time_and_size_comparison

Tested on my machine, so results may vary on other systems.

Using custom fields significantly reduced response size (from ~24 MB to 0.146 MB) and improved performance (from 4.05s to 2.10s). The impact of gzip is not so noticeable in this test maybe because it's small scale, but it could be more significant with larger datasets or over slower network connections.

Custom fields used in test: id,items/zones/instances(name,labels,machineType,status)

But as I mentioned earlier, services without extra metadata API calls can have issues. We should optimize the ListTimeSeries and ListMetricDescriptors calls, possibly by enabling gzip compression.

elasticmachine commented 3 weeks ago

Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services)

botelastic[bot] commented 3 weeks ago

This issue doesn't have a Team:<team> label.