You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ExtensionBasedMapper is slow for large directories #333
I've setup the server over a directory with 309.978 very small N-Quads files (~10 triples per file). (same as in #332)
Every request to a single file takes 1 - 1,5 seconds, which is quite long.
Since this mapper depends on globbing, there's probably no good way around this.
A partial solution might be to place an (LRU-)cache over readdir, but this may then lead to memory issues for many large directories.
Alternatively, a set of whitelisted extensions could be configured, so that the mapper can loop over these extensions, which would allow specific files to be tested instead of reading the whole directory.
Downside is that these extensions would have to be preconfigured, so we'd lose generality (would solve my use case here though 😄).
So I guess this performance issue with large directories is inherent to this mapping strategy,
and probably just needs to be documented as a warning.
while storing the file type in the on-disk filename itself (as opposed to in an auxiliary file)
such that the on-disk extension matches the content type, for easy opening of files on a desktop
These points are prioritized over performance with that mapping.
If performance is more important, or if storing extensions on the filesystem is not important at all, there are better trade-offs.
So my conclusion is: this mapper works as expected (even though minor performance improvements might be possible); a use case where large numbers of files in a folder are needed, might benefit from a mapping strategy that instead prioritizes performance. My suggestion is to implement such as a strategy as a separate component.
Activity
RubenVerborgh commentedon Nov 18, 2020
RubenVerborgh commentedon Nov 18, 2020
RubenVerborgh commentedon Nov 18, 2020
The extension-based mapper implements https://www.w3.org/DesignIssues/HTTPFilenameMapping.html, which is a specific combination of trade-offs.
Concretely, it is deemed important that:
These points are prioritized over performance with that mapping.
If performance is more important, or if storing extensions on the filesystem is not important at all, there are better trade-offs.
So my conclusion is: this mapper works as expected (even though minor performance improvements might be possible); a use case where large numbers of files in a folder are needed, might benefit from a mapping strategy that instead prioritizes performance. My suggestion is to implement such as a strategy as a separate component.
docs: add warning to ExtensionBasedMapper regarding performance
docs: add warning to ExtensionBasedMapper regarding performance