Title: Bitcoin rpc gradually slows down Post by: linuxqq on April 17, 2021, 08:18:59 AM I use python3 to call the getrawtransaction interface of bitcoin rpc. Why does the query return time take longer and longer? The system load and disk IO are not too high load。
Title: Re: Bitcoin rpc gradually slows down Post by: NotATether on April 17, 2021, 08:30:09 AM Exactly how long are we talking in terms of seconds, and how much more does your waiting time increase? Do you have -txindex on and you're trying to get a block transaction? I never heard of that directly causing a slow response but it's understandable if the block it's inside hasn't been processed by Core yet.
If you're trying to get a mempool transaction from your node, it might be because your node doesn't have the transaction locally (?) Title: Re: Bitcoin rpc gradually slows down Post by: linuxqq on April 17, 2021, 08:41:23 AM Code:
I try to keep querying the transactions of some blocks, but the time return time will gradually return from 6 seconds to 30 seconds, getting slower and slower Title: Re: Bitcoin rpc gradually slows down Post by: HCP on April 17, 2021, 11:46:02 PM Does the return time increase if you request the same block over and over? or is it increasing for a specific "set" of blocks?
If there is a particular block or blocks where it always takes a long time, have you checked those blocks manually to see if there are any attributes of the blocks that might cause the slowdown? ie. transactions with large number of outputs or transactions with large number of inputs etc. it's also possible that your node is throttling your RPC connection because you're making repeated calls to getrawtransaction... I've never experienced that myself, but I've never had a script that has the potential to make repeated calls over and over either. Title: Re: Bitcoin rpc gradually slows down Post by: nc50lc on April 18, 2021, 04:02:32 AM I try to keep querying the transactions of some blocks, but the time return time will gradually return from 6 seconds to 30 seconds, getting slower and slower Are you looking at some specific blocks? If there's only a few, you should get their blockhash and use that as an additional parameter for getrawtransaction.That should speed things up. https://bitcoincore.org/en/doc/0.21.0/rpc/rawtransactions/getrawtransaction/ (https://bitcoincore.org/en/doc/0.21.0/rpc/rawtransactions/getrawtransaction/) |