Skip to main content
Topic: Avatars ?'s (Read 8529 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Avatars ?'s

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

Re: Avatars ?'s

Reply #1

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 ...

Re: Avatars ?'s

Reply #2

I'm curious about #1 too. I can't think of any good reason we would need to keep track of avatar views...
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Avatars ?'s

Reply #3

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

 emanuele likes drop things... O:-)
Bugs creator.
Features destroyer.
Template killer.

Re: Avatars ?'s

Reply #4

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?

Re: Avatars ?'s

Reply #5

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.

Re: Avatars ?'s

Reply #6


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?

Re: Avatars ?'s

Reply #7

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.
 emanuele feels the answer is in SMF 1.0.
Bugs creator.
Features destroyer.
Template killer.

Re: Avatars ?'s

Reply #8

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.