Skip to content

fix: optimize Firo node config for memory-constrained VM#3302

Open
bernd2022 wants to merge 1 commit intodevelopfrom
fix/firo-node-memory-optimization
Open

fix: optimize Firo node config for memory-constrained VM#3302
bernd2022 wants to merge 1 commit intodevelopfrom
fix/firo-node-memory-optimization

Conversation

@bernd2022
Copy link
Collaborator

Summary

  • Optimize Firo node configuration to prevent swap thrashing on 3.8GB Azure VM running 5 blockchain containers
  • Node was freezing due to memory pressure causing lock starvation (peak usage 2.27GB with old config)
  • After optimization: stable at ~1.2GB, startup in ~4 minutes, node healthy

Changes

firo.conf

  • dbcache: 512 → 256 MB (reduced UTXO cache)
  • maxmempool: 300 → 100 MB (limit mempool memory)
  • mempoolexpiry: 72 → 24 hours (faster cleanup)
  • maxorphantx: 100 → 10 (reduce cs_main lock hold time during Spark tx validation)
  • rpcworkqueue: 32 → 64 (more buffer before HTTP 500 rejection)
  • Per-connection send/receive buffers reduced

docker-compose-firo.yml

  • Add Docker memory limit (2048M) and reservation (1024M)
  • Healthcheck: getblockcount instead of getblockchaininfo (lighter RPC call)
  • Healthcheck interval: 30s → 120s (prevent RPC thread exhaustion)
  • Healthcheck timeout: 60s → 10s, retries: 10 → 3

Test plan

  • Deployed to dfx-out-dev, node running stable and healthy
  • Full sync achieved (progress=1.000000)
  • Memory usage stable at ~1.2GB / 2GB limit (58%)
  • Monitor stability over next days

Reduce memory footprint to prevent swap thrashing on 3.8GB VM
running 5 blockchain containers:

firo.conf:
- dbcache: 512 → 256 MB (saves ~256 MB)
- maxmempool: 300 → 100 MB (saves ~200 MB)
- mempoolexpiry: 72 → 24 hours
- maxorphantx: 100 → 10 (reduces cs_main lock hold time)
- rpcworkqueue: 32 → 64 (more buffer before RPC rejection)
- maxsendbuffer/maxreceivebuffer: reduced per-connection buffers

docker-compose-firo.yml:
- Add 2048M memory limit / 1024M reservation
- Healthcheck: getblockcount instead of getblockchaininfo (lighter)
- Healthcheck interval: 30s → 120s, timeout: 60s → 10s, retries: 10 → 3
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