title: Producer-Consumer with Futures in Scala
body: <p>Suppose I have a "producer-consumer" problem: the producer sends messages to the consumer and the consumer processes them asynchronously using Scala <code>Futures</code>: for instance <code>future { /* do the processing */ }</code>.</p>
  
  <p>Suppose now that the producer produces 100 messages per sec. but the consumer processes only 10 messages per sec. What will happen ? I guess there will be a memory leak. There will be a lot of <code>Future</code> objects and the internal message queue of the thread pool will grow as well. Does it make sense ?</p>
  
  <p>What is the best way to handle it ?</p>