FractalizeR: VBulletin 4 extensive optimization guide (Part II)
Continuation from Part I
Install mod_evasive and DDOSDeflate script If your forum is a constant target for DDOS attacks, to lower their performance impact, you can install Apache module mod_evasive and DDOS Deflate scripts. mod_evasive installation guides are scattered across the net, so I leave you with Google on it?s installation. As for DDOS Deflate, just wget http://www.inetbase.com/scripts/ddos/install.sh and run it (don?t forget to chmod u+x it first). Generally these two doesn?t need to be tuned and their default settings are ok. Move Avatars and Profile Pics to the file system You need to move pictures to the filesystem as well. Go to your AdminCP, expand the Avatars menu on the left side and click User Picture Storage Type. Move CSS to the file system Go to your AdminCP, expand the vBulletin Options menu and select vBulletin options. From there select Style and Language Options in the drop down menu. Then set ?Store CSS Stylesheets as Files?? to Yes and click Submit. Enable caching of static content This option will tell user browser to download files from your website less often thus decreasing server load and improving page load times for user. You will have to have mod_expires active in Apache. Add the following to .htaccess in the forum root Code:
## Expires Install and attach MemCached Consider installing and attaching MemCached to VBulletin (for example, from RPMForge repository. If you are on RedHat or CentOS you can install RPMForge repository quickly this way and install MemCached from there using yum install memcached after. Don?t forget to issue chkconfig memcached on to make sure memcached will auto-start on next server reboot). You will need to edit your /includes/config.php and uncomment the following lines there: PHP Code:
OPTIONS="-l 127.0.0.1" InnoDB: Migrating Consider migrating to InnoDB to improve concurrency if you have a really large forum and you want to make it faster. Please note, that on small forums (or on servers with a little of physical memory) this option can even slow things a bit. Be sure you have at least 2-4Gb RAM on your server before considering InnoDB migration. InnoDB: increase innodb_buffer_pool_size If you migrated to InnoDB, you need to increase innodb_buffer_pool_size to at least 512Mb depending on your server free RAM available. It is the memory area, used to cache data for InnoDB tables and by default it is very small (8Mb only, suitable for Pentium 166MMX home machine with database of your video tapes). If your server is running something else together with VBulletin, please consult with your server administrator for this change since it is server-wide. InnoDB: lower transaction isolation level VBulletin is running in autocommit mode and does not really use transactions. Default InnoDB transaction isolation level is REPEATABLE READ, which leads to excessive use of system resources in autocommit mode. You can lower it to READ COMMITTED. If you run ONLY VBulletin on your server, to lower transaction isolation level you need to add the following line to /etc/my.cnf (MySQL main configuration file): Code:
transaction-isolation = READ-COMMITTED PHP Code:
Tune MySQL for your forum There are several ways to optimize your MySQL server even if you are not a professional DBA. One is to open PHPMyAdmin, go to Status tab to see server status and look for values in red color there. You will find some hints next to them (although, they could be not so clear). Another is to use various MySQL analysis scripts, that analyze MySQL status reported by server themselves. You can get one here (it?s a bash script, you need to wget it, then chmod u+x tuning-primer.sh, and then execute: ./tuning-primer.sh) and another in Perl here. They report more understandable resuts. Before making changes to your my.cnf, please, consider making a backup of it so that you could easily revert corrupted or unoptimal settings. Optimize your MySQL tables regularly Consider running the following simple script every several weeks depending on forum load (of course, you should run it at nights when your forum is the least loaded) PHP Code:
You can add it to Linux cron if you like. Consider moving to newer MySQL server version Generally, newer MySQL server versions are more clever. They know how to optimize queries better, how to handle resources better etc. So, you may receive a small benefit from moving to a newer MySQL server version. If you are on CentOS or RedHat this is complicated, because default repositories have only 5.0 version of MySQL server. So, I cannot recomment that. But you can always get RPM from MySQL website and install it. If you are an IT geek, you can even move to Percona MySQL server. This is a tweaked MySQL server with some optimization patches (from Google for example) applied and improved InnoDB performance. Unlike Oracle?s MySQL, Percona has own RPM repository, that can be installed using this rpm. Despite performance gains, I don?t recommend this until you are really in need because maintaining another version of MySQL different from the one provided with your OS by default will take much time and resources from you. Turn off apache modules, that you don?t need Consider turning off all apache modules you don?t use on server, that holds your forum. For example, on my server httpd.conf has the following LoadModule configuration part: Code:
LoadModule auth_basic_module modules/mod_auth_basic.so Enable KeepAlive in Apache settings KeepAlive setting allows Apache server to send replies to several requests over the same TCP connection. This is of course faster than to open new TCP connection for each resource sent. To enable KeepAlive search for ?KeepAlive? in apache configuration file (httpd.conf) and set it to On: Code:
KeepAlive On Turn off PHP modules you don?t need VBulletin uses the following PHP modules: gd, iconv, mbstring, mysql or mysqli (depending on your VBulletin database connection settings). All others (except for those, that are compiled with PHP by default and were not disabled using ?disable-XXX switch during PHP compilation) are not required. You can skip loading them to make PHP occupy less memory and start faster. On RedHat and CentOS you can just comment ?extension=? lines in each corresponding file inside /etc/php.d directory. Turn on PHP bytecode caching If
Code:
yum install php-devel Code:
yum install autoconf libtool gcc gcc-c++ Optimizations, that will speed up forum for users, but may increase server load Enable compression of content If you have some spare CPU power and want to make your forum load faster for users, you can also enable static content compression. You will have to have both mod_headers and mod_deflate active in Apache. Add the following to your .htaccess in the forum root: Code:
#Compression Forum settings, that seriously affect database performance You can tune all below if your forum causes great load to database
|
great article - thanks for sharing
|
Nice one!
I actually cant change the directories for attachments and so on, because it is saying that there is an error with the folder ... i am pretty shure i messed up the path ... is it a full path or a relative one ? or is it from /srv/ ... ? DDOSDeflate doesnt work for me on opensuse its kind of difficult : ( |
Quote:
Quote:
Create a PHP script somewhere and put to it the following code: PHP Code:
Quote:
|
than you again for part 2 of the article great job
even though is kind of difficult for me to deal with some stuff you've mention but its a great start for me to learn those thanx for every word |
Thank you very much indeed FractalizeR!
I will pop in later again here, gotta do a nerd root session later on this night however... All the best |
Great article! Really thank you! :)
In my httpd.conf I've this directives: Code:
#mod_deflate |
Nice tutorial. Didn't get the script part. Could explain better? I've created the php file with your script in it but just get a blank page.
|
Add
PHP Code:
|
Thanks Fractalizer, it was a wrong path problem. But tel me something, does the script prints any results in the screen or?...
|
No, it does not. If you put something in cron, all printed results will be sent to your root email. If nothing is printed - nothing is sent. So, it's good for having all problems on your email.
|
*scratches me head*
nice work. :) I will probably be need these articles in a year or 2. |
Very Usefull :)
Thanks for share. |
1 Attachment(s)
after turning on saving ccs to filesystem i get this error. what could be wrong ?
|
Quote:
|
Do we need to configure MemCached in any way or is it tuned out of the box?
|
Actually, it is turned on and is listening on all Ips. So, you might need to close it's port 11211 to make it inaccessible externally.
|
Where do we check for this on a VPS?
Quote:
|
Quote:
or you can read this more more information http://www.google.co.uk/#hl=en&sourc...880e0c34638eae |
Quote:
EDIT: I found it. I do have it installed on the VPS. I ran this line from the root: Quote:
|
Thanks Fractalizer , very usefull .
Can we use MemCached & eaccelerator togather ? If no then which one is better with attachment on file system? |
Yea, you can surely use both at the same time.
|
Really thanks for the article ....
|
Quote:
Will you recommend using both ? if not then which one you prefer ? |
They are a little bit different. Vbulletin uses memcached to cache it's datastore, and eaccelerator caches PHP bytecode to speedup execution speed. So, you should use both if you can.
|
Too complicated for me to try.
|
Life is also a difficult thing ;)
|
wtf
|
Very nice Tutorial, helps also much with windows servers
|
Hi instead of that file to optimize the database once per week can't we just make a plugin to do this for us in the admin cp via the Plugin & Products System -> add new plugin option?
If so what code do we use for that? |
I'm trying the "InnoDB: Migrating" and managed to convert all tables successfully except
Code:
alter table thread engine=InnoDB; Code:
#1214 - The used table type doesn't support FULLTEXT indexes |
Did you convert all tables without exceptions?
|
Quote:
Code:
http://www.vbulletin.com/forum/entry.php?2413-Part-2-vB4mance-vBulletin4-Optimization-Basic-Guide-to-InnoDB-Conversion |
Well, it's some legacy indexes. You can safely drop them:
Code:
alter table post drop index title; |
Quote:
|
Welcome.
|
Great article. :)
|
One thing that also speeds up your community is switching from Apache to Litespeed(web server).
|
All times are GMT. The time now is 06:35 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|