9 messages in com.googlegroups.google-appengine[google-appengine] Re: felxible shard...
FromSent OnAttachments
conmanAug 13, 2008 4:11 am 
Calvin SpealmanAug 13, 2008 3:07 pm 
BillAug 13, 2008 7:03 pm 
conmanAug 14, 2008 12:16 am 
conmanAug 14, 2008 12:39 am 
BillAug 14, 2008 10:38 am 
BillAug 14, 2008 11:39 am 
Bryan A. PendletonAug 14, 2008 12:15 pm 
conmanAug 14, 2008 11:58 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[google-appengine] Re: felxible sharded counterActions...
From:conman (cons@googlemail.com)
Date:Aug 14, 2008 12:39:55 am
List:com.googlegroups.google-appengine

@Calvin You are probably right but it's always a nice thing to implement things like that right and then forget about them.

@Bill, Thanks for sharing your pastie! I looked at it and I might have found a problem: In Line 75 you increment your shards count - but you don't save the Entity. So this is incfremented only for the current thread - all other threads running on the distributed system woun't know that the shard count is already increased and you will get failed transaction due to contentions after all.

But if you save it - you will run into the same issue I was talking about in the first place: A lot threads might be trying to increase and save the shard count - which might again lead to a failed put(). This case is handled by the outer try/except block which ignores it.

Also I changed the code for increasing the number of shards to: num_shards = int(num_shards * 0.1 + 1) Which increases by 10%. The reason is that if you have already 300 shards running and despite that get failed transactions - adding only a static number like 5 might be not enough.

Regards, Constantin