我们想实现一个“新闻提要”,用户可以在其中看到消息 由她的 friend 广播,按最新消息排在第一位。但是 提要应该反射(reflect)她 friend 列表中的变化。 (如果她添加新的 friend ,来自他们的消息应该包含在提要中,如果 她删除了 friend ,他们的消息不应该被包括在内。)如果我们使用 pubsub-test示例并将收件人列表附加到每条消息 这意味着当用户 连接和断开 friend 。
我们首先使用传统的 RDBMS 对发布-订阅“扇出”建模 思维。起初它似乎工作,但后来,自从 IN 运营商 按照它的方式工作,我们很快意识到我们无法继续 那条路。我们找到了Brett Slatkin's presentation from last years Google I/O我们现在已经看过几次了,但还不清楚 我们将介绍如何使用“动态”收件人列表。
我们需要的是在建模时如何“思考”的一些提示。
最佳答案
将我在 Google App Engine 的 Google 群组中得到的这个问题的答案粘贴下来 http://groups.google.com/group/google-appengine/browse_thread/thread/09a05c5f41163b4d#作者:Ikai L(谷歌)
A couple of thoughts here:
is removing of friends a common event? similarly, is adding of friends a common event? (All relative, relative to "reads" of the news feed)
From what I remember, the only way to make heavy reads scale is to write the data multiple times in peoples' streams. Twitter does this, from what I remember, using a "eventually consistent" model. This is why your feed will not update for several minutes when they are under heavy load. The general consensus, though, is that a relational, normalized model simply will not work.
- the Jaiku engine is open source for your study: http://code.google.com/p/jaikuengine. This runs on App Engine Hope these help when you're considering a design.
关于python - 如何在 Google App Engine 上为社交新闻提要建模,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2447488/