5 Seconds for Transaction to Complete

+1 vote

I was concurrently running 2 bash scripts (doing the same thing). The script calls sendwithdata via multichain-cli and then let it sleep for 1 second, increment counter (to see how many transactions it has created), repeat. The scripts were running for roughly 6 days. I checked today and noticed that it is now very slow for a transaction to complete. I used time command to get the output and got the result as follows:

time multichain-cli registryv2-rnd sendwithdata 18uEqFhANZs1Ktjd9CeorNShJjcWNn5RddmS4y 0 7B6D6573736167653A202754657374696E67277D
{"method":"sendwithdata","params":["18uEqFhANZs1Ktjd9CeorNShJjcWNn5RddmS4y",0,"7B6D6573736167653A202754657374696E67277D"],"id":1,"chain_name":"registryv2-rnd"}

b759d511d9ebf05cf2053d33ac4b8469018936bbd77961dc8ddb503fa1c35b96

real    0m4.587s
user    0m0.004s
sys     0m0.004s

 

Any insights why it seems to choke? Any optimization that I can do to make it faster again?

Thanks.

asked May 1, 2017 by John_cl

1 Answer

+1 vote
 
Best answer

First I assume you are using a recent version of MultiChain with the fully database-driven wallet. You can check by calling getinfo and seeing if walletdbversion=2.

If so the most likely explanation is that you have a large number of unspent outputs in the wallet, if it is sending transactions back to itself, and (for some reason) unspent outputs cannot be auto-combined. Are both the source and destination addresses tracked by this wallet? And is it possible that the destination address only has receive and not send permissions, in which case it cannot have its unspent outputs auto-combined?

answered May 2, 2017 by MultiChain
selected May 4, 2017 by John_cl
Yes, we are using a recent version of Multichain (alpha 28) and our walletdbversion=2.

Just to give more details about our "load" test:

We have 2 nodes. The 2nd node (non-admin) has another address which has send/receive permission -- this address is the address mentioned above (18uEqFhANZs1Ktjd9CeorNShJjcWNn5RddmS4y). This address is being watched by the 1st node (admin node). 1st node has no other addresses other than the admin and the address that it watches.

We called the command above repeatedly (in 2 separate processes running  simultaneously) from node 1 (effectively from the admin address) to send 0 coins to the address being watched with a metadata {message: 'Testing'}.

So yes, source and destination addresses are being tracked. Destination address has both send and receive.

However, how can I know if it cannot auto-combine the unspent outputs?

Currently, Multichaind in node 1 uses around 500MB RAM while in node 2 it only uses 100MB RAM. I am not sure if this information is going to help.

Thanks
It sounds fairly certain like there is a large number of unspent outputs being tracked, probably by both nodes. If you upgrade to the latest version of MultiChain and call getwalletinfo, you'll see the utxocount field which tells you how many.

Generally if you're using the blockchain for data storage and retrieval rather than asset transfers, you're better off using streams. These create on-chain databases which support many efficient methods of retrieval, and don't inflate unspent transaction output counts.
Okay noted. You are correct. "utxocount" : 176944 which seems huge.

I guess I could conclude that this load testing is a bit wrong. Since we are going to use mostly data storage and retrieval, we should use streams.

Thanks for the insights.
...