Comments (6)
另外 正常项目日志输出每秒行数峰值很少超过千行级别的, 1万的队列实际上可处理的日志每秒是10万以上级别的, 我这边测试是20万. 而实际业务中超过每秒1万的情况一般只有一个 死循环.. 这种情况下除了第一次的日志是有意义的 后面拥堵到日志队列的都是垃圾数据. 如果爆内存 很可能所有日志丢失. 所以 极端情况下丢日志的做法是相对好的选择.
from log4z.
@zsummer 多谢回复,的确如你所说,在我实际使用中,正常逻辑下log4z没出现丢日志的情况。我也是在测试各个日志库的性能的时候发现的这个现象。循环里只输log,什么都不干,属于极端情况。其它日志库比如glog虽然不会丢,但会把执行时间拉长。
from log4z.
拉长执行时间倒也是一个不错的方法 我可以考虑再加个宏定义来切换丢日志或者短暂sleep
from log4z.
目前的解决方案采用了拉长写入间隔的方式替换掉了原先丢弃日志的方式. 效果很好.
from log4z.
@zsummer 效果非常好!!对比了一下,3线程,每线程10万行日志,比glog快了一个数量级。
from log4z.
目前单线程比多线程还快. 单线程我这里测试简单字符串能稳定跑220万/second . 复杂类型也有80万. linux下折半 简单字符串100万 复杂类型log 48万. 本来打算测试下glog和log4cpp做下对比的 一下子忙起来了. .. 没顾上
from log4z.
Related Issues (20)
- 建议封装成动态库 HOT 2
- 怎么输出进程线程ID啊?还有就是输出的顺序有点问题? HOT 1
- 进程长时间不写(跨天),重新新建log文件写入的问题 HOT 1
- 是否支持中文路径? HOT 1
- android compile err.error: 'gcvt' was not declared in this scope. HOT 3
- Thread_local is not supported for iOS 8.4 or earlier. It will cause a compile error in Xcode HOT 1
- 'isnan' was not declared in this scope if (isnan(t)) ;这样的问题怎么解决? HOT 1
- DynamicCreateLogger 接口缺失 HOT 2
- 在VS下断点调试时,并不能立即输出 HOT 2
- API reference is missed HOT 2
- 如何限制日志的大小呢? HOT 1
- error C3861: 'isnan': identifier not found HOT 1
- 日志自动清除 HOT 2
- 可以指定文件名格式和文件夹格式吗
- Log4zFileHandler::open不支持单个2GB以上的文件
- Mismatch (malloc vs operator delete)
- 这个是不是多线写日志文件 自旋锁导致的问题 程序崩溃?
- log4z thread mutex bug? HOT 1
- 请问单条日志容量如何设定?
- Does log4z clear old logs in the logfolder? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from log4z.