cyfonly / flogger Goto Github PK
View Code? Open in Web Editor NEW基于双缓冲队列、多刷盘机制的超轻量级 java 日志
Home Page: http://www.cnblogs.com/cyfonly/p/6139049.html
License: Apache License 2.0
基于双缓冲队列、多刷盘机制的超轻量级 java 日志
Home Page: http://www.cnblogs.com/cyfonly/p/6139049.html
License: Apache License 2.0
java.io.FileNotFoundException: .\log\2017-04-06\info.log (另一个程序正在使用此文件,进程无法访问。)
/** 日志缓冲列表A */
public ArrayList alLogBufA = new ArrayList();
/** 日志缓冲列表B */
public ArrayList<StringBuffer> alLogBufB = new ArrayList<StringBuffer>();
使用ArrayList不可避免的涉及到数组复制,这里还有优化空间,比如为ArrayList设置初始大小
我发现你这个日志框架是在一个run死循环里不断flush()日志,死循环情况下不是会占用cpu性能吗,如果单核情况下cpu是不是直接100%负荷了,如果我在run()里面sleep(1)以下会不会更好点?
nextWriteTime只是在创建日志文件的时候设置了值,flush后没有更新该值。
有个bug,nextWriteTime一直没有更新,设置无效
最终生成的日志文件大小与配置中的 SINGLE_LOG_FILE_SIZE
会相差很多,有误差是肯定的,但是这个误差有些大,并且会随着时间的增长,误差呈线性增长。
猜测:
flush()
方法中,判断缓存大小与配置的缓存最大量时,虽然条件成立进入 if
语句,但此时仍在继续向缓存中写入数据。自己 fork 了您的项目,尝试去做一下改进,大体思路还是您的思路。改进之后整体效率是略高于您的实现,单个线程写入会快于您的实现 1 - 2 s,还需要去做更多的测试。但是上述问题还是没有改进。归结起来就是多线程的问题,还需要做更多的思考。
非常幸运很遇到这么优秀的类库!!!
执行FloggerThroughputTest进行测试是,抛出OutOfMemoryError,是否应该将SINGLE_LOG_CACHE_SIZE调小。实际使用过程中,这些参数应该做什么样的调整,有没有建议值。
或者是说要修改web容器jvm参数。
使用record_100_byte时不会报错,record_200_byte及以上就抛出这个错误。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.