ajaxchatsemaphorelong-polling

The best way to implement a web chat?


I'm trying to implement a web chat for my website. I will use AJAX for client and long-polling to wait for new messages.

However, I need to consider which way would give the best performance (speed) for transferringg messages between users. I think of the following choices:

(1) Message queue in memory variables (semaphore)
(2) Message queue in memory SQL table
(3) Message queue in on-disk SQL table
(4) Message queue in file (on hard disk)

The 2 later choices (3 & 4) may lower down performance coz of the disk read-write rate. So choice 1 or choice 2 should do better, but I don't know which one is more speedy. Choice 1 doesn't need the SQL layer, so it is faster, isn't it?


Solution

  • Benchmarking these message queues is just really similar to benchmarking the way session data are saved. The following post would show the details of show good each storage engine is:

    http://milancermak.posterous.com/benchmarking-tornados-sessions-0