title: Timeout for Futures in Akka
body: <p>We have a server that processes portfolio and securities (inside it) in different actors. For portfolio with smaller number of securities (&lt;20) this works fine. When i increase the number of security count to 1000, encountered following issues:</p>
  
  <p>akka.dispatch.FutureTimeoutException: Futures timed out after [5000] milliseconds</p>
  
  <p>I could bypass this error by increasing timeout inside akka config, is that the right thing to do? In akka versions earlier than 1.2 i could set self.timeout inside the actor but that is deprecated.</p>
  
  <p>The other issue I faced (intermittently) is that the entire server hangs while joining in futures.map code inside my portfolio actor:</p>
  
  <pre><code>    //fork out for each security
      val listOfFutures = new ListBuffer[Future[Security]]()
      for (security &lt;- portfolio.getSecurities.toList) {
        val securityProcessor = actorOf[SecurityProcessor].start()
        listOfFutures += (securityProcessor ? security) map {
          _.asInstanceOf[Security]
        }
      }
      EventHandler.info(this,"joining results from security processors")
      //join for each security
      val futures = Future.sequence(listOfFutures.toList)
      futures.map {
        listOfSecurities =&gt;
          portfolioResponse = MergeHelper.merge(portfolio, listOfSecurities)
      }.get
  </code></pre>