Skip to content

INFO Command Optimization and INFO.SHARD Introduction - #42153

Merged
mattklein123 merged 9 commits into
envoyproxy:mainfrom
dinesh-murugiah:clusterscope_commands_addition
Dec 8, 2025
Merged

mattklein123 merged 9 commits into
envoyproxy:mainfrom
dinesh-murugiah:clusterscope_commands_addition

Conversation

@dinesh-murugiah

@dinesh-murugiah dinesh-murugiah commented Nov 20, 2025 •

Copy link
Copy Markdown
Contributor

INFO Command Optimisation and INFO.SHARD Introduction

Problem Statement

The previous implementation of the INFO command collected responses from ALL shards and concatenated them into a single massive response. This approach had several critical issues:

Network Overhead: Clients using INFO for health checks (e.g., Spring Data Redis) received unnecessarily large responses, wasting network bandwidth

Memory Pressure: Large concatenated responses consumed excessive buffer space, especially in clusters with many shards

Performance Impact: Health check operations became expensive, affecting overall system responsiveness
Poor Scalability: The problem worsened as cluster size increased

Solution:

We've redesigned the INFO command implementation by splitting it into two distinct commands:

1. INFO Command (Cluster-Scope with Aggregation)

Purpose: Provides a concise, consolidated view of the entire cluster

Behaviour: Aggregates metrics across all shards intelligently using different strategies (Sum, Max, First, etc.)
Returns a single, compact response representing cluster-wide statistics
Supports optional section parameter: [INFO [section]]to filter output (e.g., INFO server, INFO stats)

Benefits: Minimal network bandwidth, efficient health checking, consolidated cluster view, Ideal for health checks and monitoring dashboards

2. INFO.SHARD Command (Single-Shard Query)

Purpose: Retrieves complete INFO metrics from a specific shard

Syntax: [INFO.SHARD <shard_id> [section]]
[shard_id]: Numeric shard index (0, 1, 2, ...)
[section]: Optional parameter to filter by section (e.g., server, memory, stats)

Behavior: Queries only the specified shard and returns its full INFO response

Use Cases:
Debugging individual shard issues
Detailed shard-level diagnostics
Troubleshooting performance problems on specific shards

Benefits: Targeted queries, no bandwidth waste, precise debugging capability

Technical Implementation

Core Changes

Aggregation Handler (InfoCmdAggregateResponseHandler)

Implements metric aggregation strategies (Sum, Max, First, Constant, Custom)
Handles section filtering for efficient response generation
Provides consolidated cluster metrics

Single-Shard Handler ([ShardInfoRequest]

Routes INFO command to a specific shard by index
Validates shard_id (numeric, within range)
Transforms [INFO.SHARD [section]] → [INFO [section]] sent to target shard

Command Registration

Added info.shard to supported commands list
Registered INFO as cluster-scope command for aggregation
Updated command splitter routing logic

Files Modified

command_splitter_impl.cc/h: Added ShardInfoRequest handler and INFO aggregation
cluster_response_handler.cc/h: Implemented InfoCmdAggregateResponseHandler with metric aggregation
[supported_commands.cc/h]: Registered new commands
[command_splitter_impl_test.cc]: Added comprehensive test suites

Impact
Reduced network bandwidth for health checks (from N-shard concatenated response to single aggregated response)
Improved client performance (Spring Data Redis and similar frameworks)
Better scalability (overhead doesn't grow linearly with cluster size)
Enhanced debugging capability (INFO.SHARD for targeted diagnostics)
Backward compatible (existing INFO behavior replaced with smarter aggregation)

Risk Level: LOW

Testing:
Test Coverage
InfoShardHandlerTest: 7 comprehensive test cases covering validation, routing, error handling
ClusterScopeInfoTest: 8 test cases covering aggregation types, section filtering, error scenarios
All tests passing

Docs Changes:
redis.rst
current.yaml

Release Notes:
NA

@dinesh-murugiah

Copy link
Copy Markdown
Contributor Author

@mattklein123 @yanavlasov Request review

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks leaving some comments from a first skim.

/wait

Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
@dinesh-murugiah
dinesh-murugiah force-pushed the clusterscope_commands_addition branch from 91b3a9c to c4daad0 Compare December 2, 2025 12:53
@dinesh-murugiah

Copy link
Copy Markdown
Contributor Author

@mattklein123 sorry for the delay , my laptop got broken , took some to setup back and continue
i have addressed your review comments , please have a look

Signed-off-by: dinesh-murugiah <[email protected]>
@dinesh-murugiah
dinesh-murugiah force-pushed the clusterscope_commands_addition branch from 8cd05c8 to 41d06a2 Compare December 2, 2025 14:31
@dinesh-murugiah

Copy link
Copy Markdown
Contributor Author

@mattklein123 kind reminder

@mattklein123
mattklein123 merged commit 84c8402 into envoyproxy:main Dec 8, 2025
grnmeira pushed a commit to grnmeira/envoy that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants