3

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?

Chris Thompson
  • 537
  • 1
  • 13
  • 22
  • 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

1 Answers1

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
  • 9,127
  • 1
  • 32
  • 47
  • 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