2010/3/15 Eli Jones <[email protected]> > You might be better off figuring out if you can design your code so that it > does not need locking.
If I can, I would. But isn't the locking intrinsic in the multiple processing environment to solve the race-condition problem? I do not insist to have locking, but I do need to have a solution when an instance is co-existing in two processes/requests. If locking is luxury in GAE, at least to be warned. I suppose the "transaction" is for this purpose. But the limitation of transaction makes it is hard to function as expected but simple scenario. > You could make it so that whichever client submits processed work from the > queue last gets priority.. the other clients work that got returned earlier > is just discarded. > > This way, work could simply be submitted with work entities having explicit > key_names and just being .put() to the datastore. > > Either way, you can easily set up a method so that either, first-submitted > or most recently-submitted work is given priority. > > The ordering might happen to be any kind of weighting. In my scenario, the ordering factor is time-stamp, in other scenario, it might be some others. Whenever dealing with the queue, to consume the queue in order is inevitable no matter by what ordering. To consume the queue sequentially or randomly dose not make different for the problem, I think. If there is no management mechanism, "The same item might be dispatched to two different requests", that is the problem. Locking is an approach to manage the queue, although might not be the only way. So, I 'd like to: 1) Do not dispatch the same item to different requests, or 2) Some management can be applied to avoid they crash each other. > Granted I'm not clear on exactly what sort of work is getting processed > from your queue. It just seems like you'll expend more resources trying to > be exact by not having more than one client grab the same workload.. which > will then slow down the apps performance and gobble up more resources. > Agree, but overridden is worse. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
