News for hackers. Stuff that matters.
Re:Massively faster DB with async batching by willvarfar on Thursday January 26, 2012 @02:43PM (#3515612)
But then the callback to the request would timeout and the callee code waiting on the web request would be in no misunderstanding that the thing was committed or not.

Things in the queue get acknowledged - and sometimes resultsets or IDs returned, in the case of SELECT and INSERTs that return auto keys.

Re:Massively faster DB with async batching by marshray on Thursday January 26, 2012 @03:47PM (#3515920)
OK, I see. So your batching related inserts to cut down on the per-transaction overhead, but not actually returning anything to the client until the commit is confirmed.

I think this is a good method, as long as you're careful about these things. (I assume you've taken care of them, just talking about this method in general).

1) If there were multiple transactions in the web request, previously the second ones likely wouldn't have been run if the first were to fail. This would likely change that and it could even necessitate having rollback for the second transaction.

2) Now there is a potential "thundering herd" problem. When the transaction batch commit notification is received, all 1000 web requests made over that 100 ms period become ready to execute and start competing for network/disk/database resources simultaneously. A disk that was just sitting idle now has 1000 different things to do at once. If everybody hits the network at once it can cause temporary packet loss. When packets are lost, connections can be dropped or delayed by retransmits. Sometimes client retries and retransmits can happen synchronously. In the worst case, such a system can end up oscillating wildly between excessive load and excessive idle.

Re:Massively faster DB with async batching by willvarfar on Thursday January 26, 2012 @04:10PM (#3516011)
Yes this is what twisted's "interactions" are and how I talk about throwing rollbacking-exceptions and such in the article.

Yes, you do have to be careful about saturating links generally. The thundering herd thing is a rich man's problem :)