Open
Conversation
- Implement in-memory compressing logger and --memlog flag - Extend log.Logger with Flush/Close (no-op for default/nop) - Return memlogger in CreateSDKLogger when enabled - Close then Flush in ListenForQuitSignals to persist pending logs
…g, add tests - Append compressed chunks directly to WAL on interval/memory triggers - Remove in-memory chunk retention by default; cap via memory-bytes - Flush now compresses tail and fsyncs WAL; Close drains and closes - Minimal walWriter (DataDir/NodeID), default 1 GiB rolling, big buf - Derive WAL buf size from memory-bytes (≥1GiB→16MiB, ≥256MiB→8MiB, else 4MiB) - Use fdatasync on Linux; fallback to fsync elsewhere - Simplify app config to interval, memory-bytes, dir (max-bytes kept as deprecated alias) - Add wal_writer unit tests and benchmarks (incl. bufSize vs chunk size)
Author
MetricsTesting Env
Benchmark Setup
Summary
Overall, both configurations confirm that MemLogger achieves high observability with minimal overhead. CPU Usage
Memory Usage
Disk I/O
Memory Debug Logger (WAL + Filter applied)
Default Info Logger
Default Debug Logger
Memory Debulg Logger Without Filter (same logging contents as default debug logger)
|
djm07073
reviewed
Nov 5, 2025
- Add per-frame sidecar index (.wal.idx) alongside compressed WAL (.wal.gz). - Each line records the target .gz file and compressed byte range (off,len) plus metadata (frame id, rec count, first/last ts, optional CRC32 of uncompressed payload). - Purpose: enable reliable tail/stream of a single growing .gz via random-access reads, since most shippers cannot follow gzip; decouple production from shipping; support fast resume/backfill. - Reader follows the .idx and fetches frames via section reads + gzip, switching files on rotation when the recorded file changes. - Benefits: low-latency shipping with bounded memory, crash-resume from last processed line, integrity verification, and simpler external agents. - Backwards-compatible: WAL format unchanged; index is append-only and optional. Writers append the .idx line after successfully writing the frame to the .gz. - Note: durability still depends on appropriate fsync policy; consumers may verify CRC and line counts when needed.
Implements a production-ready logger that buffers logs in memory, compresses them asynchronously with gzip, and persists to a WAL with sidecar index for efficient replay. Features: - Time/size-based flushing with configurable thresholds - Object pooling for zero-allocation compression - Message filtering for consensus-critical events - Chronological ordering preserved (drops on failure) - Automatic segment rotation and platform-optimized fsync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
















Description
Adds
MemLogger: a WAL-based in-memory compressing logger for high-throughput environments.Key Features
Usage