Bitcoin Forum
August 17, 2018, 02:18:13 AM
 News: Latest stable version of Bitcoin Core: 0.16.2  [Torrent].
 Home Help Search Donate Login Register
 Pages: [1]
romkyns
Newbie

Offline

Activity: 19
Merit: 0

 April 12, 2013, 11:43:48 AM

I've downloaded the list of all trades executed on Mtgox over the past 24 hours (there's an API URL for that), and wrote a tiny script to count the number of trades during every 1-minute interval.

Turns out, the single worst minute saw SIX trades per second. The top 15 worst 1-minute intervals saw an average of 3.8 trades per second.

Let's try to estimate how many trades per second their engine is capable of. The worst lag I saw over the past 24 hours was about 500 seconds, i.e. 8 minutes. Let's simplify this a lot, and assume that this lag was created after the worst 1-minute interval, when Mtgox saw 370 trades. In the most conservative scenario, a lag of 8 minutes would mean that these 370 trades took 7 minutes to execute (this is a bit of an approximation, but I think it's close enough).

That places the Mtgox trading engine speed at just 0.9 trades per second.

This is so ridiculous that I have to wonder if I made a mistake somewhere. But if I didn't, their trading engine was written by monkeys (something that everyone seems to agree on anyway).

EDIT: I've had someone question the approximation, so I wrote a better script. This one iterates 1 second at a time, queues the trades arriving in that second for execution, then executes trades from the queue at a specified speed (seconds per trade). It then measures the lag directly. Using this code, to get the worst lag of 500 seconds, "seconds per trade" is 0.65, i.e. approximately 1.5 trades per second. But I doubt 500 seconds was the worst lag during these 24 hours...

EDIT: if the worst lag during these trades was 50 minutes as suggested by 2weiX, that places the speed at pretty much exactly 1 trade per second. Hm... how suspicious... (might be an accident though)
1534472293
Hero Member

Offline

Posts: 1534472293

Ignore
 1534472293

1534472293
 Report to moderator
1534472293
Hero Member

Offline

Posts: 1534472293

Ignore
 1534472293

1534472293
 Report to moderator
1534472293
Hero Member

Offline

Posts: 1534472293

Ignore
 1534472293

1534472293
 Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1534472293
Hero Member

Offline

Posts: 1534472293

Ignore
 1534472293

1534472293
 Report to moderator
1534472293
Hero Member

Offline

Posts: 1534472293

Ignore
 1534472293

1534472293
 Report to moderator
1534472293
Hero Member

Offline

Posts: 1534472293

Ignore
 1534472293

1534472293
 Report to moderator
dawn
Full Member

Offline

Activity: 121
Merit: 100

 April 12, 2013, 11:48:00 AM

And they earn shitloads because people get in panic and trade and trande and trade...  Mt.Gox is the most unprofessional player with that much power, related to IT I ever saw. If they don't have enough manpower, they should be able to recruit 100s of IT professionals. It's again only the damn greed which makes it worse for everyone.

0.011BTC/GH contract for 5 years !!!!!:  Got my 5th weekly payout
tdahsu
Newbie

Offline

Activity: 27
Merit: 0

 April 12, 2013, 11:50:23 AM

My guess is they're still using the old "Magic the Gathering" trading engine, which would work just fine if people traded 1 card per second.
kiko
Sr. Member

Offline

Activity: 453
Merit: 250

 April 12, 2013, 12:14:49 PM

I've downloaded the list of all trades executed on Mtgox over the past 24 hours (there's an API URL for that), and wrote a tiny script to count the number of trades during every 1-minute interval.

Turns out, the single worst minute saw SIX trades per second. The top 15 worst 1-minute intervals saw an average of 3.8 trades per second.

Let's try to estimate how many trades per second their engine is capable of. The worst lag I saw over the past 24 hours was about 500 seconds, i.e. 8 minutes. Let's simplify this a lot, and assume that this lag was created after the worst 1-minute interval, when Mtgox saw 370 trades. In the most conservative scenario, a lag of 8 minutes would mean that these 370 trades took 7 minutes to execute (this is a bit of an approximation, but I think it's close enough).

That gives us an upper bound on Mtgox trading engine speed of just 0.9 trades per second.

This is so ridiculous that I have to wonder if I made a mistake somewhere. But if I didn't, their trading engine was written by monkeys (something that everyone seems to agree on anyway).

No, you are correct. I've been thinking the same thing for months. I just can't get my head around how it could be that slow. It must be re-sorting the entire order book on every order, added or removed. Not just re-arranging pointers. but actually copying the data on disk, every time. I just can't think of another way it could be slower.

[BTW. this kind of thread really belongs in Service Discussion for future reference.]
2weiX
Legendary

Offline

Activity: 1960
Merit: 1000

bitcoincommodities.com

 April 12, 2013, 12:17:33 PM

worst lag i witnessed was >50 minutes.
WiseOldOwl
Full Member

Offline

Activity: 238
Merit: 100

 April 12, 2013, 12:27:44 PM

So it points to manipulation on purpose, because they just cant be that slow after all these years.
shep80
Full Member

Offline

Activity: 139
Merit: 100

 April 12, 2013, 12:48:54 PM

At that rate, their trading engine may be a bunch of folks watching monitors matching up buy/sell orders.

That's a total joke.

ragmondo
Member

Offline

Activity: 100
Merit: 10

 April 12, 2013, 01:00:27 PM

I did a quick websearch. Here is one guys trading system that does (easily) 100 trades per second on a 400Mhz machine 3 years ago.

video here : http://vimeo.com/18232653

In fact, I think it would actually be difficult to write a trading / matching engine that performed as slowly as mtgox. Seriously.
TTBit
Legendary

Offline

Activity: 1136
Merit: 1000

 April 12, 2013, 01:00:45 PM

MtGox will suspend all trading, but they should suspend orders not on 0.05 price increments. Or, accept order prices down to 0.0001, but charge for them, which would be fine for larger orders.

good judgment comes from experience, and experience comes from bad judgment
romkyns
Newbie

Offline

Activity: 19
Merit: 0

 April 12, 2013, 01:29:44 PM

In fact, I think it would actually be difficult to write a trading / matching engine that performed as slowly as mtgox. Seriously.

I think it's quite easy; store all orders in an unindexed table in MySQL and run a badly written SQL query to find the next match. I've seen enough awful code to suspect sheer incompetence way before suspecting malice, aka Hanlon/Heinlein's Razor...
SlipperySlope
Hero Member

Offline

Activity: 686
Merit: 500

Stephen Reed

 April 12, 2013, 01:51:47 PM

Thanks for this analysis.

One possible root cause of Mt.Gox trading engine bad performance is the very liberal policy of allowing traders to issue limit orders without the corresponding dollars or bitcoins. Thus the matching engine must verify that the account has the actual dollars on hand to make a purchase, and must likewise verify the actual bitcoins on hand to make a sale.

The entire trading engine is subject to locks to prevent corruption of data by simultaneous processes. The matching engine must lock each account as it verifies account balances of candidate matched orders. High performance trading engines are designed around the notion of reducing lock contention. See http://lmax-exchange.github.io/disruptor/ .

Bitcoin needs a robust, high performance exchange - as well as security against hackers.
 Pages: [1]
 « previous topic next topic »