[
https://issues.apache.org/jira/browse/OAK-8186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16812857#comment-16812857
]
Ruben Reusser commented on OAK-8186:
------------------------------------
[~mduerig] [~mattvryan] depending on the sizeĀ of the file one copies the
performance differs. Attached is a test jar file you can run to perform a test
{code:java}
java -jar fileCopyTest-0.0.1-SNAPSHOT.jar 1000000 100 filescopy
{code}
you can use filescopy (uses Files.copy(path, path)) or stream (uses apache
commons IOUtils.copy(stream, stream)
tool at [2], java class used for testing at [3]
You can see that once the file reaches 1MB the Files.copy performs better.
test result linux, ssd drive:
{code}
$ java -jar fileCopyTest-0.0.1-SNAPSHOT.jar 100000000 100 stream
run:0,100M,100000000.bin,100000000.0.bin,91215443ns,91ms
stats:
average: 70ms
total: 6936ms
$ java -jar fileCopyTest-0.0.1-SNAPSHOT.jar 100000000 100 filescopy
run:0,100M,100000000.bin,100000000.0.bin,64425831ns,64ms
stats:
average: 57ms
total: 5623ms
{code}
test result windows, old school drive:
{code}
>java -jar fileCopyTest-0.0.1-SNAPSHOT.jar 100000000 100 stream
run:0,100M,100000000.bin,100000000.0.bin,148289264ns,148ms
stats:
average: 142ms
total: 13931ms
>java -jar fileCopyTest-0.0.1-SNAPSHOT.jar 100000000 100 filescopy
run:0,100M,100000000.bin,100000000.0.bin,44045122ns,44ms
stats:
average: 42ms
total: 4144ms
{code}
test command options:
{code:java}
fct <size> <runs> <method> [verbose]
{code}
note: jackrabbit uses temporary files in jackrabbit-vault after a certain size
(1MB) at [1]
[1]
https://github.com/apache/jackrabbit-filevault/blob/6df76ba4a45316a84ec1cd10636296d191a82260/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/ZipStreamArchive.java#L249
[2]
https://issues.apache.org/jira/secure/attachment/12965256/fileCopyTest-0.0.1-SNAPSHOT.jar
[3] https://issues.apache.org/jira/secure/attachment/12965257/FileCopyTest3.java
> Create API in OAK for file access to binaries in the repository.
> ----------------------------------------------------------------
>
> Key: OAK-8186
> URL: https://issues.apache.org/jira/browse/OAK-8186
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Reporter: Henry Saginor
> Priority: Major
> Attachments: FileCopyTest3.java, OAK File Access.jpg,
> fileCopyTest-0.0.1-SNAPSHOT.jar
>
>
> To get file access applications normally write binaries to temp files. It
> would be nice if an API existed to get file access directly from OAK. This
> might also meet some use cases documented at
> [https://wiki.apache.org/jackrabbit/JCR%20Binary%20Usecase]
> Suggested API and implementation can be found here [1]. Also, see attached
> diagram [2].
> I can create a patch if I can get some feedback. Note that suggested API
> makes it explicit that a temp file is created. I am not sure if direct access
> to files in datasore would be safe. But I am open to suggestions.
> [1]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-api/src/main/java/org/apache/jackrabbit/oak/api/blob/FileReferencable.java]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-api/src/main/java/org/apache/jackrabbit/oak/api/blob/TempFileReference.java]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-api/src/main/java/org/apache/jackrabbit/oak/api/blob/TempFileReferenceProvider.java]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/FileDSBlobTempFileReference.java]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStore.java]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java]
>
> [https://github.com/hsaginor/jackrabbit-oak/blob/directFileAccess/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/plugins/value/jcr/BinaryImpl.java]
> [2]
> !OAK File Access.jpg!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)