Author

Topic: [BTC-TC] Virtual Community Exchange [CLOSED] - page 104. (Read 316652 times)

legendary
Activity: 1106
Merit: 1006
Lead Blockchain Developer
Burnside, would it be possible to have the oauth verifier not expire when the page for a specific token is called again? I can browse to https://btct.co/authorize?oauth_token=c6da005d45642ba73589e37444304412020f36bc with my browser, and approve it, but then it reloads the same page with the oauth verifier token appended to the URL and when I use that verifier the API tells me it's already invalid Sad

I hate to say it but that confused me pretty good.  Wink  Something tells me though that if it doesn't invalidate it the first time around, it may be open to replay attacks?
inh
full member
Activity: 155
Merit: 100
Burnside, would it be possible to have the oauth verifier not expire when the page for a specific token is called again? I can browse to https://btct.co/authorize?oauth_token=c6da005d45642ba73589e37444304412020f36bc with my browser, and approve it, but then it reloads the same page with the oauth verifier token appended to the URL and when I use that verifier the API tells me it's already invalid Sad
member
Activity: 97
Merit: 10

If I understand things correctly, the wallet itself is still BerkleyDB?

Ah, yep, so it is.  I missed that.  It looks like BerkleyDB needs the tuning instead of leveldb.  I found a couple of documents here on Berkley DB tuning methods, though I'm not certain how useful they'll prove. 


The sad thing is that if I understood C++ better this is probably easily fixable.  All you have to do is store the users balance in a single place every time their balance is altered.  You'd have to store it like 7 times, one for 0 confs, 1 conf, 2 conf, .... etc up to 6 confs, at which point you could revert to the slower method of incrementing through all the transactions.  But even storing each users balance 7 times in a single place on each transaction would be way lighter than iterating through the entire transaction stack on an account to find the balance.  At least with any kind of regular getbalance traffic.  I'd setup a bounty for it, but I want to get away from BerkeleyDB entirely anyway so that I can get to a db stack with real-time replication.


That would be interesting, definitely..  I wonder how some of the sites like BlockChain.info do it.
legendary
Activity: 1106
Merit: 1006
Lead Blockchain Developer
The email functions are back now.

I have also unlocked registration, which I'd had to block due to the fact that it sent emails.  Wink

legendary
Activity: 1106
Merit: 1006
Lead Blockchain Developer
Have you considered throwing a message queue, like RabbitMQ, up in front of bitcoind and then using worker processes to perform the operations?  You'd keep two sets of books for your internal balance movements, one in the database and the other in bitcoind, and the workers would synchronize the two.  Transactions involving bitcoind are sent to a queue and the workers could process the tasks at whatever priority is associated with the task.  (eg, a withdrawl or a balance check could be given higher priority than an internal move command to change balances internally between accounts --  the database would already 'know' and bitcoind would be playing catch up).

I have considered this.  I haven't completely rejected it, but there are several concurrency issues around it that could be tricky to address.

I'm slowly moving down the path away from using bitcoind for balance tracking.  I'll have to parallel the balance tracking in the db while coding it all up, then run with overlap for a while, (making sure balances stay in sync)  then finally I'll be able to pull all of the balance related stuff out of bitcoind.  At that point I can shrink the wallet by extracting all of the private keys and importing them into a new wallet.  From there on out bitcoind would be purely for deposit/withdrawal processing.

I expect this process to take a couple of weeks.

It's all manageable.  I just hate that it means it will be a while before I get to do other fun stuff.   Undecided

I found this document with options you can tune to improve the performance of leveldb, the database backend for .8 and above.  It looks like modifying these from the default values would require recompiling bitcoind..

From the bitcoin git repository:

https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/doc/index.html

If I understand things correctly, the wallet itself is still BerkleyDB?

The sad thing is that if I understood C++ better this is probably easily fixable.  All you have to do is store the users balance in a single place every time their balance is altered.  You'd have to store it like 7 times, one for 0 confs, 1 conf, 2 conf, .... etc up to 6 confs, at which point you could revert to the slower method of incrementing through all the transactions.  But even storing each users balance 7 times in a single place on each transaction would be way lighter than iterating through the entire transaction stack on an account to find the balance.  At least with any kind of regular getbalance traffic.  I'd setup a bounty for it, but I want to get away from BerkeleyDB entirely anyway so that I can get to a db stack with real-time replication.

member
Activity: 97
Merit: 10

I found this document with options you can tune to improve the performance of leveldb, the database backend for .8 and above.  It looks like modifying these from the default values would require recompiling bitcoind..

From the bitcoin git repository:

https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/doc/index.html

Edit:  Adding a link to options.h, which has parameters which affect performance:

https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/include/leveldb/options.h#L71
member
Activity: 97
Merit: 10
Have you considered throwing a message queue, like RabbitMQ, up in front of bitcoind and then using worker processes to perform the operations?  You'd keep two sets of books for your internal balance movements, one in the database and the other in bitcoind, and the workers would synchronize the two.  Transactions involving bitcoind are sent to a queue and the workers could process the tasks at whatever priority is associated with the task.  (eg, a withdrawl or a balance check could be given higher priority than an internal move command to change balances internally between accounts --  the database would already 'know' and bitcoind would be playing catch up).
sr. member
Activity: 434
Merit: 250
The loss of free internal transfers would be problematic for asset issuers. I have to make several of these everyday to move funds around to pay dividends.
hero member
Activity: 634
Merit: 500
Yeah, sharding the bitcoind would work.  Even if I sharded four of them onto the same (quad-core) box it would make a huge difference.  Only thing keeping me from doing that is I'd have to do away with the free internal transfers.  Account to account transfers would have to be done over the bitcoin network.

Oh no. I rely on free internal transfers when paying dividends to my pass-through.
It's a feature I would really loathe to see go, but I can understand.

Perhaps if my user accounts were all on the same shard I can still get free transfers?
sr. member
Activity: 294
Merit: 250
http://coin.furuknap.net/
Only thing keeping me from doing that is I'd have to do away with the free internal transfers.  Account to account transfers would have to be done over the bitcoin network.

Why not do a similar thing you do with AM-PT and 'sponsor' one internal transfer per month per user and charge for the rest?

.b
legendary
Activity: 1106
Merit: 1006
Lead Blockchain Developer
I'm actually leaning toward the bottleneck being something CPU related.  When the site slows down, the cpu on bitcoind pegs at 100% and disk IO does not seem to spike a whole lot.  (I've been graphing the system via collectd.)

Since bitcoind is not multithreaded, I think I'm pretty much at it's limit.

I've never seen it done before, but would running two bitcoind servers (and subsequently moving half of the accounts to the new one) mitigate the problem?

Yeah, sharding the bitcoind would work.  Even if I sharded four of them onto the same (quad-core) box it would make a huge difference.  Only thing keeping me from doing that is I'd have to do away with the free internal transfers.  Account to account transfers would have to be done over the bitcoin network.
sr. member
Activity: 316
Merit: 250
logging in works again now (using 2FA). I haven't tested trading yet because i had no intentions to do so.
sr. member
Activity: 420
Merit: 250
anyone else not able to login using 2FA? leaving the 2FA field blank gives me a missing 2FA error (obviously), using 2FA takes forever to load and finally redirects me to a cloudflare site telling me the requested site is offline.
anyone else not able to login using 2FA? leaving the 2FA field blank gives me a missing 2FA error (obviously), using 2FA takes forever to load and finally redirects me to a cloudflare site telling me the requested site is offline.

Even if I can log in successfully, once I get to trying to make a trade it hangs and then eventually comes back with an invalid gauth message.  pretty frustrating, been trying to swap some of my 1/100 for 1/1 all morning

I might be closer to the webserver that you, or my connection may just be faster, but I can make 2FA work if I wait for a new auth code and send it ASAP.

can you actually make trades, or just log in?
member
Activity: 77
Merit: 10
anyone else not able to login using 2FA? leaving the 2FA field blank gives me a missing 2FA error (obviously), using 2FA takes forever to load and finally redirects me to a cloudflare site telling me the requested site is offline.
anyone else not able to login using 2FA? leaving the 2FA field blank gives me a missing 2FA error (obviously), using 2FA takes forever to load and finally redirects me to a cloudflare site telling me the requested site is offline.

Even if I can log in successfully, once I get to trying to make a trade it hangs and then eventually comes back with an invalid gauth message.  pretty frustrating, been trying to swap some of my 1/100 for 1/1 all morning

I might be closer to the webserver that you, or my connection may just be faster, but I can make 2FA work if I wait for a new auth code and send it ASAP.
sr. member
Activity: 420
Merit: 250
anyone else not able to login using 2FA? leaving the 2FA field blank gives me a missing 2FA error (obviously), using 2FA takes forever to load and finally redirects me to a cloudflare site telling me the requested site is offline.

Even if I can log in successfully, once I get to trying to make a trade it hangs and then eventually comes back with an invalid gauth message.  pretty frustrating, been trying to swap some of my 1/100 for 1/1 all morning
sr. member
Activity: 316
Merit: 250
anyone else not able to login using 2FA? leaving the 2FA field blank gives me a missing 2FA error (obviously), using 2FA takes forever to load and finally redirects me to a cloudflare site telling me the requested site is offline.
member
Activity: 77
Merit: 10
I'm unable to get the /transfers to load at all. /security/*, /account, and /portfolio load fine now, most of the time, but /transfers won't load at all.
hero member
Activity: 938
Merit: 502
Hi all.

More DDoS this morning.  I'm pretty sure they got around the DDoS protection by extracting the server's IP from the emails the site sends.  They were attacking the server's base IP and email is the only real give-away I can think of.  (open to suggestions from you other site operators out there.)

We've had to move the server and all outbound emails have been suspended for the time being.


Thanks for the prompt update burnside
legendary
Activity: 938
Merit: 1000
What's a GPU?
I'm actually leaning toward the bottleneck being something CPU related.  When the site slows down, the cpu on bitcoind pegs at 100% and disk IO does not seem to spike a whole lot.  (I've been graphing the system via collectd.)

Since bitcoind is not multithreaded, I think I'm pretty much at it's limit.

I've never seen it done before, but would running two bitcoind servers (and subsequently moving half of the accounts to the new one) mitigate the problem?
legendary
Activity: 1106
Merit: 1006
Lead Blockchain Developer
The site is currently made up of 4 servers.  Not going to go into detail regarding the layout, but bitcoind as of last week (when I posted about working on a server improvement) has been running on a dedicated SSD-backed server.  It has a 140 MB wallet and still takes ages to process getBalance requests.  My guess is that it's iterating through all of the thousands of transactions in the BerkeleyDB on every request or something because it performs very poorly.

Cheers.


Have you thought about using a ramdrive to host the wallet? Should improve things quite significantly speed-wise. Obviously it should have sane backup procedures in case of power loss.

I'm actually leaning toward the bottleneck being something CPU related.  When the site slows down, the cpu on bitcoind pegs at 100% and disk IO does not seem to spike a whole lot.  (I've been graphing the system via collectd.)

Since bitcoind is not multithreaded, I think I'm pretty much at it's limit.
Jump to: