• Welcome to Simple Machines Community Forum. Please login or sign up.

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

Tiribulus

Quote from: Vekseid on May 03, 2009, 07:37:15 PM
Added a couple more, about controlling mod_expires and scheduled tasks in SMF 2.0

I copied and pasted your entire piece there just like it is into my httpd.conf file  to get started and when I tried to restart Apache I got this.

Failed to start apache :

Starting httpd2 (prefork) Syntax error on line 244 of /etc/apache2/httpd.conf:
'ExpiresDefault 3600': bad expires code, unrecognised <base> '3600'

The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

[1A..failed


It appears it doesn't like 3600 for the expires code.

Thanks

EDIT: I did some digging and changed it to ExpiresDefault A7200 for 2 hours and Apache starts now with that section in the conf file. I'll see how it goes.

Leemy

I had to change the avatar's custom path to 777 in order for the move to be successful. Does it stay 777?

Vekseid

'doh, sorry. I guess that was an Apache 2.2 trick, fixed : /

Making the avatar directory world-writable - yes, if you are running mod-php you will have 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.

Brettflan

Trimmed reference:
Quote from: Vekseid on February 16, 2009, 06:29:50 AM

ALTER TABLE `smf_members` CHANGE `member_ip` `member_ip` VARCHAR(255) NOT NULL;

ALTER TABLE `smf_members` CHANGE `member_ip2` `member_ip2` VARCHAR(255) NOT NULL;



ALTER TABLE `smf_messages` CHANGE `poster_ip` `poster_ip` VARCHAR(255) NOT NULL;


Is there a particular reason these shouldn't be VARCHAR(15) instead, or possibly VARCHAR(39) to support IPv6?
My first thought was that maybe one or more of those is used to store multiple IPs, but I checked by ordering those tables like "LENGTH(`member_ip`) DESC" and there were only single IPs listed for each of them.

aldo

Nice tips... Your tip #1 (The thing about the avatars) inspired me to create a modification to increase the efficiency of avatar loading in SMF. :D Now to wait :P

Vekseid

Quote from: Brettflan on June 23, 2009, 06:55:52 AM
Trimmed reference:
Quote from: Vekseid on February 16, 2009, 06:29:50 AM

ALTER TABLE `smf_members` CHANGE `member_ip` `member_ip` VARCHAR(255) NOT NULL;

ALTER TABLE `smf_members` CHANGE `member_ip2` `member_ip2` VARCHAR(255) NOT NULL;



ALTER TABLE `smf_messages` CHANGE `poster_ip` `poster_ip` VARCHAR(255) NOT NULL;


Is there a particular reason these shouldn't be VARCHAR(15) instead, or possibly VARCHAR(39) to support IPv6?
My first thought was that maybe one or more of those is used to store multiple IPs, but I checked by ordering those tables like "LENGTH(`member_ip`) DESC" and there were only single IPs listed for each of them.

It was a mass search and replace on the schema. >_>

Ideally, they would be BINARY(16) entries. I've actually written some basic code to handle strings coming in as IPv4 and IPv6, converting them to and from 128-bit addresses on the fly. There's no real efficiency savings, however, for VARCHAR(15) over VARCHAR(255).
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

Added disabling template evals for people who have opcode caches installed, as well as limiting thread replies.
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.

Cal O'Shaw

I'm doubtless going to sound rather dim, but how exactly does one run the php script to reset inactive users last read pointers?  Do I copy it into my site somewhere and then run it from my browser?  Load it as a cron job?

Grazie

Cal

Aleksi "Lex" Kilpinen

Quote from: Cal O'Shaw on July 02, 2009, 02:11:53 AM
copy it into my site somewhere and then run it from my browser
Yes :) Just place it in the same folder your forum installations root index.php is placed,
and point your browser to it.
A Finnish Project Manager (Support Specialist)
 Happily running multiple SMF 2.x installations.
  Fooling around with i7-10700 @ 2,90GHz-4.80GHz / 16Gb / RTX-2070 Super / 3840x2160 / Win 10 x64


How you can help SMF

"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Something like that

Quote from: Vekseid on June 29, 2009, 04:42:48 AM
Quote from: Brettflan on June 23, 2009, 06:55:52 AM
Trimmed reference:
Quote from: Vekseid on February 16, 2009, 06:29:50 AM

ALTER TABLE `smf_members` CHANGE `member_ip` `member_ip` VARCHAR(255) NOT NULL;

ALTER TABLE `smf_members` CHANGE `member_ip2` `member_ip2` VARCHAR(255) NOT NULL;



ALTER TABLE `smf_messages` CHANGE `poster_ip` `poster_ip` VARCHAR(255) NOT NULL;


Is there a particular reason these shouldn't be VARCHAR(15) instead, or possibly VARCHAR(39) to support IPv6?
My first thought was that maybe one or more of those is used to store multiple IPs, but I checked by ordering those tables like "LENGTH(`member_ip`) DESC" and there were only single IPs listed for each of them.

It was a mass search and replace on the schema. >_>

Ideally, they would be BINARY(16) entries. I've actually written some basic code to handle strings coming in as IPv4 and IPv6, converting them to and from 128-bit addresses on the fly. There's no real efficiency savings, however, for VARCHAR(15) over VARCHAR(255).

There is, but only if using MEMORY tables or temporary tables (not temporary disk tables). Because MySQL doesn't know the full width of the table, and tables in memory are stored with fixed row width, it must assign the maximum width for the VARCHAR column(s).


Arantor

No good deed goes unpunished
All helpful urges should be circumvented

ElectricSquid

Here's what should be a fairly simple question.
I run my own server.

Windows OS
Apache
MySQL
PHP
SMF
hMailServer

I currently have two drives.

C:/ runs the OS, Apache, MySQL, PHP, hMailServer, and the Apache wwwroot folder.
D:/ runs the Page File and is my backup storage.

The question is, what should I put on each drive to get the best performance out of this machine?

Something like that

Quote from: ∑£ℓ¢†®¡¢ §ợų¡đ on August 28, 2009, 10:39:42 PM
Here's what should be a fairly simple question.
I run my own server.

Windows OS
Apache
MySQL
PHP
SMF
hMailServer

I currently have two drives.

C:/ runs the OS, Apache, MySQL, PHP, hMailServer, and the Apache wwwroot folder.
D:/ runs the Page File and is my backup storage.

The question is, what should I put on each drive to get the best performance out of this machine?

I'm going to assume a few things:
* MySQL is tuned appropriately -- in other words, it has enough RAM that most reads are cached.
* You have enough memory that you don't really use swap
* The server mostly runs just SMF

If this is the case, the major source of disk usage/seeking will be two things:
* Database writes
* HTTP log writes

Thus, you want those two on different drives.

MySQL delays is where you'll notice the most latency. And the web logs are almost always file-appends, so the impact of the web logs is much smaller than MySQL. Also, you shouldn't be swapping much. Keeping that in mind, I'd do it like this:
C:\ - Everything, including the page file, except
D:\ - MySQL

ElectricSquid

August 29, 2009, 01:29:05 PM #94 Last Edit: August 29, 2009, 01:33:00 PM by ∑£ℓ¢†®¡¢ §ợų¡đ
Quote from: Mark Rose on August 28, 2009, 10:48:36 PM

I'm going to assume a few things:
* MySQL is tuned appropriately -- in other words, it has enough RAM that most reads are cached.
* You have enough memory that you don't really use swap
* The server mostly runs just SMF


MySQL tuned
Somewhat. I'm still working on that, but because I'm not a MySQL expert, tuning it scares the $#!+ out of me. If I break it, I'm not skilled enough to know what I did wrong, yet.

I looked into the RAM last night and it has 178M for the cache. Out of 2G of available RAM, I probably should give it a little more.


System Memory
This server machine was never intended to be a server (from the manufacturer of the mobo).
It's more like a gaming machine that I made into a server with the best stuff I had in the house.

It has 2G of RAM. I would add more, but simply cannot afford to do so.


Page File
As far as what "process manager" says, most of the time, only 200MB of Page File is used.
I have pushed it up to almost 1G, but that was while watching Hulu through the server :P


Server Usage
You are correct. Running SMF is the primary function of this machine.

I do run SETI (BOINC) at a 15% load on RAM and CPU during slow times.
The primary reason for BOINC is in case the server is ever stolen, it will give me their IP address if they ever connect it to the internet.
I also support the collective use of CPU time for science projects, because I'm a geek at heart.

Vekseid

You can see my LAMP guide for a basic overview of optimizing MySQL.

Once MySQL is configured nicely, the biggest speed improvement would be a custom php compile.
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.

ElectricSquid

August 30, 2009, 12:55:37 PM #96 Last Edit: August 30, 2009, 12:59:58 PM by ∑£ℓ¢†®¡¢ §ợų¡đ
Quote from: Vekseid on August 29, 2009, 03:02:10 PM
You can see my LAMP guide for a basic overview of optimizing MySQL.

Once MySQL is configured nicely, the biggest speed improvement would be a custom php compile.

@Vekseid
OK, that seems impressive.
How hard do you think it would be for me to implement your MySQL settings to my server?
I mean, beside the obvious need to change the file locations, is it as easy as a copy and paste of the my.ini? (or as it is on your machine, my.cnf)


ElectricSquid

August 30, 2009, 01:09:30 PM #97 Last Edit: August 30, 2009, 05:44:16 PM by ∑£ℓ¢†®¡¢ §ợų¡đ
Quote from: Mark Rose on August 28, 2009, 10:48:36 PM

I'd do it like this:
C:\ - Everything, including the page file, except
D:\ - MySQL

@Mark Rose
OK, so it will be done. Thanks for the tip!!

How would I achieve this?
Is it as easy as copying and pasting the entire MySQL folder over to drive D:\ and changing any reference to where MySQL resides from C:\ to D:\ ?
Or am I going to have to reinstall it completely to get it to hook up correctly?

Of course I would do a full backup first as a just in case.

EDIT - MySQLadministrator made it just way too easy.
All I had to do was copy the MySQL\data folder to drive D:\ and then get into MySQLadmin and tell it where the new data directory was. (simply change C:\ to D:\)

Vekseid

Quote from: ∑£ℓ¢†®¡¢ §ợų¡đ on August 30, 2009, 12:55:37 PM
@Vekseid
OK, that seems impressive.
How hard do you think it would be for me to implement your MySQL settings to my server?
I mean, beside the obvious need to change the file locations, is it as easy as a copy and paste of the my.ini? (or as it is on your machine, my.cnf)

I would seriously read through the settings and give a  thought as to which ones to implement. Your needs won't be the same as mine.
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.

Y2Chaos

Okay, let me apologize for some very very newb'ish questions. I am trying to accomplish #1 (move your uploaded avatar directory).

My domain is http://y2chaos.com
My forum is located at http://y2chaos.com/forums/index.php

This is what I did so far.

Using the ftp address of my site, I went and created the following directory

http://y2chaos.com/docs/forums/avs/

I then went to my admin panel and to Attachments and Avatars and changed everything to following

Avatars directory:     /home/content/m/i/s/mistabinks02/html/forums/avatars
Avatars URL:            http://y2chaos.com/forums/avatars

Upload directory:     http://y2chaos.com/docs/forums/avs/
Upload URL:             /forums/avs

I clicked save and then "Upload directory:" turned bold and the font turned red.

I then typed the following address

http://y2chaos.com/forums/index.php?action=manageattachments;sa=moveAvatars

I received the following error message:

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

That is where I am at right now. I am a complete smf newb. I tried to research this through the forums and docs but could not figure it out on my own. I know I may have to change some settings and/or permissions but I do not know how to do that. Any one care to walk a newb through this?

Advertisement: