dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Htaccess performance penalty

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Posts
    672

    Htaccess performance penalty

    Does anyone have any resources or personal experience that gives benchmarks on the performance penalty of using .htaccess files for server configuration changes over directly placing them in the httpd.conf file? And if possible at what size does the htaccess file have to reach to achieve such a slowdown?
    I am also curious as to whether linux's disk cache will automatically cache the htaccess file in ram, and if it does what effect does this have on the possible performance penalty in question?
    Thanks in advance!

  2. #2
    Join Date
    Mar 2010
    Posts
    672
    I have since posting this topic found information that answers my question. However for the benefit of others i will post that info here too.
    Basically the answer is not what you'd expect. Yes there is a performance penalty in the form of a request delay, but it is not specifically bounded to the processing of the .htaccess file. Basically, by just enabling the ability to have a .htaccess file override/add to your httpd.conf settings you're causing the delay through a series of file system lookups whereby apache looks for a .htaccess file in the current directory and any parent directories above it (for overarching aggregate directives). This extra file system access is what causes the majority of the delay penalty and very little delay is accrued through the actual processing of the .htaccess files. Even so you can speed up the access by correctly writing your .htaccess file with a correct order. For example, if visitors are going to commonly hit a redirect, you should place that redirect near the top of your file so that it will hit the redirect before having to trudge through any of the other directives that may exist.
    As for linux's disk cache, it depends on your server setup and the types of files you serve. However linux's disk cache may very well save you a bit of time during the directory checking phase since i believe linux's cache uses the lru (least recently used) caching methodology and it is very likely that since the .htaccess file is called every page request that it will be cached.
    Hope that helps others who have the same questions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles