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 DB. There would be 400 producers and i can adjust consumers as i wish.
let me know any idea. Thanks,
Update 10/07,
Thanks for your input gents,
Producer : It should listen to Server Socket. It reads the data from socket & construct the object (Domain objects) & 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 : link vmoptions link Monitoring and Managing Java SE 6 Platform Applications link BlockingQueue
Thanks.