Jump to content

php fwrite vs. mysql database? Faster?


spaceman12

Recommended Posts

Hello,

I'm developing a browser based

chat clients(like the one

facebook and gtalk uses) which

requires an instant generation of

of blocks of html code on clicks.

So, what i'am basically trying to

do is first writes it down the

generated code on a text file

using php fwrite function and

load it immediately into the site

as soon as it is done.

Some disadvantages using this

system of techniques is the

various calculations involved

which i believe will delay in the

deleivery of the code generated.

On the otherhand, this is not so

in the case of mysql database as

all the values are uniquely stored

and determined but the whole

lot process of querying and

reteieving is another factor that i

believe will slow down the

performance.

please tell me which gonna be a

faster one...thanks,

 

p.s

almost 50percent coding done

Link to comment
https://forums.phpfreaks.com/topic/229594-php-fwrite-vs-mysql-database-faster/
Share on other sites

I think using a mysql database would generally be faster than reading and writing text files - especially if the site gets heavy usage, or if you are going to end up storing a lot of data (saved chats, etc).

 

Another thing to think about is that only one process can write to a file at a time, so if you have 10 users who all do something at about the same time, the person who clicked last will have to wait until all the other users' code has been processed before his will be.

 

My vote would be for mysql.

thank u for the response. However, i'd like to make a clarification that the data stored on the text files  are almost invisble as it is auto cleared by the server itself on the event of succesful javascript generation. Tht is, it is immediately appended into the browser as soon as the desired blocks of codes are generated. As, this is chiefly a browser related stuff, i necesarily dont find it useful to use database,most importantly on the ground that it might utilize heavy resources and workload as compared against lightweight text.

 

Any suggestion welcome

Archived

This topic is now archived and is 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.