社交网站如何计算好友更新? [英] How do social networking websites compute friend updates?

查看:44
本文介绍了社交网站如何计算好友更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

社交网站可能会为用户、朋友和事件维护表格......

Social networking website probably maintain tables for users, friends and events...

他们如何使用这些表以高效且可扩展的方式计算好友事件?

How do they use these tables to compute friends events in an efficient and scalable manner?

推荐答案

许多社交网站(如 Twitter)根本不使用 RDBMS,而是使用 Message Queue 应用程序.他们中的很多人都是从一个已经存在的应用程序开始的,比如 RabbitMQ.其中一些变得足够大,他们必须大量定制或构建自己的.Twitter 正在第二次这样做.

Many of the social networking sites like Twitter don't use an RDBMS at all but a Message Queue application. A lot of them start out with a already present application like RabbitMQ. Some of them get big enough they have to heavily customize or build their own. Twitter is in the process of doing this for the second time.

消息队列应用程序通过为一项或多项其他服务保存来自一项服务的消息来工作.例如,服务 Frank 正在向队列 foo 发布消息.Joe 和 Jill 订阅了 Franks foo 队列.应用程序将跟踪 Joe 或 Jill 是否收到消息,一旦队列的每个订阅者收到消息,它就会丢弃它.弗兰克发送消息并忘记它.Joe 和 Jill 向 foo 请求消息并获取他们尚未收到的任何消息.乔和吉尔对消息做任何他们需要做的事情.也许保留它也许不是.

A message queue application works by holding messages from one service for one or more other services. For instance say service Frank is publishing messages to a queue foo. Joe and Jill are subscribed to Franks foo queue. the application will keep track of whether or not Joe or Jill have recieved the messages and once every subscriber to the queue has recieved the message it discards it. Frank fires messages and forgets about it. Joe and Jill ask for messages from foo and get whatever messages they haven't gotten yet. Joe and Jill do whatever they need to do with the message. Perhaps keeping it around perhaps not.

消息队列应用程序保证应该收到消息的每个人都可以并且将在他们请求消息时收到消息.发布者可以发送消息,确信订阅者最终可以得到它们.这样做的好处是完全异步并且不需要昂贵的连接.

The message queue application guarantees that everyone who is supposed to get the message can and will get the message when they request them. The publisher can send the messages confident that subscriber can get them eventually. This has the benefit of being completely asynchronous and not requiring costly joins.

我还应该提到,通常这些东西的大规模存储是严重非规范化的.因此,Joe 和 Jill 可能正在存储完全相同的消息的副本.这被认为是可以的,因为它有助于应用扩展到数十亿用户.

I should mention also that usually the storage for these kind of things at high scale are heavily denormalized. So Joe and Jill may be storing a copy of the exact same message. This is considered ok because it helps the application scale to billions of users.

其他阅读:

  1. http://www.rabbitmq.com/
  2. http://qpid.apache.org/

这篇关于社交网站如何计算好友更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆