Speed
I'm new to Linode and like the system very much, but I'm having some trouble with the speed of my LAMP setup. Many thanks in advance for any help you can provide. Here's my situation:
I copied over my development site from my other VPS (which has less RAM than my Linode) and tried to set it up as similarly as possible. I was able to get it working easily, but immediately noticed that browsing the site on my Linode was very slow. The site is built using Drupal, by the way.
Digging in, I noticed:
On my front page the Linode required 1,000+ms of SQL queries (compared to 200+ms for the other VPS)
My front page was rendered generally in 6s, but sometimes as bad as 30s (compared to 2-3s on my old system)
*When loading a page, I never saw CPU usage go above 10%, so I don't think I'm maxing it out ever
top reveals that I have about 120M free of RAM
iostatus reveals that I have iotokens=2000000
To set the server up, I tried out both Fedora Core 6 and Centos 5 distributions (it's what i'm used to). On each one I yum updated everything, yum installed mysql, php, and httpd
I enabled caching in mysql with querycachesize=32M - no noticeable improvement
I enabled APC for php caching - no noticeable improvement
This is a development site - there's no visitors except me and very little load - so I'm not at the stage of fine tuning server performance. I just want it to be reasonably responsive. I was never that happy with the old VPS, so I'm hoping that this can get better. I've tried searching the forums, but I must be missing something.
Googling around, I did notice a few posts that claimed Drupal sites run much better under Xen, so perhaps that's worth a try.
Again, thanks for your help!
5 Replies
I can tell sometimes the bandwidth becomes limited, possibly when many other linodes on my host are using bandwidth and we have to share. That might be a possibility for you. For my particular drupal pages, the total size for the generated web content is huge and spread across several resources just for one page, it takes some time to transmit it all.
One possibility is that you're just unlucky and the other Linode users sharing your host are using significant IO and you don't get as much as you used to. The thing about any VPS is that you get unpredictable performance, since it depends on what the other people on your host are doing.
I'm on the Linode xen beta but I don't have drupal running there. Even though linode calls their xen service beta, it has been extremely stable for my uses and noticeably faster. You might try it.
You're right, I'm not using caching in drupal, since I'm logged in to the site most of the time working on it. When I get it ready for production I'll turn that on, but right now I'm just noticing that it's a bit slow to use for development.
It's quite possible I'm setting something up wrong. MySQL query's are consistently 10x slower than on the other server (as reported by the devel module). I suppose it could just be bad luck that my Linode is overtaxed by other users, as you said, but my dashboard says the load on my Linode is medium, and from what I've read here the io is well enough limited by the io_tokens to keep any one user from hogging it all…
I'll post back if I figure anything out. Let me know if you have any ideas. I'd love to get this working, since otherwise I really like my Linode…
Thanks.
Need to tune mysql to utilize less memory, to avoid sweeping the disk during large joins or table scans?
EDIT ->> that should read "to utilize MORE memory"
-Chris
Thanks for you input.
The indexing on the tables seems fine and is certainly the same on both servers.
mysqld is taking up 13m and the server seems to have plenty of memory free (at least for now, with just me on it so very few apache processes). I don't see any swap activity.
There seems to be a problem both with the speed of MySQL querys and the speed of Apache/PHP execution. On a sample page load, the drupal development tool devel tells me "Executed 280 queries in 2487.21 milliseconds. Page execution time was 33164.62 ms." Both are about 10x off what I expect, though sometimes the page execution is more like 6-10s rather than 30.
Here's vmstat 1 while loading that page:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 91904 18112 108500 0 0 2 3 160 9 0 0 100 0 0
0 0 0 91904 18112 108500 0 0 0 0 109 8 0 0 100 0 0
2 0 0 92436 18116 107440 0 0 0 0 120 58 20 8 72 0 0
2 0 0 92436 18116 107520 0 0 0 0 106 11 88 12 0 0 0
3 0 0 92388 18116 107660 0 0 0 0 118 22 82 18 0 0 0
2 0 0 92388 18116 107784 0 0 0 644 166 23 50 50 0 0 0
3 0 0 92264 18116 107932 0 0 0 0 105 19 50 50 0 0 0
2 0 0 92140 18116 108076 0 0 0 0 131 65 25 75 0 0 0
3 0 0 92016 18116 108172 0 0 0 0 105 64 0 100 0 0 0
2 0 0 92016 18116 108200 0 0 0 0 122 39 67 33 0 0 0
2 0 0 91892 18120 108292 0 0 0 520 143 32 67 33 0 0 0
2 0 0 91892 18120 108412 0 0 0 0 105 53 50 50 0 0 0
2 0 0 91644 18120 108556 0 0 0 0 104 4 71 29 0 0 0
3 0 0 91520 18120 108716 0 0 0 0 123 7 67 33 0 0 0
3 0 0 91396 18120 108844 0 0 0 0 104 5 67 33 0 0 0
2 0 0 91188 18124 109048 0 0 0 668 158 13 50 50 0 0 0
2 0 0 91064 18124 109192 0 0 0 0 107 5 50 50 0 0 0
2 0 0 90940 18124 109340 0 0 0 0 108 6 38 63 0 0 0
2 0 0 90816 18124 109492 0 0 0 0 108 72 67 33 0 0 0
2 0 0 90724 18124 109636 0 0 0 748 126 130 33 67 0 0 0
2 0 0 90476 18124 109780 0 0 0 0 114 104 44 56 0 0 0
2 0 0 90352 18124 109916 0 0 0 0 122 91 20 80 0 0 0
2 0 0 90228 18124 110036 0 0 0 0 109 72 63 38 0 0 0
3 0 0 90136 18124 110156 0 0 0 0 110 98 50 50 0 0 0
2 0 0 90012 18124 110336 0 0 0 620 151 141 33 67 0 0 0
2 0 0 89888 18124 110476 0 0 0 0 108 107 67 33 0 0 0
1 0 0 89764 18124 110612 0 0 0 0 109 98 38 63 0 0 0
2 0 0 89640 18124 110748 0 0 0 0 106 93 67 33 0 0 0
3 0 0 89392 18124 110936 0 0 0 688 153 146 80 20 0 0 0
2 0 0 89284 18124 111076 0 0 0 0 110 25 43 57 0 0 0
2 0 0 88392 18124 111208 0 0 0 0 118 21 80 20 0 0 0
2 0 0 87772 18124 111344 0 0 0 508 117 44 33 67 0 0 0
2 0 0 87772 18128 111456 0 0 0 184 120 12 40 60 0 0 0
2 0 0 87524 18136 111572 0 0 0 0 116 6 33 67 0 0 0
3 0 0 87400 18136 111696 0 0 0 0 138 4 50 50 0 0 0
4 0 0 87152 18136 111816 0 0 0 0 121 5 50 50 0 0 0
3 0 0 86904 18136 111960 0 0 0 228 163 7 38 63 0 0 0
2 0 0 86680 18136 112092 0 0 0 564 118 7 60 40 0 0 0
3 0 0 86432 18136 112228 0 0 0 0 120 4 33 67 0 0 0
2 0 0 86184 18136 112348 0 0 0 0 113 5 33 67 0 0 0
2 0 0 85936 18136 112500 0 0 0 4 124 11 50 50 0 0 0
1 0 0 85564 18136 112776 0 0 0 652 140 14 75 25 0 0 0
1 0 0 85580 18136 112776 0 0 0 0 123 31 4 0 96 0 0
1 0 0 85580 18136 112780 0 0 0 0 124 38 2 0 98 0 0
0 0 0 85580 18136 112780 0 0 0 0 103 8 0 0 100 0 0
0 0 0 85580 18136 112780 0 0 0 28 106 10 0 0 100 0 0
0 0 0 85580 18136 112780 0 0 0 0 102 8 0 0 100 0 0
0 0 0 85580 18136 112780 0 0 0 0 102 5 0 0 100 0 0