Puppy icon indicating copy to clipboard operation
Puppy copied to clipboard

Logger performance due to open/seek/write/close system calls for each logged message

Open vsarunas opened this issue 6 months ago • 3 comments

Running into a problem if there is a high rate of logging that the logger is unable to keep up and what is written on disk can lag behind several minutes. With all of the log messages being queued in memory.

Creating a test which logs via FileLogger(logFile,logFormat: logFormat, fileURL: fileURL, flushMode: .manual) does not seem to help much on macOS: attaching using Instruments and profiling using File Activity.

For flushMode: .always: instruments_file_activity_flush

For flushMode: .manual: instruments_file_activity_noflush

The only difference is sys_fstat64 duration; but how far behind the written log messages fall behind the current time does not seem to drastically change.

On Linux, sync() visible in a FlameGraph at least: linux_filehandle_sync

vsarunas avatar Aug 05 '24 15:08 vsarunas