Producer Consumer – the saviour!


I had a task of populating some collections several times,  before uploading them to DB. What happened was, memory had grown rapidly, and atlast the application died with OutOfMemoryError 😦

That time my lead was suggesting to go to this pattern, Producer-Consumer!  Like, one guy will be populating the collection, In parallel another guy will be reading from the collection and update the db! Wonderful man, this design is highly scalable, if you implement correctly! For more info, see the simple example here,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s