Giter Site home page Giter Site logo

flogger's Issues

性能还有优化空间

/** 日志缓冲列表A */
public ArrayList alLogBufA = new ArrayList();

/** 日志缓冲列表B */
public ArrayList<StringBuffer> alLogBufB = new ArrayList<StringBuffer>();

使用ArrayList不可避免的涉及到数组复制,这里还有优化空间,比如为ArrayList设置初始大小

请教几个问题,关于线程方面的问题

我发现你这个日志框架是在一个run死循环里不断flush()日志,死循环情况下不是会占用cpu性能吗,如果单核情况下cpu是不是直接100%负荷了,如果我在run()里面sleep(1)以下会不会更好点?

生成的日志文件大小有时与配置中的相差甚远

最终生成的日志文件大小与配置中的 SINGLE_LOG_FILE_SIZE 会相差很多,有误差是肯定的,但是这个误差有些大,并且会随着时间的增长,误差呈线性增长。
猜测:

  1. flush() 方法中,判断缓存大小与配置的缓存最大量时,虽然条件成立进入 if语句,但此时仍在继续向缓存中写入数据。
  2. 当缓存队列切换过来后,此时创建文件的效率肯定会低于向缓存中写入数据的效率,所以在这段时间,缓存中的数据量就已大于配置的缓存最大量。

自己 fork 了您的项目,尝试去做一下改进,大体思路还是您的思路。改进之后整体效率是略高于您的实现,单个线程写入会快于您的实现 1 - 2 s,还需要去做更多的测试。但是上述问题还是没有改进。归结起来就是多线程的问题,还需要做更多的思考。

执行FloggerThroughputTest时抛出异常

执行FloggerThroughputTest进行测试是,抛出OutOfMemoryError,是否应该将SINGLE_LOG_CACHE_SIZE调小。实际使用过程中,这些参数应该做什么样的调整,有没有建议值。
或者是说要修改web容器jvm参数。
使用record_100_byte时不会报错,record_200_byte及以上就抛出这个错误。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.