Let a node choose how often it re-reads the market - #5
Open
kimminhyun-ai wants to merge 1 commit into
Open
kimminhyun-ai wants to merge 1 commit into
kimminhyun-ai wants to merge 1 commit into
Conversation
`AinLedger.refresh()` reads the entire `/apps/knowledge/market` subtree, so its cost is the size of the catalogue, not the size of what changed. It ran on a hard-coded 8-second timer with no way to change it. One node at eight seconds is nothing. Seventy nodes on one chain is seventy full-tree reads every eight seconds, and that is enough on its own to fill every validator's accept queue until the chain stops answering HTTP — which is how it was found, running seventy parallel training pipelines against a ten-validator chain. The validators were healthy; they were just being asked for the whole catalogue four hundred times a minute. `ledger.ain.pollMs` sets the interval, floored at one second (faster than a block is two reads of the same tree) and capped at an hour. Omitted, the default stays 8000, so nothing changes for an existing node. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019hZqdLKnVfzvRf9mus6NNh
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.
AinLedger.refresh()reads the entire/apps/knowledge/marketsubtree, so its cost is the size of the catalogue, not the size of what changed. It ran on a hard-coded 8-second timer with no way to change it.One node at eight seconds is nothing. Seventy nodes on one chain is seventy full-tree reads every eight seconds, and that is enough on its own to fill every validator's accept queue until the chain stops answering HTTP and stops producing blocks. That is how it was found: seventy parallel training pipelines against a ten-validator chain, with all ten validators healthy and nearly idle between requests, just being asked for the whole catalogue four hundred times a minute.
ledger.ain.pollMssets the interval — floored at one second (polling faster than a block is produced is two reads of the same tree) and capped at an hour. Omitted, the default stays 8000, so an existing node is unchanged.Needs ainblockchain/ainize-node#12 to pass the value through.
🤖 Generated with Claude Code
https://claude.ai/code/session_019hZqdLKnVfzvRf9mus6NNh