2

Consider a web application such as Google Chat, where the servers serve hundreds of millions of clients simultaneously. In such application, the servers have to push notifications to clients at near real time (in the chat example - incoming messages, presence notification etc.).

How do they implement it? Significant part of the clients are browser based. I suppose polling would overload even Google's servers. So, are they using something like Comet? If so - do they need to allocate a server for every 65536 clients (maximum TCP connections per machine)? I understand that there is a way to circumstance this limitation but I don't know how it's implemented.

Community
  • 1
  • 1
Elad
  • 19,079
  • 18
  • 62
  • 71

2 Answers2

1

Chat is not handled by single application / hardware / instance. They definitely using many instances with load balancing that allows to scale chat system horizontally. It might be dedicated for regions or just single clustered system (I believe it is dedicated within regions but still clustered within region). As well you can have as many connections as hardware and network will handle but not 64k. Because 64k (actually less then that) is regarding Binding sockets (server sockets, but not client ones).

In case with google and based on supported browsers, they definitely use mixed technologies to communicate selecting the most powerful based on browser support. That can be long-polling, sockets and even oldest one: simple ajax.

As well for example facebook chat is based on erlang. And using erlang there is many examples having more then million connections.

moka
  • 22,846
  • 4
  • 51
  • 67
0

I don't know how Google handle this, ans they probably won't tell us. But, today you can deal with http streaming, websockets or long polling to build such application. To give you an example Atmosphere framework

is a tool to build "real-time", efficient and scalable web application.

fmgp
  • 1,638
  • 17
  • 17
  • 1
    Exactly. Google has implemented and refined a custom solution for data push over the years. But you can find several off-the-shelf products, both free and commercial, which take care of the complexity of real-time data push.As the CTO of Lightstreamer ( http://www.lightstreamer.com ), I can tell you that we have been working on push technology for twelve years now, with the goal of providing a piece of software that is both scalable (up to million connections per node) and able to heuristically cope with the unpredictability of the Internet (in terms of bandwidth, proxies, firewalls, etc.) – Alessandro Alinone Apr 21 '12 at 13:48