How many times an article is read, how they are read (by a user / client or a task) and the number of articles are also major design criteria. But in general : the second solution is the best. It is faster and it is more scaleable.
--
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/-/Nmg_yBkwf5UJ.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
IIRC, it shows how to use sharded counters and tasks queues to
synchronize a denormalized score on user submitted links.
Looks similar to what you are trying to do with "Article" and "scores".
Hope that helps.
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
--
Johan Euphrosine (proppy)
Developer Programs Engineer
Google Developer Relations
--
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.
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.
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.
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)
If you do an ancestor query you will get consistent data.