SerCeMan / jnr-fuse

FUSE implementation in Java using Java Native Runtime (JNR)
MIT License
363 stars 86 forks source link

write throughput very low compared to read #125

Open lynus opened 3 years ago

lynus commented 3 years ago

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.

lynus commented 3 years ago

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.