Skip to:
Content
Pages
Categories
Search
Top
Bottom

Server Overload

  • Hi. I’ve just moved into a Virtual Dedicated Server, i have 4 wordpress instalations with very few users and visits (like 200 per day) and 2 bbpress instalations with 200 users and 800 visits/day each one… They are in different accounts in the server, sharing DDBB.

    The server its supposed to have 126mb ram but they’ve double increased my memory so, 256…

    The server gets overloaded all the time, and I guess it’s BBpress… I don’t have any plugin or anything weird, just a smileys plugin. Does anybody knows what might be happening? I have ssh access and all that stuff…

Viewing 25 replies - 1 through 25 (of 25 total)

  • _ck_
    Participant

    @_ck_

    Running bbPress on a server with 128mb of ram would be very difficult unless it’s a very light setup with low use.

    256mb should be doable if that is real, permanent memory and not burst memory. It’s also important if you don’t have alot of overhead like cpanel running.

    #1 problem on most small VPS is you either don’t have the mysql cache turned on or it’s too small of a cache

    #2 problem is you almost certainly don’t have a PHP opcode cache like eAccelerator installed

    #3 problem on almost all VPS is bad neighbors.

    On a shared host, you can easily tell when you have bad neighbors who are overloading the server (node). On a VPS they are hidden. If you have an inexperienced host, they may have a hard time tracking down the offender, or may not even care. If they tell you that your neighbors can’t affect you, that’s an outright lie or plain ignorance.

    If you are running bbPress 1.0 alpha it has several problems generating far too many mysql queries and that could be causing you some headaches. If you are using bbPress 0.9, definitely stick with that, but you need to fine tune your settings.

    WordPress has some nice caching plugins like wp-super-cache. No such creature exists yet for bbPress, so all pages must be rendered each time by the engine, making it use more overhead than WordPress.


    _ck_
    Participant

    @_ck_

    You (and everyone) needs to make sure this is in your bb-config.php

    $bb->load_options = true;

    make sure you put it BEFORE /* Stop editing */


    _ck_
    Participant

    @_ck_

    Show me your mysql configuration by doing this in your shell (ssh)

    cat /etc/my.cnf

    and copy what it returns to a post here or into pastebin.com

    I suspect we can improve it. MySQL cache is very important to bbPress performance.

    Thanks a lot for your help _ck_, I’m doing all the changes you said… bbpress config file and super cache…

    That’s what I get when I type the command:

    root@node2 [~]# cat /etc/my.cnf

    [mysqld]

    skip-bdb

    skip-innodb

    I’m on 0.9.0.2 bbPress version…

    Also, I have cpanel and WHM… should I stop them?

    _ck_

    In latest bb-config.php there is no /* Stop editing */

    Do I put $bb->load_options = true; at the end of the file ?


    _ck_
    Participant

    @_ck_

    For now you should be okay with cpanel and whm – they do make life much easier running a server. There are things we can fine tune eventually.

    However you have one HUGE problem.

    You have no mysql cache enabled, at all!

    When we get it fixed you will see a big difference in bbpress (and wordpress) performance.


    _ck_
    Participant

    @_ck_

    Oh they probably changed the bb-config.php so it doesn’t matter where you put it anymore.

    bb-config.php used to load another file but now I think they make the other file load bb-config for safety and logic reasons.


    _ck_
    Participant

    @_ck_

    Okay, carefully edit your /etc/my.cnf (ask if you don’t know how to edit) and REPLACE what’s in there with this:

    [mysqld]
    max_connections = 400
    key_buffer = 16M
    myisam_sort_buffer_size = 32M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_cache = 1024
    thread_cache_size = 286
    interactive_timeout = 25
    wait_timeout = 1000
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 1M
    query_cache_size = 16M
    query_cache_type = 1
    tmp_table_size = 16M
    skip-innodb
    [mysqld_safe]
    open_files_limit = 8192
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [myisamchk]
    key_buffer = 32M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M
    [mysqlhotcopy]
    interactive-timeout

    After you edit it you’ll need to restart the mysql engine by typing this in the ssh:

    service mysql restart

    (optionally there’s also a mysql restart in cpanel)

    Then do a couple of refreshes on your bbPress pages and it should seem a bit zippier.

    Done!!!! Let’s wait!!! Thanks so much _ck_ !! (I’m still making the cache things!!)

    I’ll tell you in a couple of hours how it looks.

    Should I update wordpress version to the last one? Or it’s slower?

    Thanks again.


    _ck_
    Participant

    @_ck_

    No, if you have bbpress and wordpress integrated, and you are with bbPress 0.9, you should stick with WordPress 2.5 because that’s the only version that works with bbPress 0.9

    There is nothing wrong with WP 2.5 and no need to upgrade to 2.6, because if you do, you’ll need bbPress 1.0 alpha which is unstable and has bugs.


    _ck_
    Participant

    @_ck_

    By the way, once you are done with this, we’ll install eAccelerator and that will give your PHP a nice boost too.

    Let me know how the MySQL cache mod goes.

    If you don’t want to wait and feel comfortable trying it right away, try downloading and using this script to auto-install eAccelerator on Cpanel:

    wget http://tutorials.medialayer.com/cPanel/eaccelerator.sh
    chmod 700 eaccelerator.sh
    ./eaccelerator.sh

    Once it is done, you might have to restart apache

    service httpd restart

    and you should definitely notice another speed boost.

    _ck_ I don’t want to say it too loud, but Ithink ITS WORKING…. The server has been alive for 1day long… With no crashing… Still, I think it’s a bit cranky… and I stopped cpanel… I will start service only when I need it…

    I’m going to install eAccelerator Right Now!!! Thanks so so so much…!! I’ll keep informing you!

    _ck_ I’m getting this error, I guess it’s already installed?

    ;extension=”eaccelerator.so”

    eaccelerator.shm_size=”16″

    eaccelerator.cache_dir=”/tmp/eaccelerator”

    eaccelerator.enable=”1″

    eaccelerator.optimizer=”1″

    eaccelerator.check_mtime=”1″

    eaccelerator.debug=”0″

    eaccelerator.filter=””

    eaccelerator.shm_max=”0″

    eaccelerator.shm_ttl=”0″

    eaccelerator.shm_prune_period=”0″

    eaccelerator.shm_only=”0″

    eaccelerator.compress=”1″

    eaccelerator.compress_level=”9″

    ABORT: Please uninstall any existing instance of eAccelerator.

    root@node2 [~]#


    _ck_
    Participant

    @_ck_

    I probably made a bad assumption that it was not installed, though it definitely doesn’t come by default on a cpanel setup so that’s a bit unusual. Strange someone would put eaccelerator on there but not enable the mysql cache.

    You can look at your phpinfo() to find out if eAccelerator is really installed and active.

    That eaccelerator compress and compression level is just a waste of cpu time. I’d either set

    eaccelerator.compress="0"

    or

    eaccelerator.compress_level="1"

    By the way, the php configuration is located in

    /usr/local/lib/php.ini

    and the eAccelerator options are at the very bottom of the file if you ever have to manually edit them.


    _ck_
    Participant

    @_ck_

    OH! You know what my tired eyes missed?

    Yes, you have the eAccelerator *settings*,

    BUT it’s disabled!

    Someone disabled it by putting a semi-colon in front of the actual binary:

    ;extension="eaccelerator.so"

    See that? To enable it, the semi-colon has to be removed, otherwise it’s dormant.

    Now if it wasn’t properly installed and the setting were just left in place, then removing the semi-colon may just halt PHP entirely and prevent your apache from working correctly.

    So try removing the semi-colon, save php.ini and then restart Apache via: service httpd restart

    If apache doesn’t restart, or it does but you can’t access web pages, then you need to go put back the semi-colon or remove the eaccelerator section entirely.

    If apache starts but you can’t find an “eaccelerator” section inside phpinfo() then it’s not really installed, or installed incorrectly. If that’s the case, then you need to remove all the existing eaccelerator lines listed above, and then run that install script again.

    By the way, if you don’t know what phpinfo() is, just make a file called phpinfo.php and put only this line into it: <?php phpinfo(); ?> and put it somewhere you can access it from the web on your server and then access it via the web.

    You will definitely see a speed boost when reloading pages once eAccelerator is properly installed and running.

    _ck_ , I cannot restart the apache service, so I placed again the semi-colon. What should I do now?

    This is the error I get:

    Restarting Apache

    [a fatal error or timeout occurred while processing this directive]


    _ck_
    Participant

    @_ck_

    If you replaced the semi-colon and it still will not restart, you need to double check for a typo.

    Failing that, you can try removing all lines starting with eaccelerator. which should be at the very end of the php.ini or just putting semi-colons in front of them.

    I perhaps should have told you to make a copy of php.ini via cp php.ini php.bak but since it’s documented here we should be able too repair it.

    Actually, that install script probably made a backup of php.ini for you. Update: no unfortunately it does that when it’s about to copy and it didn’t make it that far. But you may have backup copies from other programs. See what files show up when you do a ls php* -latr

    _ck_ now I know why it crashes… i already have the Zen Optimizer installed!!! So i guess i don’t need the eAccelerator, right?


    _ck_
    Participant

    @_ck_

    No the zen optimizer is not an opcode cache, it’s just another keyhole optimizer. eAccelerator has a keyhole optimizer too but it doesn’t hurt anything to use them both. I use them both on PHP4 servers, PHP5 doesn’t need it.

    I think there are possibly THREE (simple) problems.

    One is a leftover corrupted eaccelerator cache left on your drive from a previous attempt that has to be cleared/deleted first.

    Two is an old eaccelerator that was built for a different version of PHP, it needs to be rebuilt with that script above.

    The last possibility might be the extension load order.

    (you can try disabling the zend optimizer altogether as it’s overkill when eaccelerator is running)

    So:

    1. Try deleting your old eaccelerator disk cache first

    rm -rf /tmp/eaccelerator

    2. Go into php.ini and look for the Zend section.

    It will look something like this but maybe not exactly like this:

    [Zend]
    zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.0.1
    zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.0.1
    zend_optimizer.version=3.0.1
    zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so
    zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so

    3. Make sure that Zend section is ABOVE (before) the eAccelerator section. You can also try commenting it all out with semi-colons before each line to disable it entirely.

    Last but not least, you should also delete the entire eAccerator section in PHP.ini and then run that script above.


    After thinking about this for awhile, I would put my money on the idea that your eAccelerator was built for an earlier version of PHP and MUST be re-compiled by that script.


    _ck_
    Participant

    @_ck_

    By the way, if you are asking yourself if it’s worth this much trouble getting eAccelerator to work, the answer is definitely yes. It will give you a very nice speed boost in bbPress and WordPress.

    Since your server is very standardized as Cpanel + PHP 4.4.8 I am virtually positive we can get this going.

    _ck_ FINALLY I did it… The admins had to recompile my Apache… and we’ve had lots of problems… but now I have it….

    (edit)

    IT’S F****NG flying :D Thanks So SO MUCH!!!!!


    _ck_
    Participant

    @_ck_

    Hmm, they shouldn’t have had to recompile but maybe something was out of whack with the version numbers.

    By the way, Cpanel has a very nice control panel to let you rebuild apache yourself (it’s called easyapache). But that’s something to learn down the road. You should very rarely (if ever) have to rebuild unless adding special features.

    Glad to hear you got it working in the end. eAccelerator and the mysql cache will definitely turn a turtle of a server into a rabbit.

    Hey guys, im having the same problem as clementine only i have 768MB guaranteed RAM and its burstable to 1504MB+. I’m fairly sure its a mysql problem as every day or two the server starts to run very slow, when check the resource meter using TOP via SSH it tells me that MySQL is at 90%. The only way to fix it is to restart MySQL.

    I’ve installed eaccelerator and played around with the my.cnf settings but i cant seem to get it running right. I only have 3 wordpress installations… the my.cnf settings are currently set to as follows:

    [mysqld]

    max_connections = 300

    key_buffer = 64M

    myisam_sort_buffer_size = 32M

    join_buffer_size = 1M

    read_buffer_size = 1M

    sort_buffer_size = 2M

    table_cache = 4000

    thread_cache_size = 286

    interactive_timeout = 25

    wait_timeout = 7000

    connect_timeout = 10

    max_allowed_packet = 16M

    max_connect_errors = 10

    query_cache_limit = 2M

    query_cache_size = 12M

    query_cache_type = 1

    tmp_table_size = 16M

    skip-innodb

    [mysqld_safe]

    open_files_limit = 8192

    [mysqldump]

    quick

    max_allowed_packet = 16M

    [myisamchk]

    key_buffer = 64M

    sort_buffer = 64M

    read_buffer = 16M

    write_buffer = 16M

    [mysqlhotcopy]

    interactive-timeout

    Any help would be much appreciated


    _ck_
    Participant

    @_ck_

    The problem with VPS is the system will lie to you as far as how much CPU is available to you at any given time. MySQL being at 90% may be a symptom, not the cause.

    You can have just one program running but if a neighbor on the same node is hogging the disk with heavy disk access, processes like MySQL which need fast disk access to respond timely will start to overload. There isn’t a single VPS that has decent disk I/O management.

    What you can try to do is give MySQL as much ram as you can afford. Also take a look at how many queries your bbpress pages are using via my bb-benchmark plugin, make sure they are below two dozen.

    There are specific tools you can monitor your VPS with that I highly recommend:

    1. This one is a MUST so you can show your host that you have bad neighbors

    http://www.silversoft.com/loadavg

    2. This one takes a little more install time but is very helpful too:

    http://www.labradordata.ca/home/13

    3. last but not least you want a mysql monitor like MyTop

    http://jeremy.zawodny.com/mysql/mytop/

    Keep in mind, if you discover (via loadavg) that the load time of day happens at the EXACT same time every day (like on the hour at 9am) that means your host is doing something stupid like backing up all the VPS on the node at the same time instead of staggering it. Some VPS hosts are more experienced than others. Some hosts will argue with you that your neighbors can’t be affecting you on a VPS, in which case the host is ignorant or an idiot, or even worse, a liar.

    Oh and if you don’t have a php opcode cache installed (you didn’t mention it one way or another) be sure to install one: eaccelerator, xcache or apc (eaccelerator recommended for ease of install and general compatibility)

    If all else fails, replace Apache with Litespeed or lighttpd or get a better host.

Viewing 25 replies - 1 through 25 (of 25 total)
  • You must be logged in to reply to this topic.
Skip to toolbar