1

I have drupal 7 test installation on shared hosting. Caching turned off (I do not want to use caching), cron disabled. According to devel, query execution times on page with 228 queries are approximately 1200ms.(some views blocks with relationships, page displayed using context) Loading time of this page is allways more than 1200ms. It is approximately 3 and more seconds. Due to time to first byte, which I am not able to cut down.
However, I decided to try the same install on virtual host running on debian linux 500mb ram. Devel shows on the same page (228 queries) time 50ms - which is great.
But, accessing time to pages is very inconsistent. Sometimes it is amazingly fast, sometimes it takes 8 seconds of waiting and then page loads. What is interesting - even if page loads after 8 seconds, the query time is allways small according to devel.
This leads me to conclusion, that there must be some bad setting on my linux installation. Can anybody point me to the right direction? Thank you

I am new to virtual servers and I think I am missing here something obvious.

  • This should probably be moved to server fault, but its most likely caching or going into swap or something of that nature. – iLLin Mar 24 '13 at 18:04
  • Also Drupal sux with shared hosting. You need something a lot more powerful than that, you need to run APC and make sure you have good caching for your database. Memcached is also an awesome thing to run as well. – iLLin Mar 24 '13 at 18:05
2

500 MB is not much, unfortunately :) and the default debian settings for Apache and MySQL are prepared for bigger servers. You should make sure the server doesnt swap.

Probably the most important setting for that is in the part mpm_prefork_module in the apache configuration (/etc/apache2/apache2.conf). You will want to have less Startservers, MinSpareServers and MaxSpareservers.

Installing APC helps, too (and is relatively easy). Even though you have to sacrifice some RAM, it speeds up the loading and reduces the RAM needed for every pageload. With 500MB, you will want to use APC only as opcode. Make sure you dont use much more stuff than 1 installation of drupal, or set APC so that other stuff doesnt get cached (the default settings caches every php file you use, thus probably pushing the important stuff away).

Enable the css + js aggregation - apart from saving roundtrips for the client, it also saves your server from serving extra files.

Also take into account that drupal does some caching internally and the times when it takes longer may be because of that - it is useful to "prime" the caches ie by crawling all pages before you start measuring.

2bits have great articles about optimizing for drupal.

| improve this answer | |
  • thank you, this was very helpful. I set up less Startservers, MinSpareServers and MaxSpareservers as you suggested and now te response is snappy. I installed apc as well, left default values but do not see any improvement - what does it mean to run it only as opcode?. What I noticed is that the server definitely do swap. Instead of turning it off I set up a value od 10 instead od default 60 - vm.swappiness=10 in etc/sysctl.conf. Thank you for helping – loparr Mar 26 '13 at 21:00
0

I have messed with php resouce limits settings and increased Maximum HTTP POST size from 8 to 30mb. Now my website loads really fast but only for a few minutes. Now it is everthing back to slow.

| improve this answer | |
  • i cant think of a way how that setting would have any influence :( probably only the fact that you had to restart the server :) – mojzis Mar 24 '13 at 20:57
  • yes after restarting server things run great:) unfortunatelly not for long – loparr Mar 24 '13 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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