Hello,
this is my first post on stackoverflow... I hope someone can help me
I have a big performance regression with Java 6 LinkedBlockingQueue
.
In the first thread i generate some objects which i push in to the queue
In the second thread i pull these objects out. The performance regression occurs when the take()
method of the LinkedBlockingQueue
is called frequently.
I monitored the whole program and the take()
method claimed the most time overall.
And the throughput goes from ~58Mb/s to 0.9Mb/s...
the queue pop and take methods ar called with a static method from this class
public class C_myMessageQueue {
private static final LinkedBlockingQueue<C_myMessageObject> x_queue = new LinkedBlockingQueue<C_myMessageObject>( 50000 );
/**
* @param message
* @throws InterruptedException
* @throws NullPointerException
*/
public static void addMyMessage( C_myMessageObject message )
throws InterruptedException, NullPointerException {
x_queue.put( message );
}
/**
* @return Die erste message der MesseageQueue
* @throws InterruptedException
*/
public static C_myMessageObject getMyMessage() throws InterruptedException {
return x_queue.take();
}
}
how can I tune the take()
method to accomplish at least 25Mb/s, or is there a other class I can use which will block when the "queue" is full or empty.
kind regards
Bart
P.S.: sorry for my bad english, I'm from Germany ;)