简体   繁体   English

在.htaccess文件中寻找关于Apache指令效率的评论

[英]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. 我有一个非常缓慢的WordPress网站 - 与我正在运行的大多数其他WP网站不同。

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. 请查看我的基本.htaccess文件中的指令,以评估内部是否有任何内容可能导致服务器性能下降。

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. 注意:我们正在运行超过100个其他静态和基于应用程序的站点,并且它们都没有表现糟糕,所以我排除了服务器和网络。 I have also run the HTTP Live Headers Plugin and Google Page Speed plug to watch the network activity and page build & return. 我还运行HTTP Live Headers插件和Google Page Speed插件来观看网络活动和页面构建和返回。 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. 但页面需要3到10个时钟才能返回。 This happens consistently at 6am, 10am, 3pm, 8pm, etc. 这种情况一直发生在早上6点,上午10点,下午3点,晚上8点等。

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>

This happens consistently at 6am, 10am, 3pm, 8pm, etc. 这种情况一直发生在早上6点,上午10点,下午3点,晚上8点等。

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 (eg a backup or sync). 我建议这与.htaccess问题无关,而且与你的VFAT(文件系统)缓存有关,这些缓存被某些定期批处理/ cron作业 - 应用程序或系统(例如备份或同步)刷新。

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. WP加载了一些PHP模块,如果你没有启用APC或Xcache等操作码缓存(即使你启用了文件统计功能),那么这些需要大量的I / O. 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. 如果你的文件缓存已被刷新,那么这将产生大量的物理I / O,这里我们讨论每个I / O 10个mSec,因为涉及旋转金属。 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. 更糟糕的是,就像在足球比赛结束时上厕所一样,你会发现每次访问都涉及很多排队,而在你知道它之前已经过了3-10秒。

  • 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. 设置操作码缓存大小和过滤器,以确保任何每3小时一次(或其他)模块不会从操作码缓存中清除高使用率的事务代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM