我正在调试我的代码,我看到我的线程在以下log4j TextEncoderHelper中被阻止。我正在使用log4j 2.8.2
我的所有线程都无法运行,它基本上阻止了整个应用程序。
有谁知道下面做了什么?如果我有两个线程记录,它是否意味着它的死锁?
(我正在运行参数
-DLog4jContextSelector = org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -DAsyncLogger.RingBufferSize = 32768 * 32768 -DAsyncLogger.WaitStrategy = Sleep -Dlog4j2.AsyncQueueFullPolicy = Discard)
private static void copyDataToDestination(final ByteBuffer temp, final ByteBufferDestination destination) {
61 synchronized (destination) {
62 ByteBuffer destinationBuffer = destination.getByteBuffer();
63 if (destinationBuffer != temp) { // still need to write to the destination
64 temp.flip();
65 if (temp.remaining() > destinationBuffer.remaining()) {
66 destinationBuffer = destination.drain(destinationBuffer);
67 }
68 destinationBuffer.put(temp);
69 temp.clear();
70 }
71 }
72 }
如果调试器显示应用程序被阻止尝试写入底层appender,那么底层appender可能无法跟上工作负载。
问题没有提到正在使用什么appender所以我最初假设文件appender但是从评论中发现使用了JmsAppender
。 (请在未来的问题中提到这样的细节:如果没有这些信息,我的想法是错误的。)
JMS本身就是一个很大的主题,但通常并不知道它是高性能的。可实现的实际吞吐量取决于实现产品及其配置。
我建议启用JMS调试选项以确认JMS队列确实是瓶颈。