Poll: Do you like this guide?
You do not have permission to vote in this poll.
Yes
88.24%
105 88.24%
No
11.76%
14 11.76%
Total 119 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 13 Vote(s) - 3.92 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] 10 Steps for Achieving the Maximum Possible Speed for Your MyBB Forum!
#1
Wink 
Welcome. I've decided to make a guide on achieving the maximum speed possible for your forum. It is quite easy to follow and they range from installing plugins to modifying simple code. I use all of the strategies listed below in my Fallout 4 Forum.

To measure how you did, click here and enter your URL. Note your scores before applying the tips below and after applying them. Also try using this tool to measure the raw speed of your forum. Again, do this before and after. Smile

Steps: [Order according to difficulty from easiest to hardest.]

Step 1: Get a better web host. It doesn't have to be a VPS or a dedicated server, it can be a shared host, and that's exactly what I use for my forum. Check out the forum and (assuming you have followed most of the steps below) your forum will be just as fast as mine. The server you have is the most important step to a fast website. I'd recommend Hostgator. I use their cheapest shared hosting plan and it's simply amazing. Click here to take a look at them. If you use the coupon code 'webspecial', you will be able to get $9.95 off the first month! If you're getting the first or second plan, you will be able to try it for free. It won't let you down, I promise. It's extremely secure and they offer amazing support.

Step 2: Disable forum jump. The jump menu is quite useless, and provides a high load on the server especially if you have a lot of forums. Disabling it can improve speed by reducing queries, too! Simply go into your Admin CP, Server and Optimization options and set ' Enable Forum Jump Menu?' to no.

Step 3: Enable GZIP Compression. Go into your Admin CP>Server and Optimization settings and set 'Enable GZIP compression' to 'yes', and the level to '9'. This speeds up your forum by compressing the page. Note that setting it to 9 will increase your server load. Set it to 4 if you'd like minimal server load while still getting some benefit.

Step 4: Let your CSS files load before your JavaScript. According to Google, this is a simple yet efficient method to reduce load time. This allows JS and CSS files to download in parallel. To do this, find headerinclude in your template list (ungrouped template) and find '{$stylesheets}'. Cut that move it right to the top headerinclude.

Step 5: Change your mybb_sessions table to a HEAP. (MEMORY) This table will be stored in the memory for increased performance. Go into PHPMYADMIN, click on your forum's database, find mybb_sessions, click on it, then press 'operations' at the top and change it to MEMORY.

Step 6: Install parsing plugins as well as a page optimiser. Download PreParser cache (If you experience server errors in some threads please disable this plugin) which speeds up script processing as well as Pre Parse Sig which the plugin as well as some other parsers can be found here. I also recommend installing Imei Page Optimizer (It shows last updated 2008, that's because it doesn't need to be updated). It makes the page smaller by removing unneeded HTML code.

Step 7: Compress all of your images. Use Yahoo's Smush It tool to losslessly compress your images. This means that the images will look exactly the same, but it will be up to 2x smaller! This means that load time will be reduced by downloading the images faster.

Step 8: Minify and Combine JavaScript and CSS files. - Minifying JavaScript and CSS reduces the size of the files and will result in faster load times although reduces readability of the file. Click here to use the compressor. Paste each of your JavaScript files (one at a time) in the box and click 'compress'. Copy the new code and paste it over the current JavaScript file (in your cPanel). Repeat for CSS by going into your theme Stylesheets in your Admin CP but make sure to change the 'file type' under the code box on the website.
Note: Please download the attachment below which contains all of the combined files, upload it to /jscripts/ and go into headerinclude in your template and replace the 3 lines that contain prototype.js, popup_menu, and general.js with "<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/mybb.js"></script>". Credit to querschlaeger for the download.

Step 9: Combine Prototype, General and popupmenu JavaScript Files. Combing JavaScript files into one will reduce the number of lookups and decrease loading time by only having to download one JavaScript file instead of 3. You can easily combine them by going into your cPanel and viewing each of the codes. Next, create a new text file called 'combined' or so. Copy the content of each of your JavaScript files and paste them under each. Once done, save the file as <anything>.js and upload into your cPanel. Next, go into your header include and delete the 3 lines that contain the JS file, leave prototype, and replace prototype.js with <anything>.js. This can also be done with editor.js and other JS files that aren't displayed globally.

Step 10: Install a CDN on your forum. This has many bonuses. If you serve images, JavaScript, and CSS files on the CDN, not only it will reduce server load and bandwidth, but it will decrease initial loading of images on your forum! This means that the first page load of images, CSS, and JavaScript will be quite fast as well as the following pages. I'd recommend MaxCDN by far. Popular forum such as HackForums use it. You can get 1TB for $29 (make sure to use the coupon code "WHT" for the discount!) which is more than enough for a year's worth of bandwidth, although, it depends on your traffic. This is a bit difficult. You will have to perform a few edits in global.php as well as change the image directory in the theme settings in your Admin CP and manually find and replace the image URLs in your CSS files. (Refer to this guide on how to setup your CDN to work with MyBB.).

Optional: Install CloudFlare on your website. It is completely free (with a subscription package which gives you a little bit of extra features). Read their reviews, watch the video, see all the amazing benefits it gives you. Best of all, it's completely free. It helps mitigate DDOS attacks on your forum. (I've tried this with my friends forum without Cloudflare and mine. It goes down when you attack the forum without Cloudflare protection but doesn't when you attack one with Cloudflare protection. Although, if the attack is really severe and starts impacting customers, Cloudflare will be forced to stop mitigating the problem.) It speeds up your site drastically and they also offer an amazing security service. There's too much to explain here and there is absolutely no harm in using this. Note: Apply this patch after installing Cloudflare to display IP's correctly. -

If you have any questions, please comment below. If you like the guide, please vote in the poll and rep me if you like. Smile


Attached Files
.js   mybb.js (Size: 103.5 KB / Downloads: 991)
Reply
#2
Updated - added another step.
Reply
#3
Not a bad tut, but you missed all about gzipping, setting cache control headers and moving JS to the bottom of the body - all of which help IMO
Reply
#4
Completely forgot about GZIP. Added, thanks. Smile

Reply
#5
Thanks for all the info. Smile

FYI: In the past, I think one of the Dev's suggested 'Enable GZIP compression' = 4 (or ~4), so you get some benefit without so much server load.
I don't remember who, or have the link right now.
#
MyBB is the best forum software! Exclamation

Reply
#6
Thanks, I'll make a note there.
Reply
#7
If you add star ratings and usercp and such to global, then it will load those files unnecessarily in the first page load; thus increasing load time.

I wouldn't recommend doing that.
Reply
#8
(05-07-2011, 12:59 PM)Renegader Wrote: If you add star ratings and usercp and such to global, then it will load those files unnecessarily in the first page load; thus increasing load time.

I wouldn't recommend doing that.

I agree. I would minify CSS, but the suggestion of creating one larger file to speed up page load is ridiculous.
Reply
#9
How can I change the table property of mybb_sessions to a heap?
Reply
#10
(05-07-2011, 03:34 PM)Morsec0de Wrote: How can I change the table property of mybb_sessions to a heap?
Should have made it more detailed, sorry.
Go into PHPMYADMIN, click on your forum's database, find mybb_sessions, click on it, then press 'operations' at the top and change it to MEMORY. (sorry, sometimes it has another name.)

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)