Home > Backend Development > PHP Tutorial > Problems with php chat room information storage

Problems with php chat room information storage

WBOY
Release: 2016-06-27 13:18:08
Original
1847 people have browsed it

I am using PHP to make an instant chat room. I want to store the chat content in a txt file. Every time the client requests content, it first determines whether the size of the txt file has changed. If there is a change, it means there is new information, and then PHP returns new information to the client after processing.
Will this consume more performance than storing it in the database, or will it be slower to find the content? How big is the impact?
I would like to save the content to a file so that the chat content can be deleted when the chat ends. May I ask what is the better solution in this situation?


Reply to discussion (solution)

In fact, the data is stored in the database, and there will not be much consumption.

In fact, the data is stored in the database and there will not be much consumption.
. . . Maybe it's the other way around. I'm asking whether it will be more performance-intensive to store files than to store them in a database.

If we consider performance issues
, then professionals will definitely do better than ordinary people
Otherwise there would be no CEO profession

If we consider performance issues
Then professionals will definitely do better than ordinary people
Otherwise there would be no CEO profession
I may not be very clear, but my current needs are:
(1) Find out if there are any new ones Chat quickly
(2) Delete the chat content after the chat is over, or there is no need to save the chat content.
In this case, is it better to save the chat content to a file or to a database?
This is just a simple php question, not a question for the CEO to answer. . .

Can’t understand the analogy?

If you don’t test, you have no right to speak. Let me tell you how I feel as a parallel importer. If the data is very small, it is faster to send it directly as txt. If it is a little more, it is probably not as fast as the database.

Call me. Don’t even understand the analogy?
soga. . .

If you don’t experiment, you have no right to speak. Let me tell you how I feel as a parallel importer. If the data is very small, it is faster to send it directly as txt. If it is a little more, it is probably not as fast as the database
Haha, this statement is very Helpful, but would like a more detailed comparison.
For example, if there are multiple chat rooms with different topics at the same time, is it better to create multiple tables or multiple txt files. In addition, you still need to delete the table or txt file after the chat ends. In this case, is it better to create a table or a txt file?

You can use memcache, and there is no need to store real-time information in the database.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template