SerCeMan / jnr-fuse

FUSE implementation in Java using Java Native Runtime (JNR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

write throughput very low compared to read

lynus opened this issue · comments

I found write perform very poorly compared to read.
I modified MemoryFS such that MemoryFile' read() and write() basically do nothing:
`
private int read(Pointer buffer, long size, long offset) {
int bytesToRead = (int) Math.min(filesize - offset, size);
return bytesToRead;
}

private int write(Pointer buffer, long bufSize, long writeOffset) {
int maxWriteIndex = (int) (writeOffset + bufSize);
if (maxWriteIndex > filesize)
filesize = maxWriteIndex;
return (int) bufSize;
}
`
The benchmark workload executed is simply sequently write and then read a single file. The throughput for read/write are
2000MB/s and 300MB/s. I tried various block sizes and the gap persists.

I tested the same read/write stub routine on juse-jna, the result shows their throughput are nearly the equal.
I compile the code with openjdk8. And the jvm the code run on are openjdk8 and openjdk16, the big gap exists on both platforms.