Live Chat - Ajax Poll or Ajax Reverse

after a whole day of searching, I would like to talk about the best solution for online chat.

This is what I know:

Ajax polling is an old, bandwidth-consuming and non-scalable way to do it. It requests new data on the server every X seconds. This implies a single database query every X seconds * number_of_connected_users.

Reverse Ajax and one of its applications (comet) require a custom web server or a dedicated comet server, which can handle the number of connected_codes for long http connections.

My actual server: 1 Xeon processor, 1 GB of RAM and 1 Gb / s bandwidth. A server is a virtual machine (hence highly scalable).

I need a solution that can scale with the server and the future growing user base.

My doubts:

  • How much can ajax polling method affect my bandwidth usage?

  • How can I optimize ajax polling to make a db request only when necessary?

  • Is it possible to run a comet server on the same web server computer (Apache)?

  • With the cometary way, I still need an interval to execute queries in the database, and then send a response, so where in real time?

  • Can a comet work with my actual server?

Thanks in advance.

+3
source share
2 answers

, . , . , , , .

ajax . . ( ) .

, Apache. Apache, , . ( EventMachine) , Python ( Twisted) C.

, . , , .

+1

PHP.

, (, ) python? - .

, , ?

0

Source: https://habr.com/ru/post/1752546/


All Articles