Expand description
§RingFile
The purpose of this tool is to help debug deadlock problems, that only occur under high-performance scenarios. Because writing log to disk will slow down execution, which makes deadlock hidden without racing conditions met.
This crate provides two abstraction:
RingBuffer: to store byte content in memory when written. when offset rewinds, new content will overwrite old content, so that memory consumption is limited to buf_size.
RingFile: to record log content in memory for multi-threaded program. Act as an observer to
analyze concurrency problem. It maintain thread local buffer to avoid lock contention.
Already integrated into captain-log as LogRingFile sink.
Structs§
- Ring
Buffer - The content is kept in memory when written, when offset rewinds, new content will overwrite old content, So that memory consumption is limited to buf_size. Once deadlock encountered and process hangs, no more message will be written, you can safely dump the content to disk.
- Ring
File - RingFile keeps [RingBuffer] within thread local, to prevent lock contention affecting program execution. When program hang or panic, you can call dump() to collect the logs into file or stdout.