agent: reduce full config check frequency from 5s to 1m and compare config hashes instead#3028
Draft
agent: reduce full config check frequency from 5s to 1m and compare config hashes instead#3028
Conversation
7260b33 to
e81a21e
Compare
Contributor
Author
BEFORE: Simple polling every 5 secondsAFTER: Hash-based polling (5s hash check, 5m full config fetch) |
eb5c5c5 to
e9af3ae
Compare
…ture docs Extract config generation logic into reusable functions: - generateConfig() - renders device config with deduplication - processConfigRequest() - validates request and finds unknown BGP peers This refactoring prepares for adding GetConfigHash endpoint that will share the same config generation logic. Also add architecture documentation with sequence diagram showing agent-controller communication flow.
…ange detection Add new GetConfigHash RPC that returns only the SHA256 hash of the device configuration (64 bytes) instead of the full config (~50KB). This enables agents to efficiently check for config changes without transferring the full configuration on every poll. Changes: - Add GetConfigHash RPC to controller.proto - Implement GetConfigHash() handler that reuses processConfigRequest() - Add controller_grpc_getconfighash_requests_total metric - Regenerate protobuf code
e9af3ae to
6fa1ee4
Compare
…meout Replace aggressive 5-second full config polling with hash-based change detection. The agent now: - Checks config hash every 5 seconds (64 bytes) - Only fetches and applies full config when hash changes - Forces full config check after timeout (default 60s) as safety net This dramatically reduces: - Network bandwidth (99%+ when config unchanged) - EOS device load (no config application when unchanged) - Agent CPU (hash computed only when fetching new config) Add --config-cache-timeout-in-seconds flag to control the forced full config check interval. Refactor main loop: - Split pollControllerAndConfigureDevice into focused functions - Add computeChecksum() helper for SHA256 hashing - Add fetchConfigFromController() to get config and compute hash - Add applyConfig() to apply config to EOS device - Rename variables: cachedConfigHash, configCacheTime, configCacheTimeout Add GetConfigHashFromServer() client function to call new gRPC endpoint.
6fa1ee4 to
2ab7f72
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Controller
Agent
Testing Verification