Firefox PHP

Improving Phorum performance

Posted by cactux 
Improving Phorum performance
February 17, 2015 11:31AM
Hello,

I am currently in the process of improving my website performance.
And although Phorum is great, and I use it since several years, there may be some things to do to improve its performance.

First some background:
Users of my web site were complaining about slow pages, so I decided to take action. My PHP code was a bit old, my CSS and JS files management not really up-to-date. During the past years I have been working on adding new features to my web site, not improving and tuning the current code.
So I submitted my web site to online performance analyzers, here are some example with a phorum.org URL (http://www.phorum.org/phorum5/read.php?61,155655):
[gtmetrix.com]
[www.webpagetest.org]
[developers.google.com]
(if the direct link does not display the result, you can submit it yourself).

Conclusion:
There are many things one can do, such as:
* reducing image sizes: some GIF or PNG files could be reduced
* minifying CSS
* minifying JS
* moving JS at the bottom of the page to have a faster display of the page
* combine images using CSS sprite
* specify image dimensions
* etc.

There are a lot of small things we could do to improve it, and I can code some of them.
How do I proceed? Where can I get the latest dev branch? Or do I submit patches on the latest stable code? And where: here or by email?

Thanks :)

Cactus : [www.cactuspro.com]
Re: Improving Phorum performance
February 17, 2015 05:11PM
A few things that have more effect on your page speed than those mentioned.

Internet latency.
Host server loading, and memory.
Speed of the slowest connection between your host and the internet.

Click the development link above, download the Phorum Core zip (look for "Download Zip" in the right column)
Unzip the file, then search on "performance" inside the files. (This info is in older versions also)
Note also that there is a built in timing that you can enable in the "Phorum Core".

For a Phorum with substantial quantity of messages see... seriously take a look.
http://forums.mysql.com/
Re: Improving Phorum performance
February 17, 2015 08:49PM
Hi Scott,

Thanks for your answer. You are right, there are many things to work on.
I listed only those which could be done on Phorum code.
Other important things are the compression and the cache settings, but these are mainly at server level.

Improving the code, even if only a small part of the performance, is also important for technical quality rating of the page, which is one among many parameters of search engine ranking.

Thanks for mentionning the link to development, I did not see it :-/

The MySQL forums are great: 150 913 topics for 420 072 messages, in 89 forums.
My forums have 55 193 topics for 554 869 messages, in 15 forums.
But I am no SQL expert, if there's some tuning done, it must be awesome at MySQL's :D

Cactus : [www.cactuspro.com]
Re: Improving Phorum performance
February 17, 2015 09:45PM
cactuspro.c0m/forum/list.php?1,page=1124 this page 0.629 sec.

cactuspro.c0m/forum/read.php?1,1820 this topic 0.893 sec.

From Chicago area, USA
Re: Improving Phorum performance
February 22, 2015 10:42AM
For doing some coding and proposing the result just make a "fork" of the core -> [github.com] and send an pull request.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Improving Phorum performance
February 27, 2015 08:21PM
I found that generating a cached version of the CSS and JS for a forum made a big difference. You'll have to write a script to curl/wget the CSS for a page, and a module to check if the cached CSS file exists and serve that instead. The CSS is generated dynamically on every hit and many modules add their own CSS/JS so you can massively reduce the number of httpd requests & PHP execution just by doing this.

I have my Phorum pages embedded in my site template, so I use end_output to wrap the output, and do it here.
Note all the $site stuff is my own cross-domain stuff, you can just replace it with your static website url or whatever.
The page->addJS and addCSS calls just fill an array, that I later use in the templates to generate the actual HTML.

Language: PHP
if ($PHORUM["DATA"]["PRINTVIEW"]) { $page->addCSS($PHORUM["DATA"]["URL"]["CSS_PRINT"]); } else { $cached = ';/style/phorum/cached_'; . $site->getID() . ".css"; if (file_exists(';.'; . $cached)) $page->addCSS($cached . "?serial={$page->css_serial}"); else $page->addCSS($PHORUM["DATA"]["URL"]["CSS"]); } $cached = ';/javascript/phorum/cached_'; . $site->getID() . ".js"; if (file_exists(';.'; . $cached)) $page->addJS($site->getStaticURL() . $cached . "?serial={$page->js_serial}"); else $page->addJS($PHORUM["DATA"]["URL"]["JAVASCRIPT"]);

Just don't forget to regen the cache .js and .css files if you change the template CSS or add/remove a module.

The serial args to the .js and .css files don't do anything, but it's an easy way to force client browsers to reload the resource (cache miss) by incrementing the serial. This is necessary if you have Expires: headers set up on your web server, you should make sure that you're returning lots of 304 Not Modified for your static web resources

Looking at the source of your list.php, you can see these 3 (maybe 2, I can't remember if most browsers fetch the print css on demand or not) php files are being called on EVERY page load so thats 3x or 4x the request load on your web server than is really ideal....

  <link rel="stylesheet" type="text/css" href="[www]. cactuspro.com/forum/css.php?1,css" media="screen" />
  <link rel="stylesheet" type="text/css" href="[www]. cactuspro.com/forum/css.php?1,css_print" media="print" />
  <script type="text/javascript" src="[www]. cactuspro.com/forum/javascript.php?1"></script>

___
Skye Nott
Corvus Digital



Edited 7 time(s). Last edit at 02/27/2015 08:33PM by Skye N..
Re: Improving Phorum performance
February 27, 2015 08:27PM
PS it would be really nice if "Show full URLs" was checked in the BBCode module for this forum ;)

___
Skye Nott
Corvus Digital
Sorry, only registered users may post in this forum.

Click here to login