H. Ferrence
H. Ferrence

Reputation: 8116

Looking for Comments on Efficiency of Apache Directives in .htaccess File

I have a painfully slow WordPress site -- unlike most other WP sites I am running.

I am methodically trying to break it down and step through site/page construction to detect where there are opportunities to gain speed and performance improvements for our user community.

Please take a look at the directives in my base .htaccess file to assess whether anything inside might contribute to poor server performance.

Notes: we are running over 100 other static and app-based sites and none of them perform badly at all, so I have ruled out the server and the network. I have also run the HTTP Live Headers Plugin and Google Page Speed plug to watch the network activity and page build & return. I can see where the page request goes out to the network, lightning fast. But it takes anywhere from 3-10 clock seconds for the page to come back. This happens consistently at 6am, 10am, 3pm, 8pm, etc.

Thanks!

Options +FollowSymLinks

RewriteEngine On
RewriteBase /insider/
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# added per BuddyBoss Site Speed Optimization Techniques
# Image and Flash content Caching for One Month
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
    Header set Cache-Control "max-age=2592000"
</FilesMatch>

# added to increase file upload size
<IfModule mod_php5.c>
    php_value post_max_size 10M
    php_value upload_max_filesize 10M
</IfModule>

Upvotes: 0

Views: 101

Answers (1)

TerryE
TerryE

Reputation: 10888

This happens consistently at 6am, 10am, 3pm, 8pm, etc.

You've really just answered your Q without realising it. I suggest that this is nothing to do with .htaccess issues and everything to do with your VFAT (filesystem) caches being flushed by some periodic batch/cron job -- either application or system (e.g. a backup or sync).

WP loads a stash of PHP modules and if you don't have an opcode cache such as APC or Xcache enabled (and even if you do and file stat'ing enabled) then these require a lot of I/Os. If your file caches have been flushed then this will generate a lot of physical I/O and here we are talking of 10s of mSec per I/O because spinning metal is involved. Worse just like going to the toilet at the end of a football game, you'll find that each visit involves a lot of queueing, and before you know it 3-10secs have elapsed.

  • Make sure that you have an opcode cache enabled.
  • Look at the other batch load and make sure its "niced"
  • Set your opcode cache sizes and filters to ensure that any once-per-3hr (or whatever) modules don't flush the high-use transactional code out of the opcode cache.

Upvotes: 2

Related Questions