Skip to content

Significant performance degradation in logging.TimedRotatingFileHandler due to fix to #89564 #96159

Closed
@dgrisby

Description

@dgrisby

The fix to #89564 was to add two file checks to the shouldRollover() method of logging.TimedRotatingFileHandler and RotatingFileHandler (see 62a6677 )

This means that every single log call now does two stat() calls to the log file, which is quite expensive. If the log file is stored on NFS, those stat() calls become extremely expensive. In our application it caused a dramatic (and hard to diagnose) performance loss.

It would be better if shouldRollover() was reverted to its previous implementation, and the check for special files was moved into doRollover(). That would mean the cost of the additional checks was only incurred when there is a rollover to do.

Metadata

Metadata

Assignees

Labels

performancePerformance or resource usagestdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions