On Thursday, October 27, 2011 1:06:16 PM UTC-7, Jeff Schnitzer wrote: > > I'm going to be the dissenting here. You should consider #1 if you know > that you're always going to have on the order of 100 items. You can easily > cache this value in memcache.
IMO this would depend on the size of the items, fetching 100 items and then traversing then to do a simple sum could be a great overhead on read time that could be avoid by doing this on write time. (This is App Engine strategy for queries) > > When you get into thousands of items you start to see the point at which > it's not practical to do on-the-fly sums, even just to store the result in > memcache. But less than thousands, might as well just calculate the sum. > > Pre-aggregating the sum is not necessarily trivial. If the sum changes > more than once per second you need to shard the sum. Once you get to 100 > shards, you've created a system that doesn't perform any better and is a > hell of a lot more complicated. > > One thing to watch out for is eventuality - if your sum needs to be > instantaneously correct, a simple query (on the HRD) may provide lagged > data. On the other hand, if you are fetching your articles by key (and > have STRONG consistency configured), you're ok. > If you do an ancestor query you will get consistent data. > Jeff > > On Thu, Oct 27, 2011 at 12:49 PM, Jose Montes de Oca <[email protected] > > wrote: > >> Hi Mos, >> >> You should design your data models as a non relational database, where >> having redundancy its just fine. >> >> Plain and simple: >> >> 1/ will not scale, Not suitable for App Engine non relational database >> (Datastore) >> >> 2/ Right Approach, just need to be careful on what voscausa said. >> >> Hope this helps! >> >> Jose Montes de Oca >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-appengine/-/sUbapsIqigAJ. >> >> 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. >> > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/IPbmPDCItzYJ. 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.
