Why Are Electrs Address Balance Queries Slow (~900ms) on My Dockerized Bitcoin Full Node?

I’m running a Bitcoin Core full node (bitcoind) and using romanz/electrs (via Docker) to provide Electrum server functionality for querying address balances and related wallet info. However, I’m experiencing unexpectedly high latency: querying the balance for a random address consistently takes around 600-900 ms via btc-rpc-explorer RPC interface. For addresses with an enormous number of transactions, the query can take some seconds instead of ms

This is the docker compose yml file:

services:
  bitcoin_service:
    build:
      context: .
      dockerfile: Bitcoin.Dockerfile
      args:
        BITCOIN_VERSION: ${BTC_VERSION}
    image: bitcoin_full_node
    ports:
      - 8333:8333
      - 8332:8332
    volumes:
      - bitcoin_volume:/home/btc-user/.bitcoin
    networks:
      network:
        ipv4_address: 192.168.1.219
    healthcheck:
      test: [
        "CMD",
        "bitcoin-cli",
        "-rpccookiefile=/home/btc-user/.bitcoin/btc.cookie",
        "-rpcport=8332",
        "-rpcconnect=192.168.1.219",
        "getblockchaininfo"
      ]
      interval: 40s
      timeout: 60s
      retries: 45

  electrs:
    image: electrs:latest
    build:
      context: ./electrs/.
    container_name: electrs
    restart: always
    ports:
      - "50001:50001"    # Electrum TCP port exposed on host and container
    environment:
      - ELECTRS_NETWORK=bitcoin
      - ELECTRS_DAEMON_RPC_ADDR=192.168.1.219:8332
      - ELECTRS_DAEMON_P2P_ADDR=192.168.1.219:8333
      - ELECTRS_ELECTRUM_RPC_ADDR=192.168.1.223:50001
      - ELECTRS_LOG_FILTERS=INFO
      - ELECTRS_DB_DIR=/home/electrs/db
      - ELECTRS_VERBOSE_RPC_LOGS=true
      - ELECTRS_IGNORE_MEMPOOL=true
      - ELECTRS_TIMESTAMP_CACHE_CAPACITY=1000000  # Higher cache for faster lookups
      - ELECTRS_INDEX_LOOKUP_LIMIT=10000
      - ELECTRS_COOKIE_FILE=/home/btc-user/.bitcoin/btc.cookie
      - ELECTRS_THREADS=4
      - ELECTRS_DB_CACHE_SIZE=4096
    volumes:
      - electrs_db:/home/electrs/db
      - bitcoin_volume:/home/btc-user/.bitcoin:ro    # Mount same bitcoin data volume (read-only)
    networks:
      network:
        ipv4_address: 192.168.1.223 # new IP in the same subnet
    healthcheck:
      test: ["CMD-SHELL", "timeout 5 bash -c 'echo > /dev/tcp/192.168.1.223/50001'"]
      interval: 40s
      timeout: 60s
      retries: 45
    depends_on:
      bitcoin_service:
        condition: service_healthy

My Setup:

Bitcoin Core runs as a full node with default (non-pruned) settings.
Electrs runs in Docker with the following environment:
ELECTRS_NETWORK=bitcoin
ELECTRS_DAEMON_RPC_ADDR=192.168.1.219:8332
ELECTRS_DAEMON_P2P_ADDR=192.168.1.219:8333
ELECTRS_ELECTRUM_RPC_ADDR=192.168.1.223:50001
ELECTRS_DB_DIR=/home/electrs/db
ELECTRS_TIMESTAMP_CACHE_CAPACITY=1000000
ELECTRS_INDEX_LOOKUP_LIMIT=10000
ELECTRS_THREADS=4
ELECTRS_DB_CACHE_SIZE=4096
Volumes: bitcoin data (read-only) and electrs DB (persistent)
Docker container has 4 threads and 4GB cache configured

Electrs and bitcoind are on the same local network. Problem: Despite this setup, querying a single, random address balance via Electrs takes about 900ms. This seems slow compared to other Electrum servers and my expectations for local, SSD-backed infrastructure.

Hardware Specs:

  • CPU: AMD Ryzen 5 5600 3.5 GHz 6-Core Processor
  • RAM: 16 GB (2 x 8GB) DDR4-3200
  • Storage: Western Digital Blue SN580 2TB NVMe M.2 SSD (PCIe 4.0 x4)
  • Motherboard: Gigabyte A520M K V2 Micro ATX AM4
  • Network: 1GPS Download speed

Questions:

  • Is this latency typical for Electrs on a Dockerized full node?
  • Are there further optimizations I can make in my Docker or Electrs configuration to reduce balance query times?
  • Is there any known bottleneck, either in RocksDB, disk I/O, or Docker networking, that might cause this?
  • What are the typical response times others see for similar setups?

Any insights or tuning suggestions from the community would be greatly appreciated!

Thank you!



from Recent Questions - Bitcoin Stack Exchange https://ift.tt/mJ6t5IV
via IFTTT

Popular posts from this blog

Bitcoin Mining Could Be Strengthening The Ruble, Russian Central Bank Says

Crypto Exec Warns Tokenization Is Moving Faster Than Expected

Bitwise Clients Pour $69M Into Solana as Bulls Fight to Reclaim $200 Resistance Zone