Author

Topic: [1500 TH] p2pool: Decentralized, DoS-resistant, Hop-Proof pool - page 141. (Read 2591920 times)

newbie
Activity: 10
Merit: 0
Hi dear gurus p2pool.
Please solve the problem.
Antminer S7 batch 1 - low hashrate: ~2200Gh/s

http://s13.postimg.org/9zqcdvaef/p2pool_s7_b1.jpg
sr. member
Activity: 266
Merit: 250
How did you manage to get p2pool running with pypy btw? I tried a while back, but got strange permissions issues on install & errors when running so decided to leave it. Google & reddit searches revealed nothing, & the guide on this thread didn't work for me either. Python is a complete mystery to me..... Tongue

I use Debian for my servers, so I start with:

Code:
sudo apt-get install pypy pypy-dev gcc build-essential

p2pool uses twisted, and twisted uses zope.interface, and in order to install either one you need setuptools, so let's start with that:

Code:
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo pypy
sudo rm setuptools-18.3.2.zip

Then zope.interface:

Code:
wget https://pypi.python.org/packages/source/z/zope.interface/zope.interface-4.1.3.tar.gz#md5=9ae3d24c0c7415deb249dd1a132f0f79
tar zxf zope.interface-4.1.3.tar.gz
cd zope.interface-4.1.3/
sudo pypy setup.py install
cd ..
sudo rm -r zope.interface-4.1.3*

Then Twisted:

Code:
wget https://pypi.python.org/packages/source/T/Twisted/Twisted-15.4.0.tar.bz2
tar jxf Twisted-15.4.0.tar.bz2
cd Twisted-15.4.0
sudo pypy setup.py install
cd ..
sudo rm -r Twisted-15.4.0*

and that should be it.

Keep in mind that pypy uses a ton of RAM. You should expect about 2.5 GB of RAM per pypy-p2pool process. If you have 4 GB of RAM on your server, that will barely be enough to run bitcoind and pypy-p2pool as long as you don't have any GUIs running (no X11, no Gnome, no KDE, no XFCE).

Just to confirm that this worked perfectly for me on Xubuntu 64bit. Testing stable so far  Wink

Many thanks for this jtoomim! - bookmarked  Wink Cheesy
newbie
Activity: 30
Merit: 0
That's a massive trade of 40% less cpu usage but your using 2.5gb of ram wow that is huge but a lot of vps will give you a crap proccessor and loads of ram so it could work for vps users

No, the 40% less CPU usage is due to the code changes and is not due to switching to pypy. You get 40% less CPU usage with the same RAM usage by running the new branch of p2pool (still under testing!) with the regular python 2.7.

If you switch to pypy, you get an unknown reduction in CPU usage for 5x higher RAM usage. I haven't benchmarked the pypy/CPython difference yet. I couldn't notice a benefit before I made the code changes, but I think it might be significant now.

Edit: I'm starting a head-to-head comparison of python vs pypy now. So far, pypy loads shares about 3x faster, taking about 20 seconds instead of 60 seconds on my Core i7 4790k machine.

Edit2: It does not look like there is a big difference in operating CPU usage. I'm not even sure if pypy is any faster than python after the shares have been loaded. I'll let it run for at least half a day before I post any more results.

Ok that makes sense was going to say why has this not being done before hahaha need to pull my finger out and get my server running
hero member
Activity: 818
Merit: 1006
Right, I'm gonna have another go. Were you logged in as root when you done this, or as a normal user?

This is an excellent guide my friend thank you!
The sudo command gives you superuser (root) privileges just for that command. In other words, you can do it as a normal user, as long as that user is allowed to use sudo.
sr. member
Activity: 266
Merit: 250
Would this be the same for Xubuntu?
Probably. You're in a better position to answer that question than I am.

Right, I'm gonna have another go. Were you logged in as root when you done this, or as a normal user?

This is an excellent guide my friend thank you!
hero member
Activity: 818
Merit: 1006
Would this be the same for Xubuntu?
Probably. You're in a better position to answer that question than I am.
sr. member
Activity: 266
Merit: 250
I use Debian for my servers, so I start with:

Code:
sudo apt-get install pypy pypy-dev gcc

Would this be the same for Xubuntu?

Keep in mind that pypy uses a ton of RAM. You should expect about 2.5 GB of RAM per pypy-p2pool process. If you have 4 GB of RAM on your server, that will barely be enough to run bitcoind and pypy-p2pool as long as you don't have any GUIs running (no X11, no Gnome, no KDE, no XFCE).

I have 16GB RAM installed due to the amount of wallets I use, running a stripped down Xubuntu 64bit headless setup - so hopefully I should be OK.
hero member
Activity: 818
Merit: 1006
That's a massive trade of 40% less cpu usage but your using 2.5gb of ram wow that is huge but a lot of vps will give you a crap proccessor and loads of ram so it could work for vps users

No, the 40% less CPU usage is due to the code changes and is not due to switching to pypy. You get 40% less CPU usage with the same RAM usage by running the new branch of p2pool (still under testing!) with the regular python 2.7.

If you switch to pypy, you get an unknown reduction in CPU usage for 5x higher RAM usage. I haven't benchmarked the pypy/CPython difference yet. I couldn't notice a benefit before I made the code changes, but I think it might be significant now.

Edit: I'm starting a head-to-head comparison of python vs pypy now. So far, pypy loads shares about 3x faster, taking about 20 seconds instead of 60 seconds on my Core i7 4790k machine.

Edit2: It does not look like there is a big difference in operating CPU usage. I'm not even sure if pypy is any faster than python after the shares have been loaded. I'll let it run for at least half a day before I post any more results.
newbie
Activity: 30
Merit: 0
That's a massive trade of 40% less cpu usage but your using 2.5gb of ram wow that is huge but a lot of vps will give you a crap proccessor and loads of ram so it could work for vps users
member
Activity: 193
Merit: 10
@jtoomim

Thankyou for the steps to get pypy running p2pool --- worked perfectly.
hero member
Activity: 818
Merit: 1006
How did you manage to get p2pool running with pypy btw? I tried a while back, but got strange permissions issues on install & errors when running so decided to leave it. Google & reddit searches revealed nothing, & the guide on this thread didn't work for me either. Python is a complete mystery to me..... Tongue

I use Debian for my servers, so I start with:

Code:
sudo apt-get install pypy pypy-dev gcc build-essential

p2pool uses twisted, and twisted uses zope.interface, and in order to install either one you need setuptools, so let's start with that:

Code:
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo pypy
sudo rm setuptools-18.3.2.zip

Then zope.interface:

Code:
wget https://pypi.python.org/packages/source/z/zope.interface/zope.interface-4.1.3.tar.gz#md5=9ae3d24c0c7415deb249dd1a132f0f79
tar zxf zope.interface-4.1.3.tar.gz
cd zope.interface-4.1.3/
sudo pypy setup.py install
cd ..
sudo rm -r zope.interface-4.1.3*

Then Twisted:

Code:
wget https://pypi.python.org/packages/source/T/Twisted/Twisted-15.4.0.tar.bz2
tar jxf Twisted-15.4.0.tar.bz2
cd Twisted-15.4.0
sudo pypy setup.py install
cd ..
sudo rm -r Twisted-15.4.0*

and that should be it.

Keep in mind that pypy uses a ton of RAM. You should expect about 2.5 GB of RAM per pypy-p2pool process. If you have 4 GB of RAM on your server, that will barely be enough to run bitcoind and pypy-p2pool as long as you don't have any GUIs running (no X11, no Gnome, no KDE, no XFCE).
sr. member
Activity: 266
Merit: 250

The main branch only includes the BIP101 change and the payout_address web interface change. The performance modification has not been merged into the main branch yet. If you want to test out the performance improvements, you have to use the jtoomim_performance branch, which forrestv is currently testing out.

https://github.com/p2pool/p2pool/tree/jtoomim_performance

git pull
git checkout jtoomim_performance

Edit/note: if you use pypy instead of regular python to run p2pool, the performance benefit is likely to be greater than 40%, since most of the rest of the slowdowns that I've seen would be amenable to pypy acceleration, but the problem I fixed was not. I may do some benchmarks to see if this is true in a while.

Nice work jtoomim!  Grin

How did you manage to get p2pool running with pypy btw? I tried a while back, but got strange permissions issues on install & errors when running so decided to leave it. Google & reddit searches revealed nothing, & the guide on this thread didn't work for me either. Python is a complete mystery to me..... Tongue

Any help/guidance would be very much appreciated  Wink
hero member
Activity: 818
Merit: 1006
saw the update on irc ... thx Wink

here is the link to DL latest commit https://github.com/p2pool/p2pool

updating mine shortly.

The main branch only includes the BIP101 change and the payout_address web interface change. The performance modification has not been merged into the main branch yet. If you want to test out the performance improvements, you have to use the jtoomim_performance branch, which forrestv is currently testing out.

https://github.com/p2pool/p2pool/tree/jtoomim_performance

git pull
git checkout jtoomim_performance

Edit/note: if you use pypy instead of regular python to run p2pool, the performance benefit is likely to be greater than 40%, since most of the rest of the slowdowns that I've seen would be amenable to pypy acceleration, but the problem I fixed was not. I may do some benchmarks to see if this is true in a while.
legendary
Activity: 1500
Merit: 1002
Mine Mine Mine
http://toom.im/files/0001-Performance-fix-added-methods-to-add-or-remove-trans.patch


I've got some changes to the p2pool code that appear to reduce average CPU usage by about 40%, and which will should make a much bigger difference when there is a transaction backlog.

The cause of the performance issue was this: Each time p2pool makes changes to its internal known transaction pool, there are a few tasks to be done, like informing other nodes that it has new (or dropped) transactions. In order to determine which transactions were added or removed, p2pool was taking snapshots of the transaction pool before and after the changes, and comparing them (using set arithmetic) to find the added and removed transactions. This meant that the amount of time it takes to add or remove transactions is dependent on the total number of transactions in the cache. I changed it so that a list of transactions to be added or removed are passed forward from the code that does the modifications, making it unnecessary to recompute that list.

Right now I've got two p2pool nodes running with different ports on a single quad-core i7 4790k machine, both with ~78 TH/s load (SP30s) and 12 peers. Both nodes have been running for 12.7 hours. The old version used 58m49s of CPU time, and the new version used 35m58s.

During the stress tests, a lot of p2pool nodes had severe performance problems that I think were due to the performance cost of running set(known_txs_var) twice for each time a transaction was added or removed. If my diagnosis is correct, this patch should fix that issue.

This version also has the changes needed to use BIP101/BitcoinXT version numbers. I haven't tested this with Bitcoin Core yet, but I think it will report version 3 blocks and shares when used with Core.

Lastly, this version adds a small web interface for querying the payout_address for a share (or block) that NxtChg requested to make implementing cryptoplay.net/vote easier.

saw the update on irc ... thx Wink

here is the link to DL latest commit https://github.com/p2pool/p2pool

updating mine shortly.

whereisblcok ? hungry !!!
hero member
Activity: 818
Merit: 1006
http://toom.im/files/0001-Performance-fix-added-methods-to-add-or-remove-trans.patch


I've got some changes to the p2pool code that appear to reduce average CPU usage by about 40%, and which will should make a much bigger difference when there is a transaction backlog.

The cause of the performance issue was this: Each time p2pool makes changes to its internal known transaction pool, there are a few tasks to be done, like informing other nodes that it has new (or dropped) transactions. In order to determine which transactions were added or removed, p2pool was taking snapshots of the transaction pool before and after the changes, and comparing them (using set arithmetic) to find the added and removed transactions. This meant that the amount of time it takes to add or remove transactions is dependent on the total number of transactions in the cache. I changed it so that a list of transactions to be added or removed are passed forward from the code that does the modifications, making it unnecessary to recompute that list.

Right now I've got two p2pool nodes running with different ports on a single quad-core i7 4790k machine, both with ~78 TH/s load (SP30s) and 12 peers. Both nodes have been running for 12.7 hours. The old version used 58m49s of CPU time, and the new version used 35m58s.

During the stress tests, a lot of p2pool nodes had severe performance problems that I think were due to the performance cost of running set(known_txs_var) twice for each time a transaction was added or removed. If my diagnosis is correct, this patch should fix that issue.

This version also has the changes needed to use BIP101/BitcoinXT version numbers. I haven't tested this with Bitcoin Core yet, but I think it will report version 3 blocks and shares when used with Core.

Lastly, this version adds a small web interface for querying the payout_address for a share (or block) that NxtChg requested to make implementing cryptoplay.net/vote easier.
legendary
Activity: 1500
Merit: 1002
Mine Mine Mine
whereistheblock(s)Huh

hope it runs good again. been away for a bit.
newbie
Activity: 7
Merit: 0

So, on the windows version of p2pool where do the custom UI files for :9332/static go?


I've not used doze for p2pool for quite a while, but as far as I can remember the process is the same:

Backup your webstatic folder

Copy/replace all files into it

Refresh - I don't remember having to restart p2pool, but you might need to clear the cache.

Edit:  **post gone**

Thanks for the reply!  I deleted the post 3 minutes after I posted it, because it was a cache issue! 
sr. member
Activity: 266
Merit: 250

So, on the windows version of p2pool where do the custom UI files for :9332/static go?


I've not used doze for p2pool for quite a while, but as far as I can remember the process is the same:

Backup your webstatic folder

Copy/replace all files into it

Refresh - I don't remember having to restart p2pool, but you might need to clear the cache.

Edit:  **post gone**
hero member
Activity: 818
Merit: 1006
but not tagged as a BIP101 : http://xtnodes.com/p2pool_configuration.php
It was tagged as BIP101. XTnodes.com takes about an hour before it scans new blocks for their version number.
sr. member
Activity: 266
Merit: 250
Wooooohoooooooo got my first p2pool payment today

On your own node? You got it sorted?

No not yet need to send you a pm lol

Got your PM - I'll take a look shortly & let you know  Wink
Jump to: