i want to develop a chat application,but i want to develop the ability of private chat between 2 users.

multiple users chat is very simple,but private chat is very complex ,but if we use database it become simple and very flexible.
so i need your expert opinion before i go through to built this chat application.

should i use database or not? (related with performance).

thank you very much for your time.

Use a database. As long as you don't have 1000's of users pulling for information every second you should be fine.

I would suggest pulling for new data every 5-10 seconds. Also if you want better performance, only have 1000 records per chat session.

For instance if you have multiple chat rooms only store 1000 responses per room. Also for one on one chat, delete the responses once both users are no longer chatting (I figure keeping the number of records down should help improve query performance and would someone really need more than the last 1000 responses? You might even be able to get away with only the last 100).

If you want to keep ALL responses in the database, have a cleanup job that runs once an hour and moves responses from one table to an archive table.

These are just my thoughts.

What if you work with XML?

I have developed an "on-line chat application" which can be used by any users without registration. You will fix a room name and let you friend know it. Keep that room name secret. Your friend then can enter that room and have a two-users chatting privately. Here is the web address of my chatting application : www.nazmulhaque.somee.com/chatting/enter_chatroom.asp

chibex64, what benefit is having it XML going to provide? JSON would be a better choice if the JavaScript is going to parse the responses.

i can use hashtables and database and this will become easy for private chat and with the "invite" option like windows live messenger.
and of course using ajax with asp.net.
so i have 2 questions:
XML? how?,and JSON with XML? i don't know JSON but i want to know if JSON can provide the functionality to connect to server side without refresh the hole page?
thank you.