RAC Current Block Receive Analysis (gvcrrec.sql)
What This Script Does
Section titled “What This Script Does”This script analyzes RAC Global Cache Service (GCS) performance by:
- Monitoring current block receive times across all instances
- Calculating average receive time per current block transfer
- Identifying potential cluster interconnect performance issues
- Providing instance-by-instance cluster communication analysis
Script
Section titled “Script”rem gvcrrec.sqlcolumn "AVG RECEIVE TIME (ms)" format 9999999.9col inst_id for 9999prompt GCS CURRENT BLOCKSselect b1.inst_id, b2.value "RECEIVED",b1.value "RECEIVE TIME",((b1.value / b2.value) * 10) "AVG RECEIVE TIME (ms)"from gv$sysstat b1, gv$sysstat b2where b1.name = 'gc current block receive time' andb2.name = 'gc current blocks received' and b1.inst_id = b2.inst_id/
SQL> @gvcrrec.sql
Required Privileges
Section titled “Required Privileges”- SELECT on GV$SYSSTAT
Sample Output
Section titled “Sample Output”GCS CURRENT BLOCKSINST_ID RECEIVED RECEIVE TIME AVG RECEIVE TIME (ms)------- ---------- ------------ -------------------- 1 1,234,567 12,345,670 100.0 2 1,456,789 13,567,890 93.1 3 1,678,901 15,789,010 94.0 4 1,890,123 17,901,230 94.7
Key Output Columns
Section titled “Key Output Columns”- INST_ID: RAC instance number
- RECEIVED: Total number of current blocks received from other instances
- RECEIVE TIME: Total time spent receiving current blocks (in centiseconds)
- AVG RECEIVE TIME (ms): Average time per current block receive operation in milliseconds
Understanding RAC Global Cache Service
Section titled “Understanding RAC Global Cache Service”Current Blocks vs. Consistent Read Blocks
Section titled “Current Blocks vs. Consistent Read Blocks”- Current Blocks: Most recent version of data blocks for DML operations
- Usage: Required for INSERT, UPDATE, DELETE operations
- Transfer: Moved between instances when data modification needed
Performance Implications
Section titled “Performance Implications”- Low Receive Times: Efficient cluster interconnect
- High Receive Times: Network latency or bandwidth issues
- Variance Between Instances: Potential configuration problems
Performance Baselines
Section titled “Performance Baselines”Acceptable Performance Ranges
Section titled “Acceptable Performance Ranges”- Excellent: < 5ms average receive time
- Good: 5-15ms average receive time
- Warning: 15-30ms average receive time
- Critical: > 30ms average receive time
Network Type Expectations
Section titled “Network Type Expectations”- InfiniBand: 1-5ms typical
- Gigabit Ethernet: 5-15ms typical
- Fast Ethernet: 15-30ms typical
Analysis and Troubleshooting
Section titled “Analysis and Troubleshooting”High Receive Times Diagnosis
Section titled “High Receive Times Diagnosis”-- Check interconnect configurationSELECT inst_id, name, valueFROM gv$parameterWHERE name IN ('cluster_interconnects', 'cluster_interconnect_retries')ORDER BY inst_id;
-- Compare with consistent read block timesSELECT b1.inst_id, ROUND((b1.value / b2.value) * 10, 2) "CR AVG TIME (ms)", ROUND((c1.value / c2.value) * 10, 2) "CURRENT AVG TIME (ms)"FROM gv$sysstat b1, gv$sysstat b2, gv$sysstat c1, gv$sysstat c2WHERE b1.name = 'gc cr block receive time'AND b2.name = 'gc cr blocks received'AND c1.name = 'gc current block receive time'AND c2.name = 'gc current blocks received'AND b1.inst_id = b2.inst_idAND c1.inst_id = c2.inst_idAND b1.inst_id = c1.inst_idORDER BY b1.inst_id;
Instance Imbalance Analysis
Section titled “Instance Imbalance Analysis”-- Check for uneven workload distributionSELECT inst_id, ROUND(value/1024/1024, 2) current_blocks_mbFROM gv$sysstatWHERE name = 'gc current blocks received'ORDER BY value DESC;
Common Performance Issues
Section titled “Common Performance Issues”Network Bottlenecks
Section titled “Network Bottlenecks”- Symptoms: Consistently high receive times across instances
- Causes: Insufficient bandwidth, network congestion
- Solutions: Upgrade network hardware, optimize interconnect
Interconnect Configuration
Section titled “Interconnect Configuration”- Symptoms: Variable performance between instances
- Causes: Asymmetric network paths, configuration mismatches
- Solutions: Review network topology, balance connections
Application Design
Section titled “Application Design”- Symptoms: Excessive current block transfers
- Causes: Poor data locality, frequent cross-instance DML
- Solutions: Partition data, optimize application design
Cluster Interconnect Optimization
Section titled “Cluster Interconnect Optimization”Network Configuration
Section titled “Network Configuration”-- Check current interconnect settingsSELECT name, value, descriptionFROM v$parameterWHERE name LIKE '%interconnect%'OR name LIKE '%cluster%';
Monitoring Commands
Section titled “Monitoring Commands”-- Monitor interconnect utilizationSELECT inst_id, name, valueFROM gv$sysstatWHERE name LIKE 'gc%time%'OR name LIKE 'gc%received'ORDER BY inst_id, name;
Historical Analysis
Section titled “Historical Analysis”Trending Over Time
Section titled “Trending Over Time”-- Create monitoring table for trendsCREATE TABLE gc_performance_history ( check_time DATE, inst_id NUMBER, blocks_received NUMBER, total_time_cs NUMBER, avg_time_ms NUMBER);
-- Insert current valuesINSERT INTO gc_performance_historySELECT SYSDATE, b1.inst_id, b2.value, b1.value, ((b1.value / b2.value) * 10)FROM gv$sysstat b1, gv$sysstat b2WHERE b1.name = 'gc current block receive time'AND b2.name = 'gc current blocks received'AND b1.inst_id = b2.inst_id;
Performance Comparison
Section titled “Performance Comparison”-- Compare current vs. previous daySELECT inst_id, current_avg_ms, previous_avg_ms, ROUND(((current_avg_ms - previous_avg_ms) / previous_avg_ms) * 100, 2) pct_changeFROM ( SELECT inst_id, AVG(CASE WHEN check_time >= TRUNC(SYSDATE) THEN avg_time_ms END) current_avg_ms, AVG(CASE WHEN check_time >= TRUNC(SYSDATE-1) AND check_time < TRUNC(SYSDATE) THEN avg_time_ms END) previous_avg_ms FROM gc_performance_history WHERE check_time >= TRUNC(SYSDATE-1) GROUP BY inst_id);
RAC-Specific Monitoring
Section titled “RAC-Specific Monitoring”Global Cache Statistics
Section titled “Global Cache Statistics”-- Comprehensive RAC cache statisticsSELECT name, SUM(value) total_valueFROM gv$sysstatWHERE name LIKE 'gc %block%'GROUP BY nameORDER BY name;
Wait Event Analysis
Section titled “Wait Event Analysis”-- Check RAC-related wait eventsSELECT event, total_waits, time_waited, ROUND(time_waited/total_waits, 2) avg_wait_msFROM v$system_eventWHERE event LIKE 'gc %'AND total_waits > 0ORDER BY time_waited DESC;
Alerting and Thresholds
Section titled “Alerting and Thresholds”Performance Alerts
Section titled “Performance Alerts”-- Create alert for high receive timesSELECT inst_id, avg_receive_time_ms, CASE WHEN avg_receive_time_ms > 30 THEN 'CRITICAL' WHEN avg_receive_time_ms > 15 THEN 'WARNING' ELSE 'OK' END alert_levelFROM ( SELECT b1.inst_id, ((b1.value / b2.value) * 10) avg_receive_time_ms FROM gv$sysstat b1, gv$sysstat b2 WHERE b1.name = 'gc current block receive time' AND b2.name = 'gc current blocks received' AND b1.inst_id = b2.inst_id AND b2.value > 0);
Integration with Other Metrics
Section titled “Integration with Other Metrics”Complete RAC Health Check
Section titled “Complete RAC Health Check”-- Combine with other RAC metricsSELECT m.inst_id, ROUND(m.avg_receive_time_ms, 2) current_block_ms, ROUND(c.avg_receive_time_ms, 2) cr_block_ms, ROUND(s.cpu_used_by_this_session/100, 2) cpu_secondsFROM ( -- Current block times SELECT b1.inst_id, ((b1.value / b2.value) * 10) avg_receive_time_ms FROM gv$sysstat b1, gv$sysstat b2 WHERE b1.name = 'gc current block receive time' AND b2.name = 'gc current blocks received' AND b1.inst_id = b2.inst_id) m,( -- CR block times SELECT b1.inst_id, ((b1.value / b2.value) * 10) avg_receive_time_ms FROM gv$sysstat b1, gv$sysstat b2 WHERE b1.name = 'gc cr block receive time' AND b2.name = 'gc cr blocks received' AND b1.inst_id = b2.inst_id) c,( -- CPU usage SELECT inst_id, value cpu_used_by_this_session FROM gv$sysstat WHERE name = 'CPU used by this session') sWHERE m.inst_id = c.inst_idAND m.inst_id = s.inst_idORDER BY m.inst_id;
Best Practices
Section titled “Best Practices”-
Regular Monitoring
- Check during peak hours
- Establish baseline performance
- Monitor trends over time
-
Threshold Management
- Set environment-specific alerts
- Account for network hardware differences
- Document performance expectations
-
Proactive Analysis
- Correlate with application performance
- Monitor during maintenance windows
- Track after configuration changes