Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running a wordpress blog on my VPS, But MySQL Queries are taking too much time.

For example, it is taking more than 1.5 seconds to load a post from database.

But CPU and RAM usage is low on my server. I've 2GB RAM, and 1.2GB of it is free right now. also CPU usage is below 5%.

I'm running IIS 7.5 on Windows Server 2008 R2 Datacenter edition (64-bit), with MySQL 5.5 installed on it. (Also there is MS SQL 2012 Express installed on the machine, but it's inactive most of times)

PHP is running fast on my server, but MySQL queries seems to be too slow.

Also I've tried optimizing database from phpmyadmin, and speed becomes a little better, but still it's too slow.

Is this normal on a Windows VPS? How to improve MySQL performance?

Update: I've read somewhere that 127.0.0.1 as the host works better than localhost, and I'm using 127.0.0.1 now, but still database queries are too slow.

Update 2: This is the HDD benchmark on my VPS:

HDD Benchmark

Also there is report of another HDD benchmark tool:

  • Read 50 MB file with 256 KB buffer:

Reading 52,428,800 B (50 MB) - 200 blocks

Success: 52,428,800 B (50 MB)

Time: 1.329

Speed: 39,463,373 B/sec (37.6 MB/sec)

  • Read 50 MB file with 32 KB buffer:

Reading 52,428,800 B (50 MB) - 1,600 blocks

Success: 52,428,800 B (50 MB)

Time: 10.873

Speed: 4,821,734 B/sec (4.6 MB/sec)

  • Read 50 MB file with 1 KB buffer:

Reading 52,428,800 B (50 MB) - 51,200 blocks

Success: 52,428,800 B (50 MB)

Time: 1:06.395

Speed: 789,648 B/sec (771 KB/sec)

share|improve this question
1  
You've mentioned memory and CPU usage. How about disk? My bet is that your underlying disk is being slammed by the other systems you're sharing hardware with. Fire up some disk resource monitors... –  EEAA Jan 2 '13 at 7:22
    
Important metrics are read/write latency and how much time the CPU is spending waiting for io. –  EEAA Jan 2 '13 at 7:33
1  
Exactly. Pretty often, discs are the problem. And databases need fast disc IO. A dprocess waiting for the disc can not work. Is it normal on windows? No. Is it normal on underpowered cheap VPS? Yes. i dont ahve a single VPS hosting server with less than 8 physical discs attached (except those obviously booting via network from a SAN). –  TomTom Jan 2 '13 at 7:35
    
@EEAA Question updated with HDD benchmark details –  Mahdi Ghiasi Jan 2 '13 at 7:56
    
@TomTom Question updated with HDD benchmark details. –  Mahdi Ghiasi Jan 2 '13 at 7:56
show 2 more comments

1 Answer

I would imagine this is something as simple as tables not being properly indexed. Take a few of your slow running queries and run an EXPLAIN on them to see how many rows are being examined each time.

Also the 127.0.0.1 vs localhost is true as it saves a DNS lookup but judging by what you're describing this is not likely to be the problem.

share|improve this answer
    
Possibly. Would not be the first time. –  TomTom Jan 2 '13 at 17:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.