-
Notifications
You must be signed in to change notification settings - Fork 141
Fix the asyncsender and make the asyncsender queue a bounded-size circular buffer by default. #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3 similar comments
Sorry, but I would vote against it. This behavior (circular buffer) will cause silent dropping of log messages. When you print to stdout/err or any other pipe, once the buffer runs out and there is nothing to consume it, the application stalls - this is an expected behavior. There is also an overflow handler in the Sender which allows to handle overflow as one sees fit. |
@arcivanov I see your point, and I agree. What about setting |
If the default expected behavior is preserved then any additional functionality is obviously welcome. I would put a big fat warning along the lines of "If you turn this on, you may lose messages silently." |
c13e35f
to
164fed5
Compare
… size. NOTE: by default the async sender queue is blocking and non-circular. Enabling the `queue_circular` async sender option, makes the sender queue circular and non-blocking, useful in high throughput low-latency applications. Please note that with circular mode enabled, back-pressure could cause the queue to fill up and start discarding events (the oldest not yet sent).
Ok, the default now is the blocking queue, and the README has a section on how to enable the non-blocking circular queue and a warning for the possible consequences. |
I understood the situation. Thanks for the patch! |
The asyncsender was potentially blocking before, and it should never be.
Add the
queue_circular
andqueue_maxsize
options toasyncsender.FluentSender
.By default the circular buffer mode is on, so to avoid having potentially inifinite memory allocations (and OOM kills...).