Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am setting up an apache configuration to check for the existence of a file. If the file exists, then the server will redirect to a maintenance page. If not, the application will get served up normally.

I'm concerned that with a large number of requests, that the file check has to happen on each individual request and could end up causing a large amount of unnecessary IO.

Is there IO overhead for checking the existence of a file?

If so, are there any alternatives to checking for the existence of a file?

I need to be able to modify something outside of apache that won't require a restart or graceful. For example, is there a module that allows querying a memcached instance for the presence of a key? or is there any other type of memory based cache that could be used?

share|improve this question
1  
I would imagine the file system cache would handle this in much the same way it handles all of the other files apache has to open. If you're planning to replace an active site with a check for a single file, then you shouldn't have to worry about the performance hit. –  SmallClanger May 11 '12 at 22:45
1  
@SmallClanger: This is the answer; make it one! –  Andrew M. May 12 '12 at 14:27
    
As you wish... :) –  SmallClanger May 13 '12 at 17:06
add comment

1 Answer

up vote 1 down vote accepted

I would imagine the file system cache would handle this in much the same way it handles all of the other files apache has to open. If you're planning to replace an active site with a check for a single file, then you shouldn't have to worry about the performance hit.

share|improve this answer
    
The concern is that the apache configuration would be setup to check for that file on every request even if the site is active. If the check passes (file exists) then the user is redirected to a separate site. As soon as the file is deleted, the redirection stops and the site loads normally. –  Chris Thompson May 14 '12 at 16:47
    
Is there a way to verify that the requests are hitting the file cache and not the disk? –  Chris Thompson May 14 '12 at 16:49
    
It will be. It's a tiny file that's being hit very frequently. After the first read it'll be permanently in memory. You shouldn't notice the difference at all. –  SmallClanger May 14 '12 at 17:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.