getBalance the cpu will hit 100% #16074

issue peterPengDev openend this issue on May 22, 2019
  1. peterPengDev commented at 10:14 am on May 22, 2019: none

    I am using v0.17.1 I got about 60,000 accounts, when I call get balance , the CPU will hit 100%, and slow down the whole server.

    Thanks for your time

  2. MarcoFalke commented at 11:11 am on May 22, 2019: member

    Accounts have been removed from Bitcoin Core. However, I doubt that accounts itself influence the run time cost of getbalance, but rather the number of txs does. Also, the wallet should cache the result for each tx, so that the calculation would only happen once and later calls would only iterate all txs.

    We don’t patch old releases for performance improvements, so could you try to reproduce this with 0.18.0 or master? Alternatively, share the approximate number of txs, if they involve watchonly addresses, and the average number of inputs/outputs of those txs. Thanks

  3. MarcoFalke added the label Resource usage on May 22, 2019
  4. MarcoFalke added the label Wallet on May 22, 2019
  5. pstratem commented at 12:49 pm on June 6, 2019: contributor

    The getbalance RPC iterates over mapWallet, which contains every transaction in the wallet.

    If there are lots of transactions then it’s going to be slow.

  6. MarcoFalke closed this on Apr 26, 2020

  7. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-31 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me