skip to Main Content

We have just upgraded our dedicated web server through our hosting company from a 3 year old dual core, 8GB Plesk machine running PHP 5.1 and MySQL 5.1.

New server is 6 core, 8GB cPanel/WHM server running PHP 5.4 and MySQL 5.5

I’m sorry because I am NOT a clever programmer but as we are a small company, I am the whole IT dept!

Our eCommerce site (Ecommerce Templates based code) is now running extremely slowly and the hosting company can only say that the problems are with our PHP/MySQL code. They are telling me that virtually every query is taking 2 seconds or more to run.

Database has around 20,000 products and 60 tables. 400Mb in size.

I appreciate our code may be a little dated but should it really take 20 seconds to load a page that used to load in less than 2 seconds just because PHP/MySQL has “improved”?

Here’s an example using EXPLAIN via MySQLAdmin:

EXPLAIN SELECT COUNT( DISTINCT products.pId ) AS bar FROM products LEFT JOIN multisections ON products.pId = multisections.pId WHERE pDisplay <>0 AND (
products.pSection IN ( 274 ) OR multisections.pSection IN ( 274 ))

1 SIMPLE products ALL NULL NULL NULL NULL 20728 Using where

1 SIMPLE multisections ref PRIMARY PRIMARY 130 homesupply.products.pID 31 Using where; Using index

I’m out of my depth here worrying about MyISAM vs InnoDB, Collation issues and so forth.

My only option at the moment is to jump back to our old server until we can re-code our website and would be gutted to discover it was a simple setting causing the issue.

Thanks

2

Answers


  1. It won’t be a problem in new PHP, that is highly unlikely. Most likely the problem is in MYSQL. I would suggest to do the following:

    1) rebuild all indexes. Improper upgrade to newer MySQL version could leave
    some old indexes on file, you can safely rebuild all, simply repair all tables:

    mysqlcheck -p -A -r
    

    2) check what queries are slow. Execute the following MySQL statement to see:

    SHOW FULL PROCESSLIST;
    

    You may need to run EXPLAIN on all your queries which are very long in the queue, check if it properly uses indexes where appropriate. Sometimes newer mysql version may not use the same index for the same query like previous version. You may need to add FORCE INDEX to your queries where mysql fails to use proper indexes.

    3) check log file. MySQL has a log file where it reports possible problems. Its location depends on your setup, on my servers it is in the mysql data directory.

    4) disable DNS lookups in MySQL, it may be enabled by default on your new version. You may need to configure skip-name-resolve in mysql config file. Actually, comparing your old and new config files could provide some hints of things which are different.

    Login or Signup to reply.
  2. I ran into this exact issue this week.

    It was IPv6

    Try disabling IPv6 completely. It could well be that some local services/plugins are attempting IPv6 connections (google api’s etc) which have to time out before they fall back to v4.

    I had access to IPv6 address space, so I enabled it and configured the host to use it correctly.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search