Question about number of forum viewings

Page 1 of 1 [ 6 posts ] 

gassy
Sea Gull
Sea Gull

User avatar

Joined: 2 May 2009
Age: 35
Gender: Male
Posts: 210
Location: Somerset, UK

05 Apr 2010, 5:56 am

I've noticed that all the viewings for threads are multiples of 3, is there any reason at all as towhy this is the case?

or is it some really random coincidence?

The only reason i can guess is that each person viewing it is counted as "3 people". Is this a bug or just to make people not feel bad when seeing they've only had a couple of viewings (which i think is okay) or some other reason?

gassy



Quatermass
Veteran
Veteran

User avatar

Joined: 27 Apr 2006
Age: 43
Gender: Male
Posts: 18,779
Location: Right behind you...

05 Apr 2010, 6:08 am

gassy wrote:
I've noticed that all the viewings for threads are multiples of 3, is there any reason at all as towhy this is the case?

or is it some really random coincidence?

The only reason i can guess is that each person viewing it is counted as "3 people". Is this a bug or just to make people not feel bad when seeing they've only had a couple of viewings (which i think is okay) or some other reason?

gassy


I don't know the reason why, but I have noticed the same thing myself. Alex is probably the person who knows best.


_________________
(No longer a mod)

On sabbatical...


leejosepho
Veteran
Veteran

User avatar

Joined: 14 Sep 2009
Gender: Male
Posts: 9,011
Location: 200 miles south of Little Rock

05 Apr 2010, 6:12 am

Someone else asked this question some time ago, and I think the answer had something to do with the increased count being displayed only every third time in order to save a little time and load on the server.


_________________
I began looking for someone like me when I was five ...
My search ended at 59 ... right here on WrongPlanet.
==================================


gassy
Sea Gull
Sea Gull

User avatar

Joined: 2 May 2009
Age: 35
Gender: Male
Posts: 210
Location: Somerset, UK

05 Apr 2010, 6:24 am

That sounds reasonable.

The only thing though is that when i look at a post and quickly go back to refresh it always goes up by 3. Of course it is very possible that up to 4 other people looked at it in that time period but the fact it is always like this even on forums which arent particularly active and state nobod else is viewing it, seems a little strange.

Also if that isn't the correct reason and alex is the only person who knows would it be better to contact him directly or just wait for him on here?



lau
Veteran
Veteran

User avatar

Joined: 17 Jun 2006
Age: 77
Gender: Male
Posts: 9,798
Location: Somerset UK

05 Apr 2010, 6:42 am

The number of viewing of a thread is just an accumulated statistic. Originally, every time a person viewed a thread, the view count was incremented. This meant the database was updated. To save a lot of this activity, someone thought up a trick: only update the count at random - on average, once every three times, and add three at that point. The result is a count that reflects how many views a thread is getting - but it is not a precise count.

I've wondered about ways to avoid the count looking peculiar (because of it always being a multiple of three). I have thought that it would be nice if it incremented exactly, for a while, and thereafter played the random game. However, that requires accessing the database every time, to fetch the current count, before deciding what to do - which isn't all that different, if terms of avoiding database access (well... a plain read is better than a full update... but stilll...)

And... I've just now thought of a good alternative trick...

For every time a view is made, pick a random number from one to fifteen, say.

In one case, add five to the view count.
In a second case, add four to the view count.
In a third case, add three to the view count.
In a fourth case, add two to the view count.
In a fifth case, just add one to the view count.
In all the other ten cases, do nothing.

This gives exactly the same savings in database accesses - i.e. two out of three times, nothing is done. However, it removes the fairly glaring "multiple of three" effect.

In "pseudocode":
let ADDEND = random (1 to 15)
if ADDEND <= 5 then update database, adding ADDEND into VIEWCOUNT

The only problem that can't really be avoided is the "It hasn't counted me viewing the thread" effect. I.e. when you know you have just viewed a thread, but you (in this set up, 2 times out of 3) won't see the count change.


_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports." Kamran Nazeer


gassy
Sea Gull
Sea Gull

User avatar

Joined: 2 May 2009
Age: 35
Gender: Male
Posts: 210
Location: Somerset, UK

06 Apr 2010, 9:47 am

lau wrote:
The number of viewing of a thread is just an accumulated statistic. Originally, every time a person viewed a thread, the view count was incremented. This meant the database was updated. To save a lot of this activity, someone thought up a trick: only update the count at random - on average, once every three times, and add three at that point. The result is a count that reflects how many views a thread is getting - but it is not a precise count.

I've wondered about ways to avoid the count looking peculiar (because of it always being a multiple of three). I have thought that it would be nice if it incremented exactly, for a while, and thereafter played the random game. However, that requires accessing the database every time, to fetch the current count, before deciding what to do - which isn't all that different, if terms of avoiding database access (well... a plain read is better than a full update... but stilll...)

And... I've just now thought of a good alternative trick...

For every time a view is made, pick a random number from one to fifteen, say.

In one case, add five to the view count.
In a second case, add four to the view count.
In a third case, add three to the view count.
In a fourth case, add two to the view count.
In a fifth case, just add one to the view count.
In all the other ten cases, do nothing.

This gives exactly the same savings in database accesses - i.e. two out of three times, nothing is done. However, it removes the fairly glaring "multiple of three" effect.

In "pseudocode":
let ADDEND = random (1 to 15)
if ADDEND <= 5 then update database, adding ADDEND into VIEWCOUNT

The only problem that can't really be avoided is the "It hasn't counted me viewing the thread" effect. I.e. when you know you have just viewed a thread, but you (in this set up, 2 times out of 3) won't see the count change.


Thanks for clarifying that Lau, though it does seem rather complicated.

Nice to see another person from Somerset too

Ooh Arr! :D