Understanding Chain Head Latency
Maintaining low latency at the chain head is crucial for ensuring timely data updates in your indexed data. This page explains how HyperSync handles this important aspect of blockchain indexing.
HyperSync Block Retrieval
- Efficient Processing: We pull new blocks from HyperSync using a highly efficient process, ensuring your indexer stays up-to-date with minimal delay.
- Reliable Operation: This process typically runs smoothly without significant issues.
- RPC Fallback: On a chain HyperSync supports, an
rpcentry withoutfordefaults tofor: fallbackand takes over if HyperSync fails or stops reporting new blocks. See RPC Sync.
Reduce Head Latency
These settings live on the chain in config.yaml:
- Follow the head with your own RPC: add an RPC with
for: realtime. HyperIndex uses HyperSync for historical sync, then switches to this RPC once caught up. - Stream new blocks over WebSocket: set
wson that RPC to receive new block heights througheth_subscribe("newHeads")instead of HTTP polling.urlstays anhttp(s)://URL and serves every other request. WebSocket support is experimental. - Poll more often: while no WebSocket is connected,
polling_interval(ms, default1000) sets how often the RPC is checked for new blocks. Keep it at or below the chain's block time; a higher value doesn't reduce RPC usage, because every block is still fetched to check for reorgs. - Don't add deliberate delay:
block_lag(stay N blocks behind the head) andblock_throttle(wait for N new blocks before fetching) both default to0. Any value above0adds up to that many blocks of latency, so leave them unset unless you need them.
chains:
- id: 1
start_block: 0
rpc:
- url: ${ENVIO_RPC_URL}
ws: ${ENVIO_WS_URL}
for: realtime
polling_interval: 500 # HTTP polling cadence while no WebSocket is connected
Chain-Specific Performance
Optimized Major Chains
- Priority Chains: We've dedicated significant resources to maintaining extremely low latency on popular chains including Ethereum, Optimism, and Arbitrum.
- User Experience: Users should experience seamless, near real-time data updates on these chains.
Smaller Chains
- Standard Performance: On smaller chains, latency might be slightly higher as they have received less optimization.
- Improvement Process: Your feedback helps us prioritize which chains to optimize next. Please let us know in Discord if low latency on specific smaller chains is important for your use case.
Special Configuration Options
Multi-Chain Indexing
- Unordered Event Ordering: For applications indexing multiple chains, HyperIndex always processes events in unordered mode, so each chain keeps syncing independently - there is nothing to configure.
- Resilient Design: With this configuration, even if one chain experiences latency, your other chains will continue syncing normally.
Chain Reorganization Support
- Reorg Handling: Our reorg support system ensures data consistency even when chains reorganize.
- Documentation: See Reorg Support.
block_lagkeeps the indexer N blocks behind the head to avoid reorgs, trading latency for safety.
Envio Cloud Performance
Envio Cloud offers reliable performance with ongoing improvements:
- Continuous Enhancement: We're actively improving sync and build times on Envio Cloud.
- Relative Performance: Currently, indexers may run slightly slower on Envio Cloud compared to high-performance local machines.
- Enterprise Solutions: For applications requiring exceptional performance, contact us on Discord to discuss our enterprise hosting plans.
By leveraging these features and providing feedback on your specific needs, you can help us continually improve the HyperIndex head latency performance.