5
I'm building a node.js app that uses a json-rpc connection to fetch information from the bitcoin daemon.
It works great, except every once in a while, the RPC connection "fails." It goes down for anywhere from 1-20 seconds. Querying it via the command line gives the response: error: couldn't connect to server. I have built in an error handling mechanism that waits a progressively larger amount of time for each unsuccessful connection, and it works well.
My problem, is over the course of progressively scanning the blockchain, over half of the running time is spent waiting for the daemon to come alive.
My thought was maybe its my hard drive/something with my computer, so I moved it to an ec2 instance (specifically c3.2xl) and moved the blockchain to the SSD. This actually increased the amount of time waiting versus running the node app locally.
Has anyone experienced this before and came up with a solution?
How many addresses does your client handle? Do you scan the blockchain through the RPC API? If you do I would suggest you take a look at this article: http://www.codeproject.com/Articles/784519/NBitcoin-How-to-scan-the-Blockchain
– George Kimionis – 2014-06-24T00:56:19.180That is a great analysis, unfortunately, I'm dealing with live data so stopping the daemon to safely use the blockchain files is not an option. – Nathan – 2014-06-24T01:03:00.613
Have you changed some config in
.bitcoin/bitcoin.conf? Have you tried tweaking the-paroption? – Jozef – 2014-06-24T13:05:08.4302You're probably running out of local TCP ports. You need to reuse your RPC connections rather than sending each RPC request over its own connection. – David Schwartz – 2014-10-22T18:35:43.150