ElkArte Community

Elk Development => Feature Discussion => Exterminated Features => Topic started by: Spuds on January 11, 2013, 04:29:31 pm

Title: Avatars ?'s
Post by: Spuds on January 11, 2013, 04:29:31 pm
I noted that SMF did this: https://github.com/SimpleMachines/SMF2.1/pull/259/files

And I have a couple of questions
1) Why do we keep track of avatar views e.g. increaseDownloadCounter() on them, that does seem superfluous
2) Not a bad idea to cache the results of getAvatar() for some period of time, although I have no idea what RIP_JITTER is all about.... BUT thats also a pretty easy query for the DB so not sure the cache overhead is not more then the db overhead of a primary key query.
3) We should set as default that uploaded avatars go to their own directory so they can be served directly instead of via php
Title: Re: Avatars ?'s
Post by: Spuds on January 16, 2013, 11:00:46 am
I did some testing on item 2 for my own understanding, very synthetic but gave me some direction.

The results with the cache off were overall slower, with file cache on a small improvement was seen (and those were pretty good conditions meaning high cache hits), and if using a real cache they were significantly better.

I added in the cache to the avatar query to help, it should provide some improvement, particularly for recent topic views etc.   Still don't know on number one ...
Title: Re: Avatars ?'s
Post by: IchBin on January 16, 2013, 07:27:38 pm
I'm curious about #1 too. I can't think of any good reason we would need to keep track of avatar views...
Title: Re: Avatars ?'s
Post by: emanuele on January 16, 2013, 07:30:32 pm
Quote from: Spuds – 1) Why do we keep track of avatar views e.g. increaseDownloadCounter() on them, that does seem superfluous
...no idea, I would say drop it. :P

/me likes drop things... O:-)
Title: Re: Avatars ?'s
Post by: Bloc on January 17, 2013, 05:53:28 pm
Caching avatar code..does that mean caching queries for every avatar in separate files? Won't it be enormous amounts of cache files if you got 10k members? Which again could be a problem should you want to clear all cached files?
Title: Re: Avatars ?'s
Post by: Spuds on January 17, 2013, 07:46:34 pm
Yes thats a valid concern... I thought the same thing as well

The cache does have a TTL with each entry so times don't live forever, just long enough to be of use, so really the cache would be active/successful for the just most recent and active topics (or really the posters avatars in those), not all avatars nor forever.

This is also only for avatars that are server stored without the use of a separate avatar directory.  SMF saves (by default) those avatars like an attachment (?action=dlattach;) so to see the avatar its goes through that system, not a simple http:// request.  If you use a directory (and you should) this is a moot point.

So I'm still deciding what to do here, the cache does help somewhat, but not sure we should use the ?action=dlattach; at all ... still trying to understand why it was done that way.
Title: Re: Avatars ?'s
Post by: ahrasis on January 17, 2013, 08:20:36 pm

I wonder how did you determine post/reply #1 since there is none shown in in this post display page. Or do you mean option number in the OP?

But still, where can I enable that post/reply # thing in here?
Title: Re: Avatars ?'s
Post by: emanuele on January 18, 2013, 02:58:01 am
Tooltip over the subject.

Quote from: Spuds – So I'm still deciding what to do here, the cache does help somewhat, but not sure we should use the ?action=dlattach; at all ... still trying to understand why it was done that way.
/me feels the answer is in SMF 1.0.
Title: Re: Avatars ?'s
Post by: Bloc on January 18, 2013, 11:14:14 am
Yep, I vaguely remember it was something with security there too, but I've forgot exactly why/how. (lol, to think I been into SMF since 2003 when 1.0 was out..yikes. :) )

But you are right, a short TTL will help, and of course, not all members uploads. Gravatar for example, seems to be popular.