• So I’ve been running 4 WP installation on a vps with 4gb ram. The site do not get a lot of traffic, mostly around 100-200 hits/day for all 4 of them.

    My server keeps on crashing every 12-24 hours, the cpu load spikes and then the MySql server gets killed.

    I have caching plugins, my wp-admin is renamed so I don’t get brute force attack and 2 of the 4 website are behind cloudflare.

    I’m trying to find the source of the problem, to get rid of it! Is there any way to identify from which website the cause of the problem is? Is there any logging plugin I can install to see this?

    Thanks

Viewing 15 replies - 16 through 30 (of 43 total)
  • Thread Starter hmseb

    (@hmseb)

    So all sites are malware free.

    Do you see anything in the logs that could point to something?

    Karl Silver

    (@karlfox2014akakldkarl)

    I see a lot of MySQL errors and a few PHP errors. Some of those have already been posted.

    1. MySQL: Could you check if you are using “localhost” within your config-wp.php as the server address? Maybe the MySQL server is declining your connections at some point as you are using some other value, like a regular domain-name. So the database server treats your connections like external connections and stops them… might be a little far fetched, but worth a try.

    2. PHP: There seem to be some Fatal errors regarding the amount of allowed memory for script execution. You could increase the memory value in .htaccess from what it is now to a value a little big higher. For example:

    php_value memory_limit 512M

    3. Downtime:
    How long does your downtime take whenever the crash occurs? Just a few seconds or a couple of minutes/hours?

    Thread Starter hmseb

    (@hmseb)

    1-
    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    So this should be alright.

    2- Regarding the memory, I see this in my slow query plugin: 256M Overridden at runtime from 512M

    I’ll try to figure this out, I don’t know what overrides it…

    3-Downtime is usually a few minutes, CPU spikes, MySQL server goes down and everything comes back up.

    Karl Silver

    (@karlfox2014akakldkarl)

    ok, thanks. 1 and 2 was worth a try. 3 does sound like a short interruption, although it would of course be nice to avoid it.

    Test:
    So you can almost “predict” the downtime and see the spike building up in your admin panel, right?

    What if you tried to put the sites in maintenance mode (and log out of each one) around the time the downtime usually happens?

    If you do this only for one site at a time, you could be able to elminate the one causing the error (or confirm that all of them are responsible).

    Thread Starter hmseb

    (@hmseb)

    Yeah it’s a short interruption, but for one site with ecommerce it isn’t good…

    It varies, but yes I can see the memory build up.

    Ok, but once I identified what site is causing it, how do I find the source into that website?

    Karl Silver

    (@karlfox2014akakldkarl)

    If you eliminate 3 sites and find the one responsible you could focus your
    search drastically.

    Currently there are too many moving parts that you are looking at: PHP, MySQL,
    Cloudflare, 4 installs of WP.

    I think it might be easier to apply changes to one install and watch the behaviour of the server afterwards while monitoring only one site instead of four.

    Thread Starter hmseb

    (@hmseb)

    I get your point, but I’m pretty sure it’s one of the 4 sites that is the cause.

    Let I would have narrowed it down to the website responsible, what would be the next step?

    Karl Silver

    (@karlfox2014akakldkarl)

    I think you would have to repeat your error checking process.

    Try to de-activate plugins again, check your setup with P3, go through the logs, use your debug-plugin again and so on.

    The thread here on wordpress.org is a great ressource for searching the error as you can go over the recommendations again but with the certainty that the error has to be somewhere in this one install.

    I know this is tedious but the eliminiation of possible causes is usually the way to go. It makes more sense as soon as the most likely cause becomes more obvious.

    Thread Starter hmseb

    (@hmseb)

    FYI

    I’ve been deactivating plugins on the website I thought was the problem and running P3 after every deactivation.

    Seems like “Query Monitor” or “itheme sync” plugin was the one causing the memory build up, ever since I’ve deactivated those 2, the ram seems to be stable. Maybe there’s a conflict with something else…

    I’ll be monitoring everything for the next few hours/days.

    Thanks for that suggestion!

    Karl Silver

    (@karlfox2014akakldkarl)

    Great!

    Wish you a successful outcome of this monitoring process.

    Thread Starter hmseb

    (@hmseb)

    Oh well, back to square one…

    The build up happened again, but it seems to be slower.

    Thread Starter hmseb

    (@hmseb)

    I also have a lot of these:

    Incorrect Use of QM_DB()
    Used in wp-includes/wp-db.php on line 1209.

    Karl Silver

    (@karlfox2014akakldkarl)

    Does the line where this error “Incorrect Use of QM_DB()” appears tell you in which plugin-file the include of /wp-includes/wp-db.php happens?

    Maybe you are already very close to the last (or main plugin) conneted to your errors.

    The WP installation that creates this error is updated and all plugins are marked as being compatible in the WP plugin repository, right?

    K

    Thread Starter hmseb

    (@hmseb)

    I see this error in a “deprecated log” plugin, but I don’t have any other details…

    The line 1209 in wp-db.php that’s its referring to is:
    public function escape_by_ref( &$string ) {
    if ( ! is_float( $string ) )
    $string = $this->_real_escape( $string );
    }

    All wp installations and plugins are up to date.

    Karl Silver

    (@karlfox2014akakldkarl)

    Hi.

    Could you please post an excerpt of your log-file? Including a few lines before and a few lines after the error-message “Used in wp-includes/wp-db.php on line 1209.” ?

    This might help to better see where the messages originates from.

    K

Viewing 15 replies - 16 through 30 (of 43 total)

The topic ‘Server load and MySql problem’ is closed to new replies.