-
Notifications
You must be signed in to change notification settings - Fork 154
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
tailer: don't load entire file into memory, stream it out bits at a time #48
Conversation
Maybe we could solve this issue together with #47. Some background info for other people finding this on Google When does grok_exporter read an entire log file into memory?
However, there is one exception when Why are lines buffered? If the system is under heavy load, processing grok patterns might temporarily take longer than reading new log lines. This means that the reader lags behind, and in some load tests this resulted in lost file system events, so The buffered line reader solves this problem by decoupling the line reader and the grok pattern processor. The line reader runs in one goroutine and keeps reading lines and handing them over to the buffer. The grok pattern processor runs in another goroutine and takes the lines off the buffer. That way, the line reader can temporarily read lines at a faster rate than they are processed. What does this PR change? This PR couples the line reader and the pattern processing in a way that the line reader has to wait for a line to be fully processed before the next line is read. This is similar to a very early implementation of What can we do? I have two thoughts on this:
|
If you wanted to add a buffer, you could just make the |
It seems I was a little tired when I wrote my comment yesterday, I confused the buffered tailer ( Looking at it again it really seems unnecessary to buffer more than one line in the line reader, because there is already a buffer in the buffered tailer. I will look at this again later today... Sorry for the confusion. |
It seems that |
Merged it, because we don't need one buffer in Thanks for the PR! I think I will rename the buffered line reader, because it doesn't buffer lines anymore... |
Thanks!