guohao-rosicky commented on PR #5331:
URL: https://github.com/apache/ozone/pull/5331#issuecomment-1727557479
hi, @sodonnel
I think you are talking about dirty_expire of the filesystem, this threshold
is determined by the kernel parameter, I did a simple test and the result is as
follows:
**test code:**
```java
public static void main(String[] args) throws IOException {
final long filesize = 1024 * 1024 * 1024;
final File file = new File("/Users/rosicky/test/file1.txt");
final File file2 = new File("/Users/rosicky/test/file2.txt");
final FileOutputStream fileOutputStream = new FileOutputStream(file);
final BufferedOutputStream bufferOutputStream =
new BufferedOutputStream(new FileOutputStream(file2), 8 * 1024 *
1024);
final byte[] data = new byte[512];
final long startTime = System.nanoTime();
writeData(fileOutputStream, data, filesize);
long cost1 = System.nanoTime() - startTime;
System.out.println("file output cost: " + cost1 + "ns");
final long startTime2 = System.nanoTime();
writeData(bufferOutputStream, data, filesize);
long cost2 = System.nanoTime() - startTime2;
System.out.println("buffered output cost: " + cost2 + "ns");
}
public static void writeData(OutputStream outputStream, byte[] data,
long filesize)
throws IOException {
for (int i = 0; i < filesize; i += data.length) {
outputStream.write(data);
}
outputStream.close();
}
```
**result:**
```
file output cost: 11646780329ns
buffered output cost: 523351965ns
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]