Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 132508 - Repeated masterfs FileObject.getMIMEType() touches disk
Repeated masterfs FileObject.getMIMEType() touches disk
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Filesystems
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Jiri Skrivanek
issues@platform
: PERFORMANCE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-10 12:06 UTC by Jaroslav Tulach
Modified: 2008-12-22 14:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
Test that counts file access. OK for LocalFileSystemTest, not OK for MasterFileSystemTest (15.02 KB, patch)
2008-04-10 12:07 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2008-04-10 12:06:33 UTC
The FileObject.getMIMEType() method is essencial for speed of DataObject.find(...) recognition. There is hundreds of 
loaders and each of them asks for mimetype of the same FileObject. That is why the method needs to be optimized, to 
quickly return the result in subsequent calls. This is not the case for current implementation of masterfs. It always 
touches a disk, which can be quite time consuming, especially on network drives.

Surprisingly plain LocalFS is ok. Please fix masterfs as well.
Comment 1 Jaroslav Tulach 2008-04-10 12:07:23 UTC
Created attachment 59964 [details]
Test that counts file access. OK for LocalFileSystemTest, not OK for MasterFileSystemTest
Comment 2 Antonin Nebuzelsky 2008-04-15 17:14:00 UTC
Reassigning to new module owner jskrivanek.
Comment 3 Petr Nejedly 2008-05-14 11:07:03 UTC
There always was a single-entry cache in the filesystems, but unfortunately it always checked the timestamp of the file,
at least. Maybe the problem is only in the timestamp check...
Comment 4 Petr Nejedly 2008-05-14 12:54:57 UTC
Oh yes, it is indeed caused mostly by the lastModified calls according to the stack traces from:
http://wiki.netbeans.org/attach/FitnessAgainstForgetfulness/disk-touches.txt
Comment 5 Jiri Skrivanek 2008-06-17 13:30:51 UTC
As Petr Nejedly pointed out it is not necessary to check lastModified for cached FileObject because it listens to file
changes and discards cached data when file is changed. I also added test inspired by Jarda and removed obsolete test cases.

http://hg.netbeans.org/core-main/rev/b66e3b3d3817


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo