My client's sites have been running really slow. First I thought it was something with the database so I dumped the database of one of the sites into my computer, and it was running blazingly fast. My assumption is some server settings like Apache configuration, but I'm not sure where to start. This issue happens more often during database queries. Is there anything that can be done to find the culprit? This is a production server so I cannot be playing around with MySQL optimizations, etc, and unfortunately as I cannot replicate this slowness on my computer, it's hard to say that MySQL is the one causing it. These are the `top` says: Tasks: 333 total, 1 running, 331 sleeping, 0 stopped, 1 zombie Cpu(s): 1.1%us, 0.8%sy, 0.0%ni, 98.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 15015004k total, 12225816k used, 2789188k free, 136920k buffers Swap: 2047992k total, 512600k used, 1535392k free, 10442264k cached Any other info that can be useful I'd be gladly to provide. Unfortunately I cannot provide the sites' information due to NDA.
Without being able to supply things like the site or be able to do anything with MySQL, I'm not sure really what anyone is going to be able to help you with. If it's happening more often with database queries, then I'd say that's the first thing you need to look into and fix.
I'm assuming the site and sql-server is hosted on the same server? If not, there might be a problem with the communication between them. That won't easily be replicated on a localhost - neither will issues caused by multiple users and high loads / multiple queries at the same time. If the speed issues appear more often with DB-queries, then I would say that the DB is the culprit, or perhaps the code accessing the DB - if the code is crap, , for instance querying for all records when only one is needed and so on, then of course, issues will arise.
Thanks for all the replies, guys. I apologize for not being able to give the site's url. I have however tested about any frontend slowness like loading external JS files and so on Even though the slowness happen when there are database operations, I still think there's something wrong with the Apache settings, because I have enabled the slow log on MySQL and couldn't find anything that might be slowing it down. I'm thinking of creating a virtual machine with the same configuration as the server - is there an easy way to do so? Would creating an image of the server and then restoring it on VirtualBox work - not sure, never done it.