Skip to content

Benchmark and FastLogger#5081

Merged
aleks-f merged 49 commits intomainfrom
5087-log-performance
Dec 22, 2025
Merged

Benchmark and FastLogger#5081
aleks-f merged 49 commits intomainfrom
5087-log-performance

Conversation

@aleks-f
Copy link
Copy Markdown
Member

@aleks-f aleks-f commented Dec 9, 2025

  • Benchmark app
  • make SpinlockMutex adaptive
  • add Channel::log(Message&&) (only AsyncChannel benefits)
  • PatternFormatter performance
    • cache nodeName
    • cache timezone
    • speedup
    2025-12-08T17:50:15-06:00
    -------------------------------------------------------------------------------------------------
    Benchmark                                       Time             CPU   Iterations UserCounters...
    -------------------------------------------------------------------------------------------------
    BM_PatternFormatter_NodeName                 1420 ns         1419 ns       487713 bytes_per_second=55.0918Mi/s
    BM_PatternFormatter_Basename                  303 ns          303 ns      2333536 bytes_per_second=292.448Mi/s
    BM_PatternFormatter_LocalTime                2237 ns         2237 ns       330861 bytes_per_second=32.4008Mi/s
    
    2025-12-08T18:25:41-06:00
    ---------------------------------------------------------------------------------------------
    Benchmark                                   Time             CPU   Iterations UserCounters...
    ---------------------------------------------------------------------------------------------
    BM_PatternFormatter_NodeName              134 ns          134 ns      4989309 bytes_per_second=584.209Mi/s
    BM_PatternFormatter_Basename              160 ns          160 ns      4306738 bytes_per_second=555.349Mi/s
    BM_PatternFormatter_LocalTime             265 ns          265 ns      2648245 bytes_per_second=273.883Mi/s
    
  • Logger performance
    • Quill wrapper
    • same interface as Poco::Logger
    • can be used interchangeably as needed
    • can be excluded from build
    • ~500k Foundation release binary size increase on linux
    • benchmark (Linux)
    $ Benchmark/bin/Linux/aarch64/benchmark --filter="Loggers"
    2025-12-21T11:10:24-06:00
    Running benchmark
    Run on (16 X 2000 MHz CPU s)
    Load Average: 2.99, 1.19, 0.63
    ------------------------------------------------------------------------
    Benchmark                              Time             CPU   Iterations
    ------------------------------------------------------------------------
    Loggers_AsyncChannel_File            443 ns          434 ns      1605661
    Loggers_FastLogger_File             96.3 ns         12.5 ns     56502348
    Loggers_AsyncChannel_ShortMsg        450 ns          445 ns      1528669
    Loggers_FastLogger_ShortMsg          410 ns         7.96 ns     10000000
    Loggers_AsyncChannel_LongMsg         658 ns          645 ns      1354774
    Loggers_FastLogger_LongMsg           621 ns         12.3 ns     10000000
    
    ==================================================
      Loggers Summary (Wall Time)
    ==================================================
    Test        AsyncChannel                FastLogger
    --------------------------------------------------
    File            442.9 ns            96.3 ns (4.6x)
    LongMsg         658.1 ns           621.5 ns (1.1x)
    ShortMsg        449.5 ns           410.1 ns (1.1x)
    ==================================================
    
    ==================================================
      Loggers Summary (CPU Time)
    ==================================================
    Test        AsyncChannel                FastLogger
    --------------------------------------------------
    File            434.2 ns           12.5 ns (34.7x)
    LongMsg         644.6 ns           12.3 ns (52.4x)
    ShortMsg        445.2 ns            8.0 ns (55.9x)
    ==================================================
    

aleks-f and others added 19 commits December 5, 2025 13:50
* fic(ci): separate oracle and sqlserver odbc (out of disk space)

* use oracle odbc driver

* use oracle free

* ad db user

* postpone adding user after build

* remove default tablespace (does not exist)

* reinstate all ci jobs
PatternFormatter:
- Cache node name (Environment::nodeName()) to avoid repeated syscalls
- Add extractBasename() for efficient %O format specifier
- Add string reserve(128) to reduce reallocations during formatting

Timezone:
- Cache UTC offset to avoid repeated syscalls (8x speedup for %L patterns)
- Auto-detect TZ environment variable changes to invalidate cache
- Add reloadCache() method for explicit cache refresh

Tests:
- Add TimezoneTest::testUtcOffsetCaching()
- Add PatternFormatterTest::testExtractBasename()
execute all named tests (not only the first one)
accept test name with class (eg. testrunner LoggerTest::testLogger) #5083
…ows support

- Add LoggerBench.cpp with AsyncChannel vs FastLogger benchmarks
- Add compare.sh (Linux/macOS) and compare.ps1 (Windows) scripts
- Add LOGGER_BENCHMARK.md with cross-platform benchmark results
- Update README.md with Windows build instructions (Ninja, CMAKE_PREFIX_PATH)
- Add error message when -- options are used on Windows (should use /)
- Update CMakeLists.txt and Makefile to include LoggerBench #5080
FastLogger provides a Poco-compatible wrapper around the Quill logging
library, offering significant performance improvements over AsyncChannel
through lock-free SPSC queues and backend thread processing.

Key features:
- Drop-in replacement for Poco::Logger with FastLogger::get()
- Support for all standard Poco channels (Console, File, Rotating, etc.)
- XML/properties configuration via FastLoggerConfigurator
- Thread affinity for backend worker on Linux and Windows
- Log file rotation with size and time-based policies

Performance (CPU time - calling thread latency):
- Linux: 31-70x faster than AsyncChannel
- Windows: 23-87x faster than AsyncChannel
- macOS: Limited improvement due to lack of thread affinity support

New files:
- Foundation/include/Poco/FastLogger.h
- Foundation/src/FastLogger.cpp
- Util/include/Poco/Util/FastLoggerConfigurator.h
- Util/src/FastLoggerConfigurator.cpp
- dependencies/quill/ (header-only Quill 7.5.0 library)
@aleks-f aleks-f linked an issue Dec 20, 2025 that may be closed by this pull request
Build system changes:
- Add POCO_NO_FASTLOGGER compile definition in CMake when ENABLE_FASTLOGGER=OFF
  to prevent Config.h from auto-enabling FastLogger
- Add ifdef guards around FastLogger tests in LoggingTestSuite.cpp
- Exclude FastLoggerTest.cpp and FastLoggerChannelsTest.cpp from CMake build
  when FastLogger is disabled
- Add POCO_NO_FASTLOGGER support to Make build system for Foundation and Util
- Add CI jobs to verify builds work without FastLogger (CMake and Make)

Code changes:
- Add LoggingConfigurator::configure() convenience method for quick logging setup
@aleks-f aleks-f linked an issue Dec 21, 2025 that may be closed by this pull request
@aleks-f aleks-f merged commit 1850dc1 into main Dec 22, 2025
129 of 130 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants