Re: Data reading and writing for a chat

From: Date: Sun, 30 May 2004 16:59:40 +0000
Subject: Re: Data reading and writing for a chat
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187234@lists.php.net to get a copy of this message
Stephen Lake wrote:
I got a question for you all. What would be more effiecient for datastoring that is going to be constantly extracted like in a chat application? a MySQL database? or a Flat text file?
Well, the most effiecient would be the memory :) With some socket programming it should be possible to create a connection to each client - and a server show sent out the incoming messages to the clients. But flat file vs. mysql. I would prefer MySQL - it is fast, it can handle a lot of request. If you use flatfile, you need to do some checking for the if the file is open already - so only one client at the time can write to the file - if can be very slow if a lot of users is on the chat at the same time and write a lot of messages - cause the whole file need to be locked every time a single user write a message. So in my opinion, you should do some socket client and a server - or use a database :) -- Johan Holst Nielsen Freelance PHP Developer http://phpgeek.dk

« previous php.general (#187234) next »