SMF Support > Server Performance and Configuration

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

<< < (3/79) > >>

Stickied now. :D 

Something like that:
smf_log_online can also be converted to type MEMORY in MySQL 5.0.3 and later (needed to use a long varchar for the url field -- some sites will have long urls). This can speed things up quite a bit if you have a lot of users online.

--- Code: ---ALTER TABLE `smf_log_online` CHANGE `url` `url` VARCHAR( 1024 ) NOT NULL, ENGINE = MEMORY;

--- End code ---

I've been running like that for over a year without issue.

edit: fixed wrong table type in code.

I think you mean MEMORY there?

Online is the current URL I believe, could probably get away with 255.

Something like that:

--- Quote from: Vekseid on February 17, 2009, 03:18:04 AM ---I think you mean MEMORY there?

--- End quote ---

Fixed. Thanks!

--- Quote ---Online is the current URL I believe, could probably get away with 255.

--- End quote ---

No. It tracks the area the action and the user agent to guard against session id hijacking via cookie theft. For instance, here's some examples:

--- Code: ---a:1:{s:10:"USER_AGENT";s:48:"Opera/9.62 (X11; Linux i686; U; en) Presto/2.1.1";}
a:2:{s:5:"board";i:11;s:10:"USER_AGENT";s:90:"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/2009011913 Firefox/3.0.6";}
a:1:{s:10:"USER_AGENT";s:87:"Mozilla/5.0 (Windows; U; Windows NT 5.1; fi; rv: Gecko/2009011913 Firefox/3.0.6";}
a:3:{s:6:"action";s:7:"profile";s:1:"u";s:4:"3698";s:10:"USER_AGENT";s:127:"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1";}

--- End code ---

255 is way too short. 512 might be cutting it a bit close. The maximum length in my table is currently 322:

--- Code: ---mysql> SELECT MAX( Length( url ) )  FROM `smf_log_online`;
| MAX( Length( url ) ) |
|                  322 |
1 row in set (0.00 sec)

--- End code ---

So you can only do the conversion to MEMORY with a varchar 512 or so, and you can only do varchars longer than 255 in MySQL 5.0.3 or later.

...did not know it was a serialized string -_-

Should probably instead roll that into a new item that goes over converting tinytext and some text columns to varchar in general.


[0] Message Index

[#] Next page

[*] Previous page

Go to full version