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
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.