You can save your individual rating anywhere, you just need it for the record. Put you update your total rating and total user record in a transaction counter. For average rating you only need total rating and total user counter, you don't need individual record.
On Nov 4, 12:15 pm, "Jay Freeman \(saurik\)" <[EMAIL PROTECTED]> wrote: > Ok, but this model still involves having the products in the same entity > group as the sharded ratings, right? That isn't what I read from "use shards > to track the ratings (but without using transactions)". I can easily see how > you don't need a transaction to sum the shards into the total, but you > definitely need a transaction to add the new rating and add its weight to > the shard. -J > > -------------------------------------------------- > From: "yejun" <[EMAIL PROTECTED]> > Sent: Tuesday, November 04, 2008 9:11 AM > To: "Google App Engine" <[email protected]> > Subject: [google-appengine] Re: more complicated counters/ratings (sorting?) > > > > > You keep total rating values and number of users rated both in two > > shard counters which are not belong to your product entity group. Then > > update your average rating for your product's entity group > > periodically like once every 100 request or 1000 request depends on > > your need. So the concurrency level is only determined by the number > > of shards not by number of users or products. > > > Even though the transfer data from shard counter to your entity group > > is non-transactional, but the updating of raw records are > > transactional, the data will be corrected next time when you update > > average rate. Updating will only takes the time of a dozen of > > datastore read and 1 put. > > > On Nov 4, 11:40 am, "Jay Freeman \(saurik\)" <[EMAIL PROTECTED]> > > wrote: > >> If I don't use transactions (with the ratings in the same entity groups > >> as > >> the shards they are being served by) then I can't be guaranteed I don't > >> accidentally drop or double count ratings in the case of errors. :( Is > >> the > >> idea that you are recommending I just say "oh well, its a drop in the > >> bucket"? -J > > >> -------------------------------------------------- > >> From: "Alexander Kojevnikov" <[EMAIL PROTECTED]> > >> Sent: Tuesday, November 04, 2008 1:12 AM > >> To: "Google App Engine" <[email protected]> > >> Subject: [google-appengine] Re: more complicated counters/ratings > >> (sorting?) > > >> ...> I would use shards to track the ratings (but without using > >> > transactions) and from time to time re-calculate the average from the > >> > shards and keep it with the product. This would allow indexing by the > >> > average rating, without many sacrifices. > > >> ... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
