LazyTech

Reduce Server Load Of MyBB

4 minutes Read

Το MyBB is one of the best free platforms to create a forum. However, it has some problems with server resources.

With a simple search, you can find dozens of reports about increased memory consumption (and processor) on servers, especially on shared. My friend recently asked me to help him, because the company hosts his site blocked his access.

There are some solutions, such as this Guide (or this one), but when the forum has a lot of visits, MyBB again consumed too much memory, so another solution had to be found.

One problem with MyBB is how parses and displays the posts, and a solution is to use this plugin, where it actually caches the posts (and signatures) and display them from there.

Although these solutions that somewhat reduced resource consumption, yet there were problems with the server and I decided to look more closely at the issue. So I found that the problem was mainly caused by the attachment.php and showthread.php files, with the first one having the most consumption. Looking at the code, I noticed that it did a lot of queries in the database (for a single attachment), meaning that in posts with many pictures as attachments and in a post that had many visits, it does too many queries, which had to be reduced somehow.

So the only solution was to use a simple yet effective cache method, where it would help to reduce the queries. The solution is relatively simple and it works.

First create a new folder in the forum's "cache" folder and name it "thumbs" (without quotation marks). There upload a blank file named "index.html" to prevent the files from appearing, or block any access with a .htaccess file with the following:

Order Deny,Allow
Deny from all

Now open the "attachment.php" file with a text editor. In the beginning, insert these two functions, are to read/write the cache:

That's it. Try and you will see a significant change in attachments' speed, especially if there are many photos in one post.

Something similar can be done in the file "showthread.php", but it is not so necessary, since a forum with many attachments causes server issues. You can also disallow the visitors viewing the thumbnails or even set the browser to cache images instead of asking them again from the server (it requires additional code in the "attachment.php" file or in .htaccess file). I hope the newer version of MyBB (2.0) to solve these problems.

Many gamers want a classic controller to play their games. Despite the fact that WiiU already have a classic controller, a company from Japan thought something better, to connect a Dualshock 3 or 4 on Wii U.