[OpenAFS] AFS and PhotoShop interaction?
Mon, 18 Dec 2006 06:37:41 -0500
As a follow-up, I have spent the last few weeks working on this issue.
Indeed, Photoshop's behavior is hideous but that doesn't mean that
OpenAFS couldn't be more efficient.
Photoshop for some unknown reason wants to access the file
by performing a FindFirst for dir2 within dir1; then a FindFirst for
dir3 within dir2; and then a FindFirst for file within dir3. It
does this several times as part of the opening of each and every file.
It also does this as part of the construction of the "Open recent"
The implementation of the CIFS FindFirst operation is to parse the
AFS directory data for the specified search mask and return the results.
If the number of items within the directory are small this
implementation is not too much of a problem. However, if the number of
directory items is large (greater than 10,000 items in Mike's situation)
the AFS client service will burn a great deal of CPU and clock time
searching all of the data buffers. If the search mask pattern contains
a wild card then we really don't have a choice but to search the
On the other hand, if there are no wild cards then we can optimize the
FindFirst function and for this case change function to require constant
time. [O(1) instead of O(n)] Instead of searching the directory data
we instead perform a cm_Lookup() on the file name and ensure that we
have a valid callback.
With this change, the performance of Photoshop on directory trees with
large numbers of entries becomes more than reasonable. 250MB JPGs open
in about two seconds of clock time when stored in a three directory deep
tree. At the same time AFS client service CPU utilization remains in
the single digits instead of using 99% of a single processor.
During the analysis of the behavior it was also determined that the CIFS
CreateX and NTCreateX functions could optimize the number of lock
operations performed against the file server reducing the number of
round trips from three to one. This change further reduces the time
necessary to open a file in exclusive write mode.
I wish to thank Pictage for funding this research and development that
the entire community in going to benefit from.
These changes will appear in 1.5.13.
Secure Endpoints Inc.