Jump to content

Recommended Posts

500 of these a minute

if (file_exists("file.txt")) {DO STUFF}

 

Or

 

500 of these a minute

SELECT ìd` FROM chatconnections WHERE user = 'joebloggs' LIMIT 0,1

 

The table chatconnections will only ever have about 10 records in by the way

 

See i want to create a live chat and Im wondering whats the best way to conncurently check if someone wants to chat. Whether its better to have a flat file created or a database entry. Either of which will need to be checked for every minute

Link to comment
https://forums.phpfreaks.com/topic/74585-whats-faster/
Share on other sites

No.. it was just to store a chat request

 

Rather then query the database table every minute to see if a chat request row exists for the member

 

I was thinking of just having a folder, when someone wants to chat, a text file is created named after the members username

 

username.txt

 

If that file exists, we know someone wants to chat, so then start the chat and delete that file

 

If it doesnt exist, obviously no one is waitint to chat..

 

Yeh?

 

Link to comment
https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-378679
Share on other sites

No.. it was just to store a chat request

 

Rather then query the database table every minute to see if a chat request row exists for the member

 

I was thinking of just having a folder, when someone wants to chat, a text file is created named after the members username

 

username.txt

 

If that file exists, we know someone wants to chat, so then start the chat and delete that file

 

If it doesnt exist, obviously no one is waitint to chat..

 

Yeh?

 

Files were not meant for this... stick with the DB.

Link to comment
https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-378785
Share on other sites

Are you sure?

 

MySQL currently gets hammered, the less load I can take off that service the better

 

Unless useing flat files causes more over head in regards to CPU, Disk I/O etc

 

This is what Im saying, if both could be benchmarked.. which is going to be better for system wide performance

 

Mysql is great for handling and manipulating large sets of data, but is it better in regards to minimal data.. when alterntives can be used

Link to comment
https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-379439
Share on other sites

But what if alls my process is doing is simple checing if the file exists

 

if (file_exists("jamie.txt")) { OK LETS DO IT }

 

As apposed to

 

SELECT `id` FROM chatseshions WHERE user = 'jamie' LIMIT 1

 

if num_rows == 1 {DO STUFF}

 

 

Surely in this case file_exists would be better/faster?

Link to comment
https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-379917
Share on other sites

I think we've beaten this topic to death.

 

If you don't want to take the opinion of others, then don't. Just do what you want to.

 

Try both ways, see what appeals to you or what works better.

 

Please don't keep asking the same thing over and over.

 

 

Agreed... topic locked.

Link to comment
https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-380375
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.