Topic: Slow posting

A forum I administer is really slow to post. All other functions like reading and searching are fine, it just seems to be the actual posting that takes a long time.

I enabled debug mode and show queries, this is what I was able to capture in the redirect page (not easy to do that!):

Post entered. Redirecting ?

Click here if you do not want to wait any longer (or if your browser does not automatically forward you)
Debug information
Time (s)     Query
0.00066     SELECT u.*, g.*, o.logged, o.idle FROM tog_users AS u INNER JOIN tog_groups AS g ON u.group_id=g.g_id LEFT JOIN tog_online AS o ON o.user_id=u.id WHERE u.id=2
0.00025     UPDATE tog_online SET logged=1205174047 WHERE user_id=2
0.00015     SELECT * FROM tog_online WHERE logged<1205173747
0.00009     SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics FROM tog_forums AS f LEFT JOIN tog_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=1) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id=3
0.00037     INSERT INTO tog_topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES('todd', 'test 8', 1205174077, 1205174077, 'todd', 3)
0.00018     INSERT INTO tog_posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES('todd', 2, 'xxx.xx.xxx.xxx', 'test', '0', 1205174077, 967)
0.00017     UPDATE tog_topics SET last_post_id=4716 WHERE id=967
0.00021     SELECT id, word FROM tog_search_words WHERE word IN('test')
0.00067     INSERT INTO tog_search_matches (post_id, word_id, subject_match) SELECT 4716, id, 0 FROM tog_search_words WHERE word IN('test')
0.00023     INSERT INTO tog_search_matches (post_id, word_id, subject_match) SELECT 4716, id, 1 FROM tog_search_words WHERE word IN('test')
0.00133     SELECT COUNT(id), SUM(num_replies) FROM tog_topics WHERE moved_to IS NULL AND forum_id=3
0.00396     SELECT last_post, last_post_id, last_poster FROM tog_topics WHERE forum_id=3 AND moved_to IS NULL ORDER BY last_post DESC LIMIT 1
0.00026     UPDATE tog_forums SET num_topics=870, num_posts=4559, last_post=1205174077, last_post_id=4716, last_poster='todd' WHERE id=3
0.00020     UPDATE LOW_PRIORITY tog_users SET num_posts=num_posts+1, last_post=1205174077 WHERE id=2
Total query time: 0.00873 s

So while it looks like it all happens rather quickly, it's actually very slow for the end user.

I also enabled slow queries logging in mysql and it doesn't register any problems.

Any ideas where the problem might be?

PunBB 1.2.15
Environment
    Operating system: Linux
    PHP: 4.4.0-3ubuntu2 - Show info
    Accelerator: N/A
Database
    MySQL 4.1.12-Debian_1ubuntu3.7-log
    Rows: 157412
    Size: 6.16 MB

Thanks much!

Re: Slow posting

Probably a problem with the network at your host.
By the way, what's the server load?

Re: Slow posting

elbekko wrote:

Probably a problem with the network at your host.
By the way, what's the server load?

The load is light; it's a VPS with a few sites but not a lot of traffic. Uptime shows load less than 0.10.

I'll contact my host and see if something's up there.

Thanks!

Re: Slow posting

If the actual page generation time is low, the problem is likely network related as opposed to PunBB related.

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

Re: Slow posting

I tracked it down to the Akismet plugin; after removing that code from post.php, it's like lightning.

Re: Slow posting

Aha: that's probably because of the fact that it's making a request to the external Akismet service.

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize

7 (edited by philco 2008-04-05 22:21)

Re: Slow posting

It has to do with Akismet's servers and the HTTP/1.1 protocol. You can read more about the fix here. Basically open up the includes/Akismet.class.php and change:

$http_request  = "POST " . $path . " HTTP/1.1\r\n";

to

$http_request  = "POST " . $path . " HTTP/1.0\r\n";

Re: Slow posting

Michael Gauthier's solution in the comments linked there is the one I would go with, but yes, that sounds like it's the problem. smile

http://fluxbb.org

Free PunBB Hosting - lots of mods, easy to customize