What is a Comet?

      “Comet is a programming model that allows web servers to push data to the client browser without having any need for explicit requests.”

       Comet is also called as server push technology (or Ajax Push technology). Alex Russell (key member of Dojo Toolkit project) calls this server-push technology a Comet, which is based on long live Http connection and has no need to install plugins in the browser.

         Consider the web application where you want to display the adaptive (dynamic) data such as stock quote prices. Stock quote prices are changed frequently, however you do not want to refresh the page for every time that the prices are changed. So one solution is one can use AJAX (Asynchronous JavaScript and Xml) in order to reduce the data transmission but it does not change the traditional mode, request/response. Also AJAX will stall your web server with increase in number of clients. Your interest is to display this dynamic content, but update the client only when it is necessary. So avoiding unnecessary communication between client and web server one can use Comet (AJAX Push technology). It uses the persistent connection feature  in  HTTP/1.1 by default unless specified. The connection between the server and the web browser is kept alive until an explicit ‘release connection’ message is sent by either one of them or a timeout/network error occurs.

        Due to the slow development of browser technology, there is no good support for the implementation of Comet, and it is difficult to provide a perfect solution to implement server-push in the application of browser. In past many years, because of the consistent demand for Comet and the extensive use of AJAX technology in various applications, Comet starts getting more attention.

Architecture of Comet:-

        The architecture divided into two phase request and response phase.

Request:-

Request phase

Response:-

  • Push the data to the clients only when the data at the server side changes without having any need for the client to explicitly request. Here the connection is always initiated by server only.

Response phase

Application of the Comet:- 

  • Gmail uses this technology whenever new mails are received
  •  Meebo chat system
  • Financial trading systems
  •  Web-based real-time monitoring system

Pros:

  • No redundant calls (request/response) are made to the server from the client, when there are no updates at the server side. The result is increase in server performance, network performance, and preserves the server maintenance time.
  • Comet allows more  number of clients at a time to connect to server compared to AJAX. Because in AJAX with increased  no. of clients, the web server may get overloaded due to multiple requests arriving simultaneously.

Cons:

  • Firewalls might terminate connections after some time. So re-establishment of connection may be required.
  • The HTTP/1.1  specification suggests only two simultaneously connections between the client and server.  Comet needs a new connection established to fetch each URL.
  • This technique can have some scalability issues.
    • Every request is serviced by a single thread from the thread pool. A thread pool which launches a thread for every new request in server applications may run out of threads if they are used to keep alive the connection to the client.  Such implementations rule out the support for comet. Connections on the web server need to be preserved and serviced by different threads when the data needs to be sent.

Tagged with:
 

One Response to Comet(Reverse Ajax)

  1. Kd says:

    Good ..Thanks !!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <p>



This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 50945 items have been purified.