02-27-2007, 01:01 PM
Little performance tweaks for medium and large boards. Tested and applied on forum with:
173 000 posts (>510 daily)
17 600 threads (>50 daily)
15 000 users (>45 daily)
1. In file member.php
FIND:
REPLACE WITH:
Huge benefit in query time while viewing members profiles which can normally take seconds. After removing WHERE clause - it takes 0.0011451 sec. On my board I had about 70 posts with visible <= 0 so removing the WHERE clause is a unnoticable "error". But on some sites this can lead to bad statistics of user's posts per day.
2. In file global.php
FIND:
REPLACE WITH:
In original code there is about 2/11 chance for deleting old thread redirects ($db->delete_query(TABLE_PREFIX."threads", "deletetime != '0' AND deletetime < '".time()."'")
. It can be reduced to 1/11
. This query is really slooooooow so one may think of even less chance.
3. In file global.php
FIND:
REPLACE WITH:
(or something like $rand == X, where X is a number from 0 to 10).
When we have many users online we can reduce the chance for deleting old guest sessions from 3/11 to 1/11.
And others from:
http://community.mybboard.net/showthread.php?tid=16811
http://community.mybboard.net/showthread.php?tid=10368
http://community.mybboard.net/showthread.php?tid=16814
TODO: Check MySQL queries on 3 main pages:
- index.php
- showthread.php
- forumdisplay.php
to reduce number of Using temporary, Using filesort or just slow queries.
173 000 posts (>510 daily)
17 600 threads (>50 daily)
15 000 users (>45 daily)
1. In file member.php
FIND:
PHP Code:
$query = $db->simple_select(TABLE_PREFIX."posts", "COUNT(pid) AS posts", "visible > 0");
PHP Code:
$query = $db->simple_select(TABLE_PREFIX."posts", "COUNT(pid) AS posts");
2. In file global.php
FIND:
PHP Code:
if($rand > 8 || isset($mybb->input['force_thread_expiry']))
PHP Code:
if($rand > 9 || isset($mybb->input['force_thread_expiry']))
. It can be reduced to 1/11
. This query is really slooooooow so one may think of even less chance.3. In file global.php
FIND:
PHP Code:
if($rand > 4 && $rand < 8)
PHP Code:
if($rand == 9)
When we have many users online we can reduce the chance for deleting old guest sessions from 3/11 to 1/11.
And others from:
http://community.mybboard.net/showthread.php?tid=16811
http://community.mybboard.net/showthread.php?tid=10368
http://community.mybboard.net/showthread.php?tid=16814
TODO: Check MySQL queries on 3 main pages:
- index.php
- showthread.php
- forumdisplay.php
to reduce number of Using temporary, Using filesort or just slow queries.