• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Does FileExists touch other files while searching?

Guest
Aug 12, 2009 Aug 12, 2009

Copy link to clipboard

Copied

Hi all,

I am seeing some unusual file activity on a folder on our webserver. The folder contains 100,000s of tiny files and when we add some monitoring to this folder we can see that there are a about 50 files being opened, read and then closed every second but there are 1000s of files being opened and then closed again straight away.

Whilst trying to work out where this activity was coming from I thought about FileExists. We use FileExists to check that a particular file exists before reading it. Could it be that the way FileExists works is to check through all the files in a folder to see if each one is the matching file causing it to 'touch' lots of files in the directory before it gets to the one it needs?

Thanks

Views

607

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 12, 2009 Aug 12, 2009

Copy link to clipboard

Copied

I did some looking around on Google, but couldn't find an answer to your question.  Odd that the Adobe livedocs don't say anything about how FileExists() works.  If it relies on CFDIRECTORY, I would assume that it does search each and every file in a directory, at least for the name.  But I'm not sure if it relies on that, or not.

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2009 Aug 12, 2009

Copy link to clipboard

Copied

FileExists should only be touching the file it needs to.

If you're using windows you can download FileMon

http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx

and filter on a particular file or directory that you think is being opened.

That will tell you the process doing the open and closing.

If it's CF (jrun), then only thing I can think is this is the compiler checking on the template files being included on requests to see if they need to be recompiled.  Or maybe you have a cfdirectory tag in there somewhere and don't know it?

If you're having performance issues, it could be windows accessing a directory with that many files.  You can use ms indexing on certain windows server versions to index the folder and that would help.  I would recommend breaking into sub folders if possible.

I was assuming windows 😉

Byron Mann

mannb@hostmysite.com

byronosity@gmail.com

Software Architect

hosting.com | hostmysite.com

http://www.hostmysite.com/?utm_source=bb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 14, 2009 Aug 14, 2009

Copy link to clipboard

Copied

LATEST

I concur that the folder should be broken into subfolders.

Take for example the "folder" structure that is used, say, on Microsoft's MSDN when looking-up problem reports.  There are, of course, millions of those ... uh, millions of those numbers, anyway.   But if you look up report-number "Q12345678" you'll see a path something like "Q/12/345/678."  So you know exactly where the report can be found but there are always less than (say...) 1,000 files per-folder.

It would be the straightforward work of a script to rearrange the files according to some pre-arranged system like this, and to re-program the (I hope you have a...) CFC-routine that translates a record-id into a filepath+filename.

File systems vary considerably in their implementation, but none of them seem to fare particularly well when there are hundreds-of-thousands of leaves (files) attached to a single node (directory).  "That's pushin' your luck..."

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation