Skip to content
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

File Reader 缓存机制疑问 #278

Closed
qinhao opened this issue Jan 2, 2018 · 3 comments
Closed

File Reader 缓存机制疑问 #278

qinhao opened this issue Jan 2, 2018 · 3 comments

Comments

@qinhao
Copy link

qinhao commented Jan 2, 2018

Hi,最近准备使用 logkit 作当前业务的日志收集器,主要是将日志文件中的数据直接读取到 Elasticsearch 中,直接使用 logkit 无法满足当前业务日志插入速率,所以考虑从以下 3 个方面进行优化:
1)日志源读取(Reader
2)日志解析(JSON Parser
3)日志插入(Sender
针对 2),使用 https://github.com/json-iterator/go 替换了 encoding/json,参见 #277 。针对 3),同样对 github.com/olivere/elastic 中的 encoding/json 做了替换,参见 olivere/elastic#667。最后发现,日志插入速率瓶颈应该在日志文件读取这一部分。
通过阅读源码,发现 Reader 从文件中读取的数据是先缓存到一个临时文件,之后 Sender 从临时文件读取数据,请问为什么不使用内存作缓存而采用当前机制?我想,如果使用内存作缓存,日志读取速率应该会有一个比较大的提升,目前也在尝试相关实现,请问有没有相关建议?

@wonderflow
Copy link
Contributor

关于第一个,读取的就是在内存里的,存到临时文件说的是本地磁盘队列吗?那个是可选项

@wonderflow
Copy link
Contributor

我们非常欢迎PR

@qinhao
Copy link
Author

qinhao commented Jan 3, 2018

OK,我在仔细阅读一下源码 ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants