diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-12-01 10:16:17 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-12-01 10:16:20 +0000 |
commit | ad6ba3b37c5adfe6ba461b0815169825cc0a9d81 (patch) | |
tree | bec752a2f52d97f023d0c07e1edb69e1cebce7bc /container-accesslogging | |
parent | 26c16eeb3d4d792938ab9af9aff1e01b540a6f42 (diff) |
avoid calling nativeIO.dropPartialFileFromCache too often
* there is no need to call fsync() every 100 milliseconds just to drop
minimal amounts of data from the file system cache.
Diffstat (limited to 'container-accesslogging')
-rw-r--r-- | container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java index a3d34ae6a2c..ab246a21a43 100644 --- a/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java +++ b/container-accesslogging/src/main/java/com/yahoo/container/logging/LogFileHandler.java @@ -125,8 +125,10 @@ public class LogFileHandler extends StreamHandler { try { if (currentOutputStream != null) { long newPos = currentOutputStream.getChannel().position(); - nativeIO.dropPartialFileFromCache(currentOutputStream.getFD(), lastDropPosition, newPos, true); - lastDropPosition = newPos; + if (newPos > lastDropPosition + 102400) { + nativeIO.dropPartialFileFromCache(currentOutputStream.getFD(), lastDropPosition, newPos, true); + lastDropPosition = newPos; + } } } catch (IOException e) { logger.warning("Failed dropping from cache : " + Exceptions.toMessageString(e)); |