Perf4J

AsyncCoalescingStatisticsAppender can cause application to slow down if queue cannot be drained fast enough.

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.9.7
  • Fix Version/s: 0.9.8
  • Labels:
    None
  • Environment:
    log4j
  • Number of attachments :
    0

Description

The AsyncCoalescingStatisticsAppender used a PipedWriter/PipedReader combo to send log messages from the logging thread to the asynchronous draining thread. However, PipedReader uses a bounded queue, and if this queue fills up (which happens when the Dispatcher thread doesn't get enough processing time to drain the queue), then calls to log can slow down as they wait for the queue to drain.

We should replace the PipedWriter/Reader queue with an ArrayBlockingQueue that simply discards messages if the queue becomes full.

Activity

Hide
Alex Devine added a comment -

Now using an ArrayBlockingQueue - thanks to Nicholas Whitehead for the suggested fix. The queue size can be set as an appender option, and discarded messages are counted and can be accessed using the getNumDiscardedMessages() method on the appender.

Show
Alex Devine added a comment - Now using an ArrayBlockingQueue - thanks to Nicholas Whitehead for the suggested fix. The queue size can be set as an appender option, and discarded messages are counted and can be accessed using the getNumDiscardedMessages() method on the appender.

People

Vote (0)
Watch (0)

Dates

  • Due:
    Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
3h
Original Estimate - 3 hours Original Estimate - 3 hours
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
6h
Time Spent - 6 hours