JDBC-Performance-Logger icon indicating copy to clipboard operation
JDBC-Performance-Logger copied to clipboard

fixing the "queue full" issue

Open eostermueller opened this issue 8 years ago • 2 comments

When testing with 100's of SQL per second (and more), I get this message, repeatedly, in the stdout of my spring boot stdout:

2017-10-03 07:19:02.147 WARN 9934 --- [tp1768882706-66] c.s.j.logger.SocketLogSender : queue full, dropping remote log of statement

Cranking up the size of LinkedBlockingQueueo fixes this. I've got a local copy of this fix, this issue is my "todo" reminder to submit the pr. I think moving from the 10000 below to 100000 (adding a zero) did the trick.

public class SocketLogSender implements Runnable, LogSender {
    private final static Logger LOGGER2 = Logger.getLogger(SocketLogSender.class);

    private final BlockingQueue<LogMessage> logsToSend = new LinkedBlockingQueue<LogMessage>(10000);

eostermueller avatar Oct 03 '17 17:10 eostermueller

one low-tech fix is to add a parameter for this size. People who get the "queue full" message can use the parameter to bump up the size.

This suggests that changing the size on the fly isn't really an option:

https://stackoverflow.com/questions/6600023/re-sizeable-java-blockingqueue

eostermueller avatar Oct 03 '17 17:10 eostermueller

  1. +1 to make the queue size configurable (at least statically)
  2. I wonder if in your use case we should not slow down the producer threads by using queue.put(..) instead of queue.offer(..). This could also be configurable.

Feel free to propose a PR...

sylvainlaurent avatar Oct 09 '17 20:10 sylvainlaurent