I noticed that fetching blocks over the bitcoin protocol is slow in my setting.
My node is in my local network which have over 100MB speed with my dev computer.
I find no way of making it better, and I'd like your advice, here is my finding:
- Average Speed Achieved : 5MB/s
- Max speed Achieved (ponctual) : 15MB/s
- Fetch strategy : getdata of 50 000 blocks, Tip to Genesis
- Client's socket receive buffer is never full (indicate bitcoind does not send fast enough)
- Disk IO and CPU not capped
- When the rcv buffer of the client is empty, it takes 100ms with low variance before new data come
- Using 2 connections instead of one for fetching blocks speed things up a little bit (7.5MB/s average)
I tried to play with receive and send buffer on both the bitcoind and the client code, no effect.
I noticed that the 100ms time it take for my buffer to be filled again must come from
ThreadMessageHandler.
However by reviewing the code, I have seen no mistake : if the send buffer of the bitcoin node is not full, I should not experience any 100ms delay.
Once again, trying to change the buffers size of bitcoind had no effect.
Any idea ?
My alternative is to parse the blk directory over SMB, which go near 75MB/S.
But this is a fragile solution I'd like to avoid.