Which Java blocking queue is best for multiple producer and single or multiple consumers scenarios?
I am testing with LinkedBlockingQueue but I am getting OutOfMemoryError exception.
I am trying to achieve following things.
- producer creates a object & put in a queue.
- consumer grabs the data from queue & insert into database. There would be 400 producers and I can adjust consumers as I wish.
Let me know any idea.
Update
Producer : It should listen to Server Socket. It reads the data from socket & construct the object (Domain objects) and put in a queue.
Consumer : Take the object from queue & insert into DB (Hiberante & connection pooling supported)
This my real environment. Process should be able to process at least 200 records/sec.I am testing the scalability of process and how to improve that. I hope this will give better idea.
Helpful links :