Skip to content

Let a node choose how often it re-reads the market - #5

Open
kimminhyun-ai wants to merge 1 commit into
mainfrom
feat/configurable-ledger-poll
Open

kimminhyun-ai wants to merge 1 commit into
mainfrom
feat/configurable-ledger-poll

Conversation

@kimminhyun-ai

Copy link
Copy Markdown
Contributor

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 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.pollMs sets 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

`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
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.

1 participant