4

I am looking for suggestions on Apache/Drupal/MySQL (localhost) configuration, to solve my issue. I use Ubuntu servers 8 LTS with classic Apache installation, and perform manual Drupal installation too. After publishing a site for customer review, I notice, that if a site is not visited very often or not visited at all for some time, such site response time increases significantly, up to situations with timeouts. Although, other vhost sites not on drupal on the same server run smoothly. E.g., if a site is rarely used, opening and navigating through out it takes very long times, or even timeouts. Each next page visit opens faster.

I use regular Apache settings and PHP memory up to 512MB, as sometimes Drupal module installations ask for more. Server is with 4GB RAM, and around 10 sites running on it at a time. Drupal for customer review is set without caching and performance settings turned on, thus I consider, that this can be a bottle neck in some cases, but still, if I work on the site, it is quite responsive, even without performance settings turned on.

I understand that there are very many ways of solutions and potential issue roots, but wondering, if there are some constructive ways to track this down to small list of tasks to accomplish better configuration. I've experimented with different Drupal performance tuning solutions found on the net, but it still does not solve issue, if a site is not used frequently. Restarting apache helps for a while.

  • An interesting question! I think the title could be better, though. Perhaps "why is the first visit to a rarely used site slow"? – Dylan Tack Aug 30 '11 at 7:51
  • Thanks, Dylan. Sometimes, when you try to explain in more deep words, it is easy to miss the point. I've edited the title of this question. But to the question, I somehow have a feeling that this might be an issue with some resource balancing inside server, only can not confirm, that it may be on Apache or MySQL, though. – j2b Aug 30 '11 at 9:34
3

There isn't a lot of information, and the answer is likely specific to your instance, but my first guess is that you are experiencing the effects of one or more cache misses.

If you are using APC, then your rarely used site may not have core files in the bytecode cache. Subsequent visits will.

If you are using MySQL query caching, then your rarely used site likely doesn't have anything in the cache, so all queries need to actually run.

The Drupal cache entries themselves (ie, the variouls cache table) may also be stale, so initial slowdowns could be caused by this.

If you are using Poormanscron, then this could be running, too, on initial page loads.

  • Currently I am not using any opcode caching mechanism, thus keeping in mind, that PHP scripts may run slower, but have not noticed it yet, as sites are rarely used. Although, introduced the following configuration for MySQL caching: – j2b Aug 31 '11 at 3:07
  • Using Regular server CRON system. – j2b Aug 31 '11 at 3:18
  • Sorry for double posting, can not edit first comment: Currently I am not using any opcode caching mechanism, thus keeping in mind, that PHP scripts may run slower, but have not noticed it yet, as sites are rarely used. Although, introduced the following configuration for MySQL caching: key_buffer_size: 100M, enlarged query_cache_size to 64M. Restarting MySQL, things got better, but still have to wait for another hour to test it. – j2b Aug 31 '11 at 3:18
2

On Drupal 7, this is most certainly caused by Drupal's built-in implicit running of the site's cron hooks when a user hits any page on the site if it has not been run in quite some time.

You should disable this, and set up a proper cron job that runs externally. This way, users won't experience long page loads on a cold start.

See Improving Drupal 7 performance after a period of inactivity for details.

0

May be the accepted answer to this question may help you What would the optimal MySQL configuration for a Drupal 7 site be? or may be the answer to this question Why Drupal 7 is so slow?

  • I thought that 10 sites on a server with 4GB RAM with unfrequent use should not lead into MySQL performance tuning. Especially, if I do not experience particular slowness during active work on the site while developing. Do you think, it's still database layer? For sure, Apache processes are quite free according to /server-status data. – j2b Aug 30 '11 at 6:29
  • Just for reference, when planning MySQL server performance tests stackoverflow.com/questions/362223/… – j2b Aug 30 '11 at 9:39
  • At the moment, I am leaning towards MySQL server issues, although top does not indicate any overload in Apache nor MySQL. May be the cache issue takes place in my problem, but still I thought, that if opcode or queries should be recalculated on demand, it would be indicated by top figures, which are not in my case. – j2b Aug 31 '11 at 3:20
0

Maybe the issue is not with the web server configuration, but instead lying with the DNS servers. If you are actually using 'localhost', see Firefox and Chrome slow on localhost; known fix doesn't work on Windows 7. Otherwise, test with the IP address - if the problem only occurs when using the hostname, the problem is probably DNS-related.

  • I've checked your recommendations, but probably this is not the case, although, it was not clear whether I should do it on server or workstation. Tried both, and IPV6 is turned off as a whole on server. – j2b Aug 31 '11 at 3:17

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.