Make sure you are locking the file if you do this,

With a high amount of traffic text based counters don't usually work too
well because you have to deal with contention, what if two users view a page
at the same time, you will run into a corrupt or inaccurate number.

If you do file locking do you display an error asking them to refresh or do
you handle it some other way?  This becomes apparent especially with higher
traffic sites like he was talking about.

You may well be best off using a database, either that or invest some
serious thought into how you are going to handle multiple clients loading
pages.

Jason

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 12:56 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] counter for HIGH traffic site


If it should be fast,
avoid using mysql, just write a file with your number,
if there´s a new request, get your number, add one and write it back.
So you avoid mysql-"SQL parsing", opening Database, searching data,
send to process, php putting in var.......
just open, read, add, write, close
HTH Oliver
At 08.04.2002  14:32, you wrote:
>
>You might also want to setup the table your updating the hits in
>as a HASH type table which runs completely in RAM, and as a result
>is extremely fast. The only obvious downside, is the data (or hits in this 
>case)
>are lost on reboot.
>
>Adam Voigt
>[EMAIL PROTECTED]
>
>On Mon, 8 Apr 2002 09:41:39 -0700, Jim Lucas [php] <[EMAIL PROTECTED]>
wrote:
> > as long as you are only inserting information into the mysql db on each 
> page
> > load, then you shouldn't have a problem.  make sure you keep you
indecies
> > down to a minimum.
> >
> > Jim Lucas
> >
> > ----- Original Message -----
> > From: "Craig Westerman" <[EMAIL PROTECTED]>
> > To: "php-general-list" <[EMAIL PROTECTED]>
> > Sent: Saturday, April 06, 2002 11:57 PM
> > Subject: [PHP] counter for HIGH traffic site
> >
> >
> > > I'm needing counter for site that receives 60 to 80 hits a minute.
Many I
> > > have tried cause excessive server load and need to be deactivated or
they
> > > lose data and return to zero without warning. All tried so far have
been
> > > written in Perl.
> > >
> > > Anyone here know of a PHP counter that would handle HIGH traffic with
> > little
> > > added server load? Would using MySQL to store count be of any benifit?
> > >
> > > Thanks
> > >
> > > Craig ><>
> > > [EMAIL PROTECTED]
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to