spaceman12 Posted March 4, 2011 Share Posted March 4, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/229594-php-fwrite-vs-mysql-database-faster/ Share on other sites More sharing options...
hoogie Posted March 4, 2011 Share Posted March 4, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/229594-php-fwrite-vs-mysql-database-faster/#findComment-1182909 Share on other sites More sharing options...
spaceman12 Posted March 4, 2011 Author Share Posted March 4, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/229594-php-fwrite-vs-mysql-database-faster/#findComment-1183044 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.