CPU vs Memory Usage

Correlate CPU and memory consumption across services to identify resource-hungry outliers. Useful for spotting services that consume disproportionate memory relative to their CPU usage, or for detecting anomalous resource spikes before they become incidents.

Visualization: the scatter chart displays one point per service, where:

  • X-axis (horizontal) shows average CPU usage percentage (avgCPU)

  • Y-axis (vertical) shows average memory usage percentage (avgMemory)

  • Each point represents one service. Points in the upper-right quadrant indicate services with high CPU and high memory usage.

Screenshot showing a scatter chart widget displaying service resource usage with average CPU percentage on the horizontal axis and average memory percentage on the vertical axis, with one labeled point per service and Format Scatter panel visible on the right showing axes, colors, and series formatting options

Figure 162. CPU vs Memory Usage


Sample input data:

@timestampcpu_pctenvironmentmem_pctservice
1970-01-01T00:00:0212.4production23.1auth-service
1970-01-01T00:00:0278.9production85.4payment-service
1970-01-01T00:00:0234.1production41.7user-service
1970-01-01T00:00:0291.2production92.6analytics-service
1970-01-01T00:00:025.7staging11.3cache-service

Query:

logscale
groupBy(service, function=[avg(cpu_pct, as=avgCPU), avg(mem_pct, as=avgMemory)])

Query breakdown:

  1. Groups all events by the service field, producing one result row per unique service.

  2. Calculates the average CPU usage across all events for each service and stores the result in avgCPU.

  3. Calculates the average memory usage across all events for each service and stores the result in avgMemory.

Configuration:

  1. From the Search page, type your query in the Query Editor → click Run

  2. Choose Scatter Chart in the Widget selector

  3. Click the style icon : this opens the Format panel on the side where some properties are already configured by default based on the query result.

  4. Modify the properties to obtain the look and feel in this example, such as:

  5. In X-axis, select avgCPU as the field and enter a custom axis title such as CPU Usage (%).

  6. In Y-axis, select avgMemory as the field and enter a custom axis title such as Memory Usage (%).

  7. In Series formatting, leave Name empty so the formatting applies to all series, then enter service in the Label field so each point displays its service name.

  8. In Points, increase the Point size slider to make the data points more visible in the chart.

To customize this widget further, see Scatter Chart Property Reference.