Twenty-four things you can do to make SMF go faster (Updated June 16th, 2010)

Started by Vekseid, February 16, 2009, 06:29:50 AM

Previous topic - Next topic

Something like that

Quote from: sheryltoo on February 17, 2009, 09:01:22 AM
QuoteTo move existing avatars to the new directory, access index.php?action=manageattachments;sa=moveAvatars


This is what I don't understand.
Sheryl

Click this: http://daysofourlives.sherylspage.com/index.php?action=manageattachments;sa=moveAvatars

sheryltoo

I get this error when going there:

The attachments upload directory is not writable. Your attachment or avatar cannot be saved.

My attachment directory is set to 777 so I'm  not sure why I'd get that error.
Maybe it has something to do with the fact that my site seems to be one big mess at the moment.
Sheryl

Something like that

The new directory that you created for the avatars has to be writable (777), too.

sheryltoo

I think I give up. Either I'm not understanding what needs to be done or the problems I'm having with my site are effecting how this works.

Here's what I did.
I created a folder in my root directory for smf for the attachments, then changed the path to attachments to read:
/home/site/public_html/root/attach and set the permissions to all 7's.
Under Avatar settings I changed it to say "Upload avatars to specific directory" and put this new path on both the lines.
Then I went to the area that you linked me to but don't see anything that says I can move avatars, however, I did copy all the avatars that were in the folder on my domain into the new folder but that didn't help.
I clicked a maintenance button and it said it found 24 images that were no longer there so I clicked fix or something and it deleted them all.
Before I did this, I had 36 avatars in the orginial attachment folder on my domain.

And I signed into my site with a non management account and tried to upload an avatar. It seemed to upload ok. No errors, however all I see is a red x so something isn't right.
Either I goofed up or my site isn't working right.
Sheryl

Something like that

When you moved the avatar files, it doesn't automatically update the database. That's what that link does :)

What did you set for the avatars URL? Something like http://daysofourlives.sherylspage.com/attach ?

Something like that

There's an emergency power outage in my building. It's a transformer problem. No ETA on power return. UPS won't last long. I'll be back later.

Vekseid

Quote from: Ben_S on February 17, 2009, 08:58:53 AM
In my experience the less you have per page, the less the resource usage, in fact in the past when I was having a lot of traffic, I used to reduce mine from 40 to 20 in order to cope with the influx.

Yes, you will have more page views to contend with with lower figures, but you will also be manipulating less data with each page view.

Actually, my page views and forum activity went up when I raised the figures, is what I was referring to.
Adult Role Playing Forums - - Over five million posts - - Elliquiy's LAMP configuration (maybe NSFW)

Blog about Forums and Servers - - Twenty things to make Simple Machines Forum go faster

Private/Instant Message requests for free support will be ignored.

Vekseid

Quote from: sheryltoo on February 17, 2009, 09:22:36 AM
I get this error when going there:

The attachments upload directory is not writable. Your attachment or avatar cannot be saved.

My attachment directory is set to 777 so I'm  not sure why I'd get that error.
Maybe it has something to do with the fact that my site seems to be one big mess at the moment.
Sheryl

http://daysofourlives.sherylspage.com/attach/

There are no files here, so it wasn't able to upload. Are you sure -that- directory is set to 777?
Adult Role Playing Forums - - Over five million posts - - Elliquiy's LAMP configuration (maybe NSFW)

Blog about Forums and Servers - - Twenty things to make Simple Machines Forum go faster

Private/Instant Message requests for free support will be ignored.

sheryltoo

Seeing how nothing seemed like it was working, I put the avatars back in the attachment folder and I think I've set everything back to the default settings as far as where to upload attachments.
One of the reasons I thought I'd do this is because no one's attachment was showing up  after I edited some files and no one could upload any more attachments even though the permission is set to 777.

Like I said, I think there's some issues going on with my site and I'm trying to get that straightened out. I think I need to do that first before I try to make any more changes but thanks for trying to help me.
Maybe I'll be back if I ever get my site working right again.
Sheryl

Ashdaw

A VERY helpful guide this is. I made a few changes that were refered to here and have already noticed a 50% (approx) improvement, thanks :)
You are more than welcome to visit my site.
Greycastle

Something like that

If you have a lot of attachments, this change can greatly lower SMF's CPU usage.

This modification disables theme loading for attachments. It's a simple tweak for a big boost.

In Load.php, copy this:

// The following determines the user agent (browser) as best it can.
$context['browser'] = array(
'is_opera' => strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false,
'is_opera6' => strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 6') !== false,
'is_opera7' => strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 7') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera/7') !== false,
'is_opera8' => strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 8') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera/8') !== false,
'is_ie4' => strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 4') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'WebTV') === false,
'is_safari' => strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false,
'is_mac_ie' => strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false,
'is_web_tv' => strpos($_SERVER['HTTP_USER_AGENT'], 'WebTV') !== false,
'is_konqueror' => strpos($_SERVER['HTTP_USER_AGENT'], 'Konqueror') !== false,
'is_firefox' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false,
'is_firefox1' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/1.') !== false,
'is_firefox2' => strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox/2.') !== false,
);

$context['browser']['is_gecko'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false && !$context['browser']['is_safari'] && !$context['browser']['is_konqueror'];

// Internet Explorer 5 and 6 are often "emulated".
$context['browser']['is_ie7'] = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false && !$context['browser']['is_opera'] && !$context['browser']['is_gecko'] && !$context['browser']['is_web_tv'];
$context['browser']['is_ie6'] = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false && !$context['browser']['is_opera'] && !$context['browser']['is_gecko'] && !$context['browser']['is_web_tv'];
$context['browser']['is_ie5.5'] = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5') !== false && !$context['browser']['is_opera'] && !$context['browser']['is_gecko'] && !$context['browser']['is_web_tv'];
$context['browser']['is_ie5'] = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.0') !== false && !$context['browser']['is_opera'] && !$context['browser']['is_gecko'] && !$context['browser']['is_web_tv'];

$context['browser']['is_ie'] = $context['browser']['is_ie4'] || $context['browser']['is_ie5'] || $context['browser']['is_ie5.5'] || $context['browser']['is_ie6'] || $context['browser']['is_ie7'];
$context['browser']['needs_size_fix'] = ($context['browser']['is_ie5'] || $context['browser']['is_ie5.5'] || $context['browser']['is_ie4'] || $context['browser']['is_opera6']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') === false;

to a new function, detectBrowser(), in Load.php. Don't forget to include global $context; at the top.

I replaced this in index.php:

// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
loadTheme();

with

// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
if (! (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach'))
loadTheme();
else
detectBrowser();


On my system, it reduced my CPU usage by 14%. I do about 4 downloads for every 1 page view.

I do about 800,000 attachments & thumbnail downloads per day, so it really added up.

shumilica

I want to move the avatar from attachements, but i have enabled the "Encrypt stored filenames" option, and I want to ask so i'll be sure:
If I will go to mysiteforumurl/index.php?action=manageattachments;sa=moveAvatars every avatar jpg will decrypt and everything will be allright, or this option is only available when "Encrypt stored filenames" is disabled?
Today, if you're not confused it means you're not thinking clear!


shumilica

#33
Very weird. I tried to go to myforumurl/index.php?action=manageattachments;sa=moveAvatars, and it got me on the first page without doing nothing :o I have created a folder, i specified in avatars settings to use that folder to put avatar, new avatars go there (so it is chmod correctly) but old one doesn't move when i specify that hidden function.

This hidden future is only in SMF 1 series? Because i have 2.0 RC1 :-?


Later edit:
From what I see sintax for actions/url in smf 2 is different froms smf 1. So maybe the function exists but it is a different URL for SMF 2.

For example, to see somebody's pots in SMF1 the link would be like this:
forum_url/index.php?action=profile;u=1422;sa=showPosts

but for SMF 2 the link is this:
forum_url/index.php?action=profile;u=1422;area=showposts;sa=messages

Today, if you're not confused it means you're not thinking clear!

Something like that

I'm not sure about that function in SMF 2. I haven't looked. It was never a documented feature ;)

shumilica

#35
I figured it out....
In manageattachements.php i searched for moveavatars and saw this:
void MoveAvatars()
      - move avatars from or to the attachment directory.
      - called from the maintenance screen by
       index.php?action=admin;area=manageattachments;sa=moveAvatars

So maybe you want to edit your first post so that SMF 2.0 Users can use it too. Everythink worked like a charm, it asked for my password and then went to file maintanance. I checked the folder in ftp and it was full with moved avatars.

Thank you for your support!


P.S. it is documented in smf function pages: http://support.simplemachines.org/function_db/index.php?action=view_function;id=89
Today, if you're not confused it means you're not thinking clear!

exxocet

#36
  The myISAM > innoDB conversion is recommended for all forums, including small or medium?
I have a forum with 2500 members, 40 members online at the same time average. They seems to publish ~1post/5minutes, 25,000topics, 70,000posts, not big load there, but there is a lot of searching. Every member use the search heavily.
The forum is fast (after optimization, bandwidth lows from over 1 GB/day to 500MB/day), but I'm just looking to make it even faster. I'm on VPS, so I can modify mySQL characteristics. It would be recommended to go with innoDB on some tables? Thank you.


Something like that

Quote from: exxocet on February 24, 2009, 12:47:06 AM
  The myISAM > innoDB conversion is recommended for all forums, including small or medium?
I have a forum with 2500 members, 40 members online at the same time average. They seems to publish ~1post/5minutes, 25,000topics, 70,000posts, not big load there, but there is a lot of searching. Every member use the search heavily.
The forum is fast (after optimization, bandwidth lows from over 1 GB/day to 500MB/day), but I'm just looking to make it even faster. I'm on VPS, so I can modify mySQL characteristics. It would be recommended to go with innoDB on some tables? Thank you.

Your forum is big enough that you would likely benefit from switching to InnoDB.

You may wish to use Sphinx for search, if you're getting a lot of search activity. Search around the forums here.

exxocet

#38
  Thank you Phalloidium,
Indeed, I forgot to tell that I consider about using Sphinx, but i'm not sure if it's fit for me, but your answer helped there too. Just one more question, Sphinx will change the search alghorithm? I like SMF kind of searching, per instance if you search for termA termB it would first display the results containg both terms. On Invision and phpBB it's a completely mess on search, even if you search two terms, it will dispaly results containg each of those terms, not both. I hate that. Will Sphinx stick with the SMF search?
  In conversion innoDB tutorial that's nothing about smf_log_search_words table (available only for index search)? It should be converted too? Thank you very much.

Something like that

If you install Sphinx, and then don't like it, you can easily change your search mechanism back in the Admin area.

Advertisement: