Pages:
Author

Topic: [20 BTC] Multithreaded Keep-alive Implementation in Bitcoind (Read 31453 times)

vip
Activity: 302
Merit: 253
For anyone that still wants to use this for the 0.6.0 release, I've made some patches with slight modifications to David's code.  It's split up into two parts.  The first part should still be relevant for pool operators (keep-alive connections, hub mode, USR1 signals on block changes).  The second part is mostly obsolete now with merged mining and better pooling software (faster getwork).

You can find the patches at http://pastebin.com/viJV1NLi and http://pastebin.com/UXep0r3c

Some of the updates from 0.4 to 0.6 are non-trivial so this should help.  This particular patch hasn't been tested much but a different one for 0.6.0 rc4 has been running without any problems.

Edit: Oops, the patches were for the current head instead of 0.6.0.
Edit2: Updated the above links for the right patches.

For future reference, these may give you a head start on patching against 0.6.1: http://pastebin.com/XSBqRAaP and http://pastebin.com/5R9N29aA.
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
Joel, thanks so much for all of your hard work. I'm glad to see many of your changes have been mainlined Cheesy
Thanks. I've been completely swamped with Real Work (TM) lately or I would have merged the remaining changes into the 0.5 branch.
member
Activity: 111
Merit: 10
★Trash&Burn [TBC/TXB]★
Some observations on the http://davids.webmaster.com/~davids/bitcoin-4diff-beta.txt patch.

bitcoind v0.4.0 + 4diff-beta seems to use about 5% more CPU and 3% less memory when compared to bitcoind v0.3.24 + 4diff.

Other than that, v0.4.0 has been stable for almost a week in a live environment. ( And a week before that on testnet.) We have some private 0.3.24 based pools that have been taking a stable 50+ Ghash for 5 months without a restart. I assume that will be the case with v0.4.0 Cheesy

We though about messing with the .5 branch + Joel's patch. However, with the rapid release schedule of late and massive changes coming with the 0.6 release of bitcoin. We decided to hold off until .6 is stable before upgrading again.


Joel, thanks so much for all of your hard work. I'm glad to see many of your changes have been mainlined Cheesy
member
Activity: 111
Merit: 10
★Trash&Burn [TBC/TXB]★
Results when attempting to apply bitcoin-4diff-5beta.txt to bitcoin v0.5.1:

Quote
patching file orig/bitcoinrpc.cpp
Hunk #3 succeeded at 52 (offset 2 lines).
Hunk #4 succeeded at 1610 (offset -4 lines).
Hunk #5 succeeded at 1640 (offset -4 lines).
Hunk #6 succeeded at 1660 (offset -4 lines).
Hunk #7 succeeded at 1974 (offset -4 lines).
Hunk #8 succeeded at 2003 (offset -4 lines).
Hunk #9 succeeded at 2012 (offset -4 lines).
Hunk #10 succeeded at 2026 (offset -4 lines).
Hunk #11 succeeded at 2064 (offset -4 lines).
Hunk #12 succeeded at 2080 (offset -4 lines).
Hunk #13 FAILED at 2109.
Hunk #14 succeeded at 2142 (offset -9 lines).
Hunk #15 succeeded at 2210 (offset -9 lines).
Hunk #16 succeeded at 2310 (offset -6 lines).
Hunk #17 succeeded at 2375 (offset -6 lines).
Hunk #18 succeeded at 2421 (offset -6 lines).
Hunk #19 succeeded at 2430 (offset -6 lines).
Hunk #20 succeeded at 2481 (offset -6 lines).
Hunk #21 succeeded at 2514 (offset -6 lines).
Hunk #22 succeeded at 2542 (offset -6 lines).
1 out of 22 hunks FAILED -- saving rejects to file orig/bitcoinrpc.cpp.rej
patching file orig/init.cpp
Hunk #1 FAILED at 189.
Hunk #2 succeeded at 222 (offset 11 lines).
Hunk #3 succeeded at 258 (offset 11 lines).
1 out of 3 hunks FAILED -- saving rejects to file orig/init.cpp.rej
patching file orig/main.cpp
Hunk #1 succeeded at 1149 (offset 20 lines).
Hunk #2 succeeded at 1192 (offset 20 lines).
Hunk #3 succeeded at 1206 (offset 20 lines).
patching file orig/net.cpp
Hunk #2 succeeded at 82 (offset 1 line).
Hunk #3 succeeded at 99 (offset 1 line).
Hunk #4 succeeded at 977 (offset 1 line).
Hunk #5 succeeded at 1007 (offset 1 line).
Hunk #6 succeeded at 1046 (offset 1 line).
Hunk #7 succeeded at 1108 (offset 1 line).
Hunk #8 succeeded at 1146 (offset 1 line).
Hunk #9 succeeded at 1415 (offset 42 lines).
Hunk #10 succeeded at 1449 (offset 42 lines).
Hunk #11 succeeded at 1515 (offset 42 lines).
Hunk #12 succeeded at 1522 (offset 42 lines).
Hunk #13 succeeded at 1554 (offset 42 lines).
Hunk #14 succeeded at 1572 (offset 42 lines).
Hunk #15 succeeded at 1630 (offset 42 lines).
Hunk #6 succeeded at 1046 (offset 1 line).
Hunk #7 succeeded at 1108 (offset 1 line).
Hunk #8 succeeded at 1146 (offset 1 line).
Hunk #9 succeeded at 1415 (offset 42 lines).
Hunk #10 succeeded at 1449 (offset 42 lines).
Hunk #11 succeeded at 1515 (offset 42 lines).
Hunk #12 succeeded at 1522 (offset 42 lines).
Hunk #13 succeeded at 1554 (offset 42 lines).
Hunk #14 succeeded at 1572 (offset 42 lines).
Hunk #15 succeeded at 1630 (offset 42 lines).
Hunk #16 succeeded at 1654 (offset 42 lines).
Hunk #17 succeeded at 1706 (offset 42 lines).
Hunk #18 succeeded at 1718 (offset 42 lines).
Hunk #19 succeeded at 1746 (offset 42 lines).
Hunk #20 succeeded at 1953 (offset 48 lines).
Hunk #21 succeeded at 1968 with fuzz 2 (offset 48 lines).
patching file orig/net.h
Hunk #2 succeeded at 79 (offset -1 lines).
Hunk #3 succeeded at 123 (offset -1 lines).
Hunk #4 succeeded at 185 (offset -1 lines).
patching file orig/util.cpp
patching file orig/util.h
Hunk #4 succeeded at 710 (offset 10 lines).

You'll need to do the diffs in bitcoinrpc.cpp.rej and init.cpp.rej by hand.
- means remove this line.
+ means add this line.
no sign is a reference point ( leave line alone)

have fun Smiley
c_k
donator
Activity: 242
Merit: 100
Results when attempting to apply bitcoin-4diff-5beta.txt to bitcoin v0.5.1:

Quote
patching file orig/bitcoinrpc.cpp
Hunk #3 succeeded at 52 (offset 2 lines).
Hunk #4 succeeded at 1610 (offset -4 lines).
Hunk #5 succeeded at 1640 (offset -4 lines).
Hunk #6 succeeded at 1660 (offset -4 lines).
Hunk #7 succeeded at 1974 (offset -4 lines).
Hunk #8 succeeded at 2003 (offset -4 lines).
Hunk #9 succeeded at 2012 (offset -4 lines).
Hunk #10 succeeded at 2026 (offset -4 lines).
Hunk #11 succeeded at 2064 (offset -4 lines).
Hunk #12 succeeded at 2080 (offset -4 lines).
Hunk #13 FAILED at 2109.
Hunk #14 succeeded at 2142 (offset -9 lines).
Hunk #15 succeeded at 2210 (offset -9 lines).
Hunk #16 succeeded at 2310 (offset -6 lines).
Hunk #17 succeeded at 2375 (offset -6 lines).
Hunk #18 succeeded at 2421 (offset -6 lines).
Hunk #19 succeeded at 2430 (offset -6 lines).
Hunk #20 succeeded at 2481 (offset -6 lines).
Hunk #21 succeeded at 2514 (offset -6 lines).
Hunk #22 succeeded at 2542 (offset -6 lines).
1 out of 22 hunks FAILED -- saving rejects to file orig/bitcoinrpc.cpp.rej
patching file orig/init.cpp
Hunk #1 FAILED at 189.
Hunk #2 succeeded at 222 (offset 11 lines).
Hunk #3 succeeded at 258 (offset 11 lines).
1 out of 3 hunks FAILED -- saving rejects to file orig/init.cpp.rej
patching file orig/main.cpp
Hunk #1 succeeded at 1149 (offset 20 lines).
Hunk #2 succeeded at 1192 (offset 20 lines).
Hunk #3 succeeded at 1206 (offset 20 lines).
patching file orig/net.cpp
Hunk #2 succeeded at 82 (offset 1 line).
Hunk #3 succeeded at 99 (offset 1 line).
Hunk #4 succeeded at 977 (offset 1 line).
Hunk #5 succeeded at 1007 (offset 1 line).
Hunk #6 succeeded at 1046 (offset 1 line).
Hunk #7 succeeded at 1108 (offset 1 line).
Hunk #8 succeeded at 1146 (offset 1 line).
Hunk #9 succeeded at 1415 (offset 42 lines).
Hunk #10 succeeded at 1449 (offset 42 lines).
Hunk #11 succeeded at 1515 (offset 42 lines).
Hunk #12 succeeded at 1522 (offset 42 lines).
Hunk #13 succeeded at 1554 (offset 42 lines).
Hunk #14 succeeded at 1572 (offset 42 lines).
Hunk #15 succeeded at 1630 (offset 42 lines).
Hunk #6 succeeded at 1046 (offset 1 line).
Hunk #7 succeeded at 1108 (offset 1 line).
Hunk #8 succeeded at 1146 (offset 1 line).
Hunk #9 succeeded at 1415 (offset 42 lines).
Hunk #10 succeeded at 1449 (offset 42 lines).
Hunk #11 succeeded at 1515 (offset 42 lines).
Hunk #12 succeeded at 1522 (offset 42 lines).
Hunk #13 succeeded at 1554 (offset 42 lines).
Hunk #14 succeeded at 1572 (offset 42 lines).
Hunk #15 succeeded at 1630 (offset 42 lines).
Hunk #16 succeeded at 1654 (offset 42 lines).
Hunk #17 succeeded at 1706 (offset 42 lines).
Hunk #18 succeeded at 1718 (offset 42 lines).
Hunk #19 succeeded at 1746 (offset 42 lines).
Hunk #20 succeeded at 1953 (offset 48 lines).
Hunk #21 succeeded at 1968 with fuzz 2 (offset 48 lines).
patching file orig/net.h
Hunk #2 succeeded at 79 (offset -1 lines).
Hunk #3 succeeded at 123 (offset -1 lines).
Hunk #4 succeeded at 185 (offset -1 lines).
patching file orig/util.cpp
patching file orig/util.h
Hunk #4 succeeded at 710 (offset 10 lines).
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
Hi David,

What are your thoughts on the final 0.5.0 release?
Unfortunately, I've been completely swamped with work lately, and I haven't had a chance to look at it yet.
c_k
donator
Activity: 242
Merit: 100
http://davids.webmaster.com/~davids/bitcoin-4diff-5beta.txt

This is a "first working version". It patches cleanly, compiles, and passes my basic functional tests.

Quite a few of my optimizations were already made. Yay!

I guess I'll have to start working on some new ones.


Hi David,

What are your thoughts on the final 0.5.0 release?
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
http://davids.webmaster.com/~davids/bitcoin-4diff-5beta.txt

This is a "first working version". It patches cleanly, compiles, and passes my basic functional tests.

Quite a few of my optimizations were already made. Yay!

I guess I'll have to start working on some new ones.
hero member
Activity: 560
Merit: 501
watching this
newbie
Activity: 14
Merit: 0
I'll try to find time to work on it in the next few days. It's hard to refuse a request from someone with perfect hair.
I'm flattered!

Thanks.
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
Quote from: JoelKatz
awesomeness
Is there one in the pipeline for 0.5? The RPC changes are a little too much for me to handle.
I'll try to find time to work on it in the next few days. It's hard to refuse a request from someone with perfect hair.
newbie
Activity: 14
Merit: 0
Quote from: JoelKatz
awesomeness
Is there one in the pipeline for 0.5? The RPC changes are a little too much for me to handle.
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
Have anyone tested out the 0.4 beta patch successfully?
Any comparison with the 0.32 patch?

I'm thinking of setting up a new environment with poolserverj + 0.4.
Several people have been using it for two weeks or more, and I haven't received any issue reports yet.
sr. member
Activity: 403
Merit: 250
...
Hi. Do you have plans for bitcoin v0.4? Smiley Current patches are incompatible with it because of some changes in RPC. Sad
http://davids.webmaster.com/~davids/bitcoin-4diff-beta.txt

Hi!

Have anyone tested out the 0.4 beta patch successfully?
Any comparison with the 0.32 patch?

I'm thinking of setting up a new environment with poolserverj + 0.4.
legendary
Activity: 3108
Merit: 1359
It works great. 80% CPU usage & disconnects ==> 10-15% & rock stable.  Smiley
legendary
Activity: 3108
Merit: 1359
...
Hi. Do you have plans for bitcoin v0.4? Smiley Current patches are incompatible with it because of some changes in RPC. Sad
http://davids.webmaster.com/~davids/bitcoin-4diff-beta.txt
Thanks. I'll try test this today and write the report here.

// /me tried to implement support for 0.4 yesterday, but faced with stability problems.
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
legendary
Activity: 3108
Merit: 1359
...
Hi. Do you have plans for bitcoin v0.4? Smiley Current patches are incompatible with it because of some changes in RPC. Sad
legendary
Activity: 1596
Merit: 1012
Democracy is vulnerable to a 51% attack.
I remember specifically thinking, when I placed the code, that the code held a lock that wouldn't let the 'getwork' code run until it was safe anyway. But then I looked back after I got the patch from Giel, and I couldn't figure out what I saw that justified that belief.
newbie
Activity: 29
Merit: 0
Hi

I tested the native long polling patch and noticed that it fired the signal so early that pushpoold got the old block and not the new one. So it seems you have it fixed now.

I also moved the patch to the end of the function and I never saw the problem again.

Denis

PS: I couldn't write here because my account was not activated until now
Pages:
Jump to: