Do you really want the mechanical action of the disc every time someone dials? Burning to disk is a terrible idea. Cache messages in memory. Clear the message when it is sent to all users in the room. The cache will remain small, most of the time empty. This is your best option if you do not need a history magazine.
But if you need a magazine ....
If you write a large amount of data in 1 pass, I guarantee that the file will smoke database insert performance. The bulk insert function of the database may correspond to a file, but this requires a source of data files. You will need to queue a large number of messages in memory, and then periodically reset the files.
For many small records, the gap will close and the database will move forward. Indexes will affect insertion speed. If thousands of users are pasting into a highly indexed table, you may have problems.
Do your own tests to prove that faster. Simulate a realistic load, not 1 user test.
Lord tydus
source share