How to optimize vBulletin 3.x and 4.x for less server load and provide fast loading site experience to members as well as guests.
Couple of months back, I started working for a client who had more than two million posts in his vBulletin forum. He had issues of very slow forum experience for users. I did a long list of to-do stuff to optimize vBulletin for better user experience as well as reduce the server load. A couple of months down the line he has no complaints from a user on forum speed now.
Let me share the same list in detail here. It not only will help optimize vBulletin on your own but will also help me in making the list of things to be done for optimizing large forums for future clients as well.
1. Move Attachments and Images to File System
By Default vBulletin have Attachments / Images / Avatars all are stored into Database. You need to make sure you move them to files.
- Admin CP > Attachments > Attachment Storage Type
- Admin CP > User Albums > Album Picture Storage Type
- Admin CP > Avatars > User Picture Storage Type
2. Store CSS StyleSheets as Files
vBulletin by default renders the CSS as inline in the head part of HTML. It, in turn, increases the size of each page and eliminates the option for caching.
Storing the CSS as a file not only reduces the code from each page but also allows caching of the CSS file by browsers.
Apart from the editable CSS vBulletin also adds an extra CSS file clientscript/vbulletin_important.css. Copy the content of the file into your vBulletin CSS editor to make sure you have only one CSS file to save an additional server request.
You can even go one step forward and copy the content of the CSS file generated from your vBulletin interface and minimize CSS. Upload the file and use the CSS file instead of the CSS front end interface in vBulletin admin.
Note if you are using the CSS file, make sure your developers are aware of where to make the changes. Editing the CSS inside the admin will not work. Moreover, removing the CSS file from the “headinclude” template can mean it can impact the addition of editor CSS on a new thread and new post pages.
3. Reduce HTML for guest (or otherwise)
A lot of HTML can be avoided to render your pages much faster and reduce server load. Let me get into each of them one by one.
- Disable Forum Jump Menu – I have Forum Jump Menu disabled for guests using vbSEO. However, if you are not using vbSEO, you can disable the forum jump completely from Admin CP. I am sure not many of your forum users use the forum jump menu. The best thing is to try and turn it off and see if anybody reports that they are missing it. If no one reports, you can safely assume no one cared about using it either. Forum jump causes the server to work harder to generate the menu and then uses the bandwidth to display it on each page load. You can change forum jump options from Admin CP > vBulletin Options -> General Settings -> Use Forum Jump Menu.
- Disable Posting Rules – Posting rules at the bottom of every thread and forum pages does not help much to anybody. It only adds to the final HTML. There is no option in vBulletin to disable it, and so you need to edit one single template to disable the posting rules. I disabled it for guests, but you can even disable it completely. To disable posting rules for guests edit the “forumrules” template and add the following at the top. <if condition=”$show[member]”> And at the end of the template add </if>. Posting rules will only show to members and not to guests. You can delete the content of the template, and it will not show.
- Disable username menu for guests on thread pages – Showthread page shows posts. Each post has a username, but when you click on those usernames, it loads a popup menu. The menu is rarely of any use to guests because by default, “email to members” option is off. PM is an option only for members. So if you want, you can turn those menus off for guests. vBSEO provides it as an option.
- Disable who is online for guests – Edit the usergroup ( Admin CP > Usergroups > Usergroup Manager ) called “Unregistered / Not Logged In” and Set “Can View Who’s Online” to off.
- Disable Template Name in HTML Comments– More comments in HTML means more time browser will need to download the HTML. Ideally, on a live server, you should turn off the template name in HTML. Admin CP > vBulletin Options > vBulletin options > General Settings > and select No for Add Template Name in HTML Comments.
4. Limit Spider Activity
If you want to save on your bandwidth, you should have robots.txt file to restrict areas of forums you don’t have much for spiders.
User-agent: * Disallow: /admincp/ Disallow: /images/ Disallow: /modcp/ Disallow: /attachment.php Disallow: /search.php Disallow: /newreply.php Disallow: /newthread.php Disallow: /editpost.php Disallow: /profile.php Disallow: /register.php Disallow: /login.php Disallow: /subscription.php Disallow: /private.php Disallow: /report.php Disallow: /sendmessage.php Disallow: /memberlist.php Disallow: /misc.php Disallow: /moderator.php Disallow: /postings.php Disallow: /sendtofriend.php Disallow: /threadrate.php Disallow: /usercp.php Disallow: /showgroups.php
5. Compress Output (GZIP)
vBulletin provides compression for HTML output, but I prefer to get it done through Apache via mod_deflate. Disable Zipped output in vBulletin. vBulletin Options -> Cookies and HTTP Header Options -> GZIP HTML Output And add the following lines to your httpd.conf file in Apache.
Restart Apache webserver. Additionally, you should also use Apache to cache static content. Refer article by coderzone on How to Decrease Web Page Loading Time especially caching of static content.
6. Install APC/XCache/eAccelerator on your server
I prefer CentOS on my server and vBulletin recommends APC for CentOS vBulletin combo. Refer an article by Floris about how to install APC on CentOS.
7. Full-Text Search Type
If you have MySQL 4.0.x, you can use this option to reduce server load significantly when a search query is used on your server. Admin CP > vBulletin Options > Search Type. Remember, the change itself is a server-heavy process as it needs to alter the vBulletin post and thread table. If you don’t have many searches avoid such a big query right at this moment.
8. Optimal vBulletin Options
- Enable All AJAX features – Make sure that this is set to allow all AJAX Features. Ajax helps reduce the server load by not reloading a page where AJAX can be used. (Quick Reply for instance) > General Settings -> Disable AJAX Features and select Enable All Ajax Features.
- Cookies and HTTP Header Options > Remove Redirection Message Pages – Put it off to save on unneeded page loads and bandwidth.
- Cookies and HTTP Header Options > Add No-Cache HTTP Headers – Make sure you don’t opt for No-Cache setting and so set this to No.
- Server Settings and Optimization Options > Cached Posts Lifespan – If you have no issues with space on your server setting this to a higher value is recommended. I have this set to 10 days and once you turn this on rebuilding your Post Cache under Maintenance > Update Counters
- Server Settings and Optimization Options > Update Thread Views Immediately – Set this to No. It will update thread views via a cron every 1 hour by default. If you wish to change this, you can do so by editing the Scheduled Task for Thread Views to a different time.
- Server Settings and Optimization Options > Update Attachment Views Immediately – Set to No.
- User Listing & Profile Viewing > Show the Last Post on Profile Page – This is a very server intensive process and so set this to No.
- Message Posting and Editing Options > Quick Reply – Not only does it make posting faster, which leads to more posts being made. It also more use of Ajax, which means you do not have to load another page to make a post.
- Message Posting and Editing Options > Quick Edit – Turn this on to reduce the need for a new page reload when someone wants to edit a post.
- Message Searching Options > Minimum Time Between Searches – Set this to some value mainly to avoid an attempt to use the search to harm your server.
- Forums Home Page Options > Display Logged in Users? – I have mine set to Yes, but if you have issues with server load, you can turn this feature off.
- Forum Display Options > Show Users Browsing Forums – Mine is set to No, and if you have issues with server load, you can turn it off.
- Thread Display Options > Show Users Browsing Threads – I have mine set to No for similar reasons as above.
- Forum Display Options > Maximum Displayed Threads Before Page Split – Having too many threads on a single page makes the page load slowly. Ideally, you should have a value between 20 and 40. I have it set to 20.
9. Use vbOptimize
I have not used vbOptimize Pro because it is untested on 3.7.x/3.6.x but had experienced a lot of good things about vbOptimize when it was a free mod at vbulletin.org
10. Use CDN
You can move static content like images, CSS, and JavaScript’s over to CDN and reduce your server load and speed up your vBulletin performance. See How to Integrate MAXCDN With vBulletin
11. More …
If you still have issues with your server ideally, you should hire me :D. Opt for MySQL post table partitioning. Partitioning your post table should be based on the threadid. Partition is introduced in MySQL version 5.1+, and you cannot use vBulletin’s FULLTEXT Search option on a partitioned table. Check out how to Partition MySQL table based on Range. Before you opt for partition, do read the Limitations.
Readers who read this article also read …
I like to read your articles, Shabbir. I must say that I’m impressed with the page load speed at your site go4expert.com. I’m just wondering how you could achieve that!!! is it the server it self or a plugin on vbulletin that make things work like that? I don’t see any html tidy, css combine, js combine or any optimization in your site code… is it possible that the whole thing is either the web server or mysql tweak?? any comment on that?Thanks
No there is no plugin and it is well optimized server along with sleek design. HTML, CSS and JS makes very small part of actual Data that takes time to load but it is more for images and it is images which are more tidier than anything else. It is Sprite based images.
Thanks for the comments. I guess you could compress your png sprites 70%
at minimum with http://optimizilla.com/. It is a site I found few
weeks ago and seems to do great job optimizing images. you need to keep a
copy of your original images just in case if you decided to use that
free service. by the way, my vbulletin board is still slow and not sure
why. it could be because of vbseo plugin. not sure also if Nginx is the
fault although it should be ok compared to Apache server. There is
something I want to know your opinion about, do you recommend Mysql or
MariaDB as database software?? Thanks for you time!
Yes lossless compression images is always good but then sprite based images is way forward because then you don’t need to be loading too many small images on your server. On top of that images are being fetched from the CDN. If you aren’t sure this is what I mean – http://i.g4estatic.com/sprites/sprite.png It loads all the images needed to design the forum.
NGinx is good and I recommend MySQL. If you want I can look into your vB forum setup and see if there is anything major slowing your vB.
Thanks a lot for the comments. I will re-build my forum again and try to optimize it with some tools such as minify, compress and tidy for all of html, css and js. Yes, you are right about sprites. I wish that united sprites plugin from bulletin works great though. Be Back soon when things are done. Take care 🙂
now I would say after very long time of testing and playing around with vb4, I can say it is not really worth whole work although I could manage speeding up and get the board crazily optimized as fast as 1.5 sec. I believe vb need some work before they sell such product. At the end of the day, we’re thinking to move to xenforo, and that would be the net option in mind. Thanks a lot for the great article and frankly it shed wide path to optimizing vb board. Good luck!
How does one link the CSS file (“clientscript/vbulletin_css/style-2503f.css) after uploading it?
Like any other CSS file.
thanks so much for your efforts. Modified my robots.txt file after seeing your post.
once again thanks
The pleasure is all mine Sunita.
how to get the vbulletin_important.css file
thx
It is under the clientscript folder for vBulletin and comes with every vBulletin download. Can you share Why do you need that file?
Hey Shabbir
Thanks for this posting, but i can find this option in vbulletin ->
Admin CP > User Albums > Album Picture Storage Type
What vBulletin version are you looking into? vB4 have many options combined.
I use vBulletin 4.2.2
Yes Album Pictures in vB4 is not a separate Option.
Boss tell me one thing. I am installing a vBulletin just for testing purpose but there are few things where i got stuck. 4 Examsple i have seen few forums in which they have restricted users have not allowed to post links in any of post they are submitting before a number of post has been made without link. so how can i switch that option on in my vbulletin? have any idea? pleas guide me
Ashar, that is done through a plugin and I have my own plugin here
Shabbir, yar you are doing great job i am impressed by your work.
The pleasure is all mine Ashar.
Hi Shabbir,
Can I translate your tutorial in french forum my french forum support?
Thanks for advance,
Ali 🙂
Yes you can provided the credit is given to my blog post with a clickable link.
Thanks for the help, nice helpful post for vB customers 🙂
The pleasure is all mine.
sorry i mean the popup menu is working but how can i make the profile unclickable by guests, i see many vb sites doing that !! (ref: http://www.unp.me/f16/gurmukhi-script-66806/)
Ohh ok. You have to do that manually by adding a conditional in the template. <if condition=””>
Not sure if you are using postbit or postbit_legacy but the code to test guest and members is
<if condition=”$show[member]”>
Member HTML
<else />
Guest HTML
</if>
i’ve that option “enabled” but still seeing the popup menu of members clickable by guests.
Probably then your theme is messed up because vBSEO does a replacement to the code and avoids that menu code.
Hi
how can i Disable username menu for guests on showthread pages, i really want to apply this change and to reduce my server load, can u point me in the right direction, im using vb 3.8.x with vbseo.
Regards
vBSEO has the option in guest only Enhancement under Other Enhancements. Look for Remove Member DHTML Popup Dropdowns in Postbit For Guest Visitors?.
Hey there again, how do I combine the external vBulletin Javascripts into one?
There is a plugin for doing that.
Great tips mate 😉 really useful to other
Opps, sorry I meant regarding Apache/MySQL default settings
Nothing specific for vBulletin for Apache.
Any recommended to help increase vBulletin speed?
All the points I have mentioned above did not help?
Nothing specific. I just wanted to know if you did any tuning to your Apache/MySQL.
Yes always but that depends on lot of factors..
Is it possible to give us some tips on optimizing Apache and MySQL?
There is lot of information available on the documentation of Apache and MySQL itself for you to refer. Are you looking for anything specific?
My forum is loading much faster now. Thanks for the great tips!
The pleasure is all mine buddy.
A lot of admins take every measure possible to hide the locations of admincp and modcp (and protect the access to them with .htaccess) and you reveal it through robots.txt?! It’s a plain text file, anybody can read that.
Does not make a difference if you know the URL because admincp is protected by .htaccess and modcp is logged with IP.
How about disabling search for guests and having a Google search instead.
This can also help.
Yes the same tips is suggested by many vBulletin Optimization articles but I don’t see why it helps unless people actually searches. So my showthread page will not be effected if search is on or not but if too many user’s searches without registration it can impact.
Awesome Post Man!
🙂
Great tips, Thanks.