[logback-dev] [JIRA] (LOGBACK-1517) Reduce disk io when rolling between different filesystems

QOS.CH (JIRA) noreply-jira at qos.ch
Sun May 17 15:15:00 CEST 2020


Takanori Takase created LOGBACK-1517:
----------------------------------------

             Summary: Reduce disk io when rolling between different filesystems
                 Key: LOGBACK-1517
                 URL: https://jira.qos.ch/browse/LOGBACK-1517
             Project: logback
          Issue Type: Improvement
          Components: logback-core
    Affects Versions: 1.2.3
            Reporter: Takanori Takase
            Assignee: Logback dev list


In "TimeBasedRollingPolicy#renameRawAndAsyncCompress", the temporary file ("*.tmp") is created based on the compressed file path.
{code:java}
 Future<?> renameRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws RolloverFailure {
 String parentsRawFile = getParentsRawFileProperty();
 String tmpTarget = nameOfCompressedFile + System.nanoTime() + ".tmp";
 renameUtil.rename(parentsRawFile, tmpTarget);
 return compressor.asyncCompress(tmpTarget, nameOfCompressedFile, innerEntryName);
 }
{code}
If the active log path and the compressed log path are located in different filesystems, this could add extra load to the infrastructure especially in cases where the active log path is under a fast disk (cf: locally-mounted SSDs, tmpfs) and the compressed log path is under a slower disk (cf: NFS, FUSE).
{noformat}
/fast-disk/logs/example.log 
/slow-disk/logs/example.log.gz.nano.tmp
/slow-disk/logs/example.log.gz
{noformat}
The rename writes a temp file into the slow-disk, then reads from the slow disk for in-memory compression. Both of these require accessing the slow-disk.

This can be optimized by creating the temp file under the same directory as the active file (assuming that rename doesn't require as much disk io as copying).
{noformat}
/fast-disk/logs/example.log 
/fast-disk/logs/example.log.nano.tmp
/slow-disk/logs/example.log.gz
{noformat}



--
This message was sent by Atlassian Jira
(v8.8.0#808000)


More information about the logback-dev mailing list