Performance Metrics & Capacity Planning
Relevant source files
The following files were used as context for generating this wiki page:
The Performance Metrics and Capacity Planning module in ManageIQ provides a robust framework for discovering, monitoring, and analyzing the utilization of virtual machines, hosts, clusters, and storage. It enables "Insight" into hybrid IT environments through reporting, analytics, and trending, while supporting "Control" via performance-based alerting and automated resource management.
Sources: README.md:16-17
Metric Capture and Processing
The system processes performance data across various intervals, primarily "realtime," "hourly," and "daily." Raw counter values are ingested, normalized, and transformed into metrics stored within the database.
Data Flow for Metric Processing
The processing logic identifies defined columns and handles multiple instances of counter values by rolling them up into aggregate rows.
This diagram illustrates the sequence from raw data ingestion to parent rollup and notification.
Sources: app/models/metric/ci_mixin/processing.rb:2-34
Key Processing Functions
perf_process: The entry point for processing metric ranges. It transforms raw counter hashes into persistence-ready parameters.normalize_value: Adjusts values based on counter precision and caps percentages at 100.0.convert_metrics: Determines the storage strategy based on the database adapter (e.g.,miq_postgresuses a timestamp-grouped approach).
Sources: app/models/metric/ci_mixin/processing.rb:3-23, app/models/metric/ci_mixin/processing.rb:149-160
Performance Analysis & Capacity Planning
Capacity planning allows administrators to project resource needs and determine if specific workloads (VMs) will fit into target environments (Hosts or Clusters).
Planning Architecture
The VimPerformanceAnalysis::Planning class acts as the core engine for these calculations. It evaluates compute (CPU, vCPUs, Memory) and storage requirements based on historical trends or current status.
| Resource Type | Metrics Used | Default Mode |
|---|---|---|
| CPU | max_cpu_usagemhz_rate_average | :perf_trend |
| Memory | max_derived_memory_used | :perf_trend |
| Storage | used_disk_storage, v_used_space | :current |
Sources: app/models/vim_performance_analysis.rb:79-114, app/models/vim_performance_analysis.rb:144-159
Trend and Slope Calculation
The system calculates linear regressions to determine the "slope" of resource utilization over time. This data is used to project when a resource will hit a defined limit.
The predictive analysis identifies future bottlenecks by calculating the timestamp at which a trend value reaches a specific threshold.
Sources: app/models/vim_performance_analysis.rb:271-300, app/models/vim_performance_analysis.rb:321-335
Operating Ranges and Right-Sizing
ManageIQ generates "Normal Operating Ranges" to identify overallocated or under-provisioned resources. This logic provides recommendations for vCPUs and Memory based on 30-day averages and peaks.
Calculation Logic
Metrics are analyzed to find the cpu_usage_rate_average_high_over_time_period and similar low/average bounds.
- Recommended vCPUs: Derived from peak usage rates.
- Overallocated %: Calculated by comparing current assignments to recommended values.
Sources: spec/models/metric_spec.rb:136-160
Kubernetes Rollup Normalization
In container environments, CPU usage for nodes is calculated as a weighted average over cores to ensure accurate normalization across nodes with different hardware specifications.
# Example logic for weighted core usage
# 50% of 2 cores system ~ 1 core in use
# 75% of 8 cores system ~ 6 cores in use
# Total: 10 cores and 7 in use => 70% usage
Sources: spec/models/metric_spec.rb:213-240
Performance Events & Alerting
The system defines specific events based on capacity projections. These are triggered when a trend analysis predicts that a limit will be reached within a 30-day window.
| Event Name | Description | Severity |
|---|---|---|
cpu_usage_100 | CPU projected to reach 100% of available | 1 |
mem_usage_90 | Memory projected to reach 90% of available | 1 |
disk_usage_75 | Disk projected to reach 75% of available | 2 |
Sources: db/fixtures/miq_event_definitions.yml:6-140
Resource Metric Retrieval
Individual configuration items (CIs) such as Host implement specialized methods to fetch performance data. The get_performance_metric function supports aggregation functions like :avg, :min, and :max over arbitrary time ranges.
Performance Virtual Columns
The system uses virtual columns to calculate complex states, such as:
v_pct_cpu_ready_delta_summation: CPU Ready %v_pct_cpu_used_delta_summation: CPU Used %v_pct_cpu_wait_delta_summation: CPU Wait %
Sources: app/models/host.rb:719-748, spec/models/metric_spec.rb:163-176
Trend Chart Layouts
Trending data is visualized through line charts showing the "Trend of CPU Used," "Trend of Memory Used," and projected disk space hits.
Sources: product/charts/layouts/daily_util_charts.yaml:4-25
Summary
The Performance Metrics & Capacity Planning system facilitates deep visibility into resource lifecycles. By combining realtime data capture with long-term trend analysis and linear regression, ManageIQ enables proactive management of hybrid infrastructures. This system ensures that resources are "right-sized" and provides automated alerts before critical capacity thresholds are crossed.