[ATT: POOL OPS] PoolServerJ - scalable java pool backend

shads
Posts: 26
Joined: Sun Jul 31, 2011 6:36 am
os: linux

[ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by shads »

Please excuse the blatant copy and paste from the bitcoin forum. Everything I've said there is relevant to namecoid as well. I haven't had a chance to test with namecoind as yet but I don't think there's any reason PoolServerJ shouldn't be compatible...

As a necessary component to a larger project I've had to write a complete pool server in java. The rest of the project is still in progress but the pool server is ready to release into beta. The key problem I needed to solve and part of the reason I rolled my own rather than just using pushpoold is scalability. Pushpoold is great at what it does but the difference I needed was to get around the namecoind bottleneck. PoolServerJ solves that problem rather neatly by caching work and also allowing the pool operator to run as many namecoin daemons as they want to and feed them all into the poolserver.

A few of the features of PoolServerJ:

* Work caching – caches work from bitcoind to handle short term spikes in requests
* DoS resilience with QoS support to ensure workers who’ve submitted valid work are serviced with priority
* Capable of pulling work from multiple bitcoin daemons to get around the getwork bottleneck and also to provide some redundancy
* Notify of block change via HTTP to a user configurable URL to support event triggered share processing
* Cached database handling (optional) to reduce round trips.
* Supports Mysql, Postgresql, sqlite3 (JDBC based so others can be added easily – currently only tested on mysql)
* Runs as a Windows service
* Longpolling support
* Integrated block monitoring using all available bitcoin daemon work sources
* Dump shares to Database, log file or stdout
* Safe restart – shares issued to client this block are dumped to file on shutdown and reloaded on startup so your miners won’t get stale shares if you restart a live server
* Only dependency is a Java 6+ JDK.

Please give it a go, feel free to send me any feedback, rip into it if you like.

You can find it here

The webserver may be a bit slow, I'm testing out EC2 micros to see how they handle basic web server duties so sorry about that. Will have a test pool up and running soon (as soon as I finish the front end).

doublec
Posts: 149
Joined: Mon May 23, 2011 12:47 am
os: linux
Location: Auckland, New Zealand
Contact:

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by doublec »

shads wrote:Please excuse the blatant copy and paste from the bitcoin forum. Everything I've said there is relevant to namecoid as well. I haven't had a chance to test with namecoind as yet but I don't think there's any reason PoolServerJ shouldn't be compatible...
How is your long polling implemented? Using it on the namecoin network would require changes if you've written a half node or similar approach.

shads
Posts: 26
Joined: Sun Jul 31, 2011 6:36 am
os: linux

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by shads »

Not sure what you mean by half-node. I followed the spec on deepbit.

Accepts GET or POST. Holds connection open until blockchange. Responds with normal getwork result.

I did originally write the header immediately and write the body on block change but I don't think that's correct so I changed it to not even start processing the request until block change.

doublec
Posts: 149
Joined: Mon May 23, 2011 12:47 am
os: linux
Location: Auckland, New Zealand
Contact:

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by doublec »

shads wrote:Not sure what you mean by half-node. I followed the spec on deepbit.
What I mean is, how does it know when a new block has happened? You need to monitor the bitcoin/namecoin network somehow to do this. One approach is to use a half node, like blkmond in pushpool.

shads
Posts: 26
Joined: Sun Jul 31, 2011 6:36 am
os: linux

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by shads »

Oh I see what you mean now... Blkmond function is integrated. It just uses getblockcount requests to the daemons. A polling approach unfortunately but couldn't work out a push method. It allows a max of 1 second between polls per daemon so with multiple daemons you shouldn't see much delay.

Is there some difference to how namecoin works with respect to block numbers?

doublec
Posts: 149
Joined: Mon May 23, 2011 12:47 am
os: linux
Location: Auckland, New Zealand
Contact:

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by doublec »

shads wrote:Oh I see what you mean now... Blkmond function is integrated. It just uses getblockcount requests to the daemons. A polling approach unfortunately but couldn't work out a push method. It allows a max of 1 second between polls per daemon so with multiple daemons you shouldn't see much delay.

Is there some difference to how namecoin works with respect to block numbers?
Not with block numbers but the network protocol is slightly different. This means an approach that emulates a node (which allows the push approach) needs tweaking.

nodemaster
Posts: 172
Joined: Wed Jun 15, 2011 12:46 pm
os: linux

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by nodemaster »

shads wrote:Oh I see what you mean now... Blkmond function is integrated. It just uses getblockcount requests to the daemons. A polling approach unfortunately but couldn't work out a push method. It allows a max of 1 second between polls per daemon so with multiple daemons you shouldn't see much delay.

Is there some difference to how namecoin works with respect to block numbers?
I was using a homebrew "blkmond" solution some time ago since blkmond really is a pain in the ass. I tried the getblockcount method as well and was pulling each 0.1 second. But even this meant a significant disadvantage for the pool. I won't try it again on any blockchain :mrgreen:
Access .bit domains with Firefox in 4 easy steps: https://masterpool.eu/proxy
MasterPool Namecoin Mining Pool

shads
Posts: 26
Joined: Sun Jul 31, 2011 6:36 am
os: linux

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by shads »

0.2.2 is released...

I've just finished writing up the results of some extensive performance tests of poolserverj against pushpoold.

Write up can be found here along with
- test methodology
- test setup
- all the tools necessary to reproduce the tests on you own setup

For the TLDR crowd a quick summary:
- pushpoold beat poolserverj on one test that tested the raw rate it could deliver getworks in a low concurrency scenario (with no share submissions)
- In all the tests that use all functions of the server poolserverj outperformed by factors ranging from 200-400%
- on the test setup pushpoold's best performance for receiving shares equated to a 589 GHash/s pool
- on the test setup poolserverj's best performance for receiving shares equated to a 2154 GHash/s pool
- poolserverj has been reverted to alpha status due to some issue identified during these tests which are explained in the 0.2.2 changelog.txt

Feel free to rip holes in my testing methodology. As the author of poolserverj I can never credibly claim lack of bias which is why I've provided all the test/benchmark tools for other people to do their own tests.

shads
Posts: 26
Joined: Sun Jul 31, 2011 6:36 am
os: linux

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by shads »

0.2.5 released...

[0.2.5]

- update to jsonrpc lib - force JsonRpcRequest.getId() to return a default value (-1)
if not set. Some clients don't implement spec properly and this was causing a nullpointerException.
- Cleaned up directory layout for distribution.
- Fix: classpath problem for windows service so no longer need to build into one monolithic jar
- added lib/plugins directory which is in the default classpath so plugins no longer require classpath changes.
- update procrunsrv to 1.07 to support wildcard classpaths

[0.2.4] - unreleased

- synchronised share flush to database to prevent concurrent attempts.
- set server header to PoolServerJ(v<version>)
- implemented resource pools for recycling objects used in WorkProxy.chooseSourceForWork()
- Added reset(args) methods to a number of heavily used classes for recycling
- added example AnyPasswordWorkerAuthenticator class as used in plugin build guide: http://poolserverj.org/documentation/plugin-guide/

nodemaster
Posts: 172
Joined: Wed Jun 15, 2011 12:46 pm
os: linux

Re: [ATT: POOL OPS] PoolServerJ - scalable java pool backend

Post by nodemaster »

I just tested with 0.2.7 in compatible mode. It seems I'm able to connect with a miner. Miner is properly authenticated, submit shares but PoolServerJ can't flush to database:

Code: Select all

RETRY
RETRY
Restoring workmap from file: /opt/poolserverj/tmp/workmap-8999.bin
Trimmed 9 entries from workmap and 0 entries from duplicate check sets in 0ms
Retrieving worker from database: USER1.cpuminer
Trimmed 0 entries from workmap and 0 entries from duplicate check sets in 0ms
Retrieving worker from database: USER1.phoenixminer
Retrieving worker from database: USER1.poclbm
Trimmed 0 entries from workmap and 0 entries from duplicate check sets in 1ms
Trimmed 0 entries from workmap and 0 entries from duplicate check sets in 1ms
Trimmed 0 entries from workmap and 0 entries from duplicate check sets in 1ms
Submit Throttling on: false
Doing database flush for Work Results: 3
Failed to commit to database.
java.sql.BatchUpdateException: Data truncated for column 'upstream_result' at row 1

Query being executed when exception was thrown:
INSERT INTO shares (rem_host, username, our_result, upstream_result, reason, solution) VALUES ('PROPER.CLIENT.IP.ADDRESS', 'USER1.cpuminer', 1, 0, null, '000000013d54083e476f3bc0fa979d7fa2a41b3c56db5a76810f64b600194bd100000000e8fceae217b13e37e2d15cb39b6ea3947b65128380fc08b665e4d21042c62df34e4d5bfa1c00824f7433866f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')


	at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024)
	at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
	at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
	at com.shadworld.poolserver.db.shares.DefaultPreparedStatementSharesDBFlushEngine.flushToDatabase(DefaultPreparedStatementSharesDBFlushEngine.java:97)
	at com.shadworld.poolserver.logging.ShareLoggingThread.run(ShareLoggingThread.java:146)
Caused by: java.sql.SQLException: Data truncated for column 'upstream_result' at row 1

[...]

Flushed 1 work results to DB in 1.0ms (999/sec)
Flush shares cache complete...
Waiting to complete upstream share submits...
Finished upstream submits...
Flushing final shares...
Submit Throttling on: false
Doing database flush for Work Results: 1
Failed to commit to database.
java.sql.BatchUpdateException: Data truncated for column 'upstream_result' at row 1


I'm able to execute the given MySQL statement directly within MySQL if I connect as the same user without any errors (However I'm not doing it as a prepared statement). Any hint what I need to check?
Access .bit domains with Firefox in 4 easy steps: https://masterpool.eu/proxy
MasterPool Namecoin Mining Pool

Post Reply