linux - 使用 htaccess 文件会在多大程度上降低网站性能(尤其是固态硬盘)?

标签 linux performance apache .htaccess

Apache 文档说 ( http://httpd.apache.org/docs/2.4/howto/htaccess.html ),

"You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance."

但这让我不知道影响的规模。

我有一个专为共享主机设计的架构,其中唯一的选择是使用 htaccess 文件。

我要搬到 Digital Ocean,在那里我可以做我喜欢做的事。

我需要判断是坚持使用 htaccess 文件还是将内容从那里移到集中式配置文件中并关闭它们。

可能有数百个低使用率的小型网站(本地企业)。

如果性能影响在服务页面时总计不到 50 毫秒,或者有其他一些小的影响,例如将可支持的并发访问数量减少不到 5%,那么我不在乎。

如果效果足够大,人们可能会感觉到不同,那么我就足够关心花时间改变事情。

但我没有发现任何迹象表明我可以预期命中的数量级。

谁能教教我?

编辑:我不是在寻找确切数字之类的东西。但可以肯定的是,某个地方比我更有能力的人已经做过一些基准测试,或者从经验中知道在特定情况下可能存在的差异类型。

最佳答案

来自answer on Quora通过 Jonathan Klein , 1500 行 .htaccess 文件需要 12 毫秒:

Having a large .htaccess does have a cost. Ours is currently ~1500 lines and we benchmarked the time spent parsing it at around 10-12ms on a production webserver. Hardware makes a difference obviously, but you can fairly safely assume that the cost of that 3000 line .htaccess is around 25-35ms per request.

关于linux - 使用 htaccess 文件会在多大程度上降低网站性能(尤其是固态硬盘)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25063677/

相关文章:

linux - 使用 Solus Linux 安装 MongoDB。我设置了路径变量,但 Mongod 在启动时关闭

sql-server-2005 - 是否可以通过事务复制获得低于 1 秒的延迟?

mysql - 根据分组依据查询最后 N 行

apache - 除了所有子域外,在 htaccess 中强制 www

apache - WAMP 本地主机上的多个域

linux - 如何维护旧 Linux 内核的应用程序

linux - Grep 最新文件字符串

c# - LINQ:将某些对象属性选择到同一对象中

apache - 导入/导出 Apache Jackrabbit 存储库的最佳方式

linux - 通过类似守护进程的 bash 运行程序