[php] Need advices on writing a counter script

Posted by kennethinvest, 09-22-2008, 06:04 PM
hello, I would like to make a very simple couter php script for a extremely high traffic website. The script only need to record the number of people visited the website. Should I use flat text or mysql database to store the data? Which one has better performance? Thanks

Posted by bigfan, 09-22-2008, 08:13 PM
This is probably as "very simple" as it can get with a file-based counter:Prime the file with '0', of course. Last edited by bigfan; 09-22-2008 at 08:24 PM.

Posted by kennethinvest, 09-22-2008, 08:28 PM
thank you for replying.....but I just want to know which one (text based or mysql) can have better performance in my situation.

Posted by bigfan, 09-22-2008, 08:30 PM
For "very simple":

Posted by Barti1987, 09-23-2008, 12:06 AM
If you only need to get page views, then file based will be much more faster than SQL. You use SQL, when things get complicated (like unique hits, options, etc..). Peace,

Posted by Tim Greer, 09-23-2008, 12:57 AM
File would be faster. MySQL needs disk i/o anyway, and read/write, plus you have the queries, and on, and on, and on. When you have more data that needs to be stored and fetched, indexed, etc., then database is a better solution, but not for something like this. The above solution is best.

Ця відповідь Вам допомогла?

 Роздрукувати цю статтю

Також прочитайте

What to do about another domain pointing toward your IP?

Posted by Frontpage1, 06-27-2008, 06:55 PMWe recently moved one server to a colo provider and...

How to post vars to an external gateway?

Posted by cnapsys, 09-21-2008, 10:05 PMHi guys, I need to send some variables to an external...

PHP - check if file exists on a remote server

Posted by Gigaron, 01-16-2008, 03:08 AMI have my static files duplicated and spread over multiple...

Forwarding/Default+POP3 Addy Doesnt Work - Piping/Webmail Works

Posted by InfiniteTech, 09-13-2007, 02:06 PMHello, My server which runs cPanel (license issued...

Setting up databases?

Posted by NotoriousKIM, 05-07-2007, 01:15 AMDoes anyone know anything about how to set up a mysql...