简体   繁体   中英

Implementing chat system: where to store chat data?

i am implementing a chat system in asp.net, much like google chat and i use xmhttp to send and receive data, and i am using a single table to store all chat for all user.

i wanted to create global temporary tables in sql using a XMLHttpRequest so as to be abl to organise data better(instead of storing all the chat in a sigle table which can(i dont know for sure) cause locking issues when many users are accessing it.)

also for my system i don't have to store the chat and so i thought that a global temporary table would be better since it will already be dropped and save me the trouble of clearing it.

but the after the table has been created by the Xmlhttprequest it gets dropped just after its creation....why this happen i don't know....i also have removed all connection closing lines but still no luck

so what should i do?? also if anyone knows of any online resources that can points me about best practices to follow please tell me.

Your table won't have locking issues with many users accessing it. Temporary tables are not meant to be shared cross-call, and you're going to wind up with far more roadblocks down that path. It is probably better to simply store your data in a table, then poll the table.

The only time you could have "locking issues" is if the users are attempting to write the same chunk of data to the same row at the same time ... which shouldn't be happening in a chat application.

Additionally, Google Chat uses a COMET style implementation instead of a polling implementation. It has been my experience that COMET > polling in terms of user experience.

你不应该在你的数据库上保留任何聊天消息......除非你实现了离线消息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM