Journey into concurrent programming in Scala

Click for: original source

Justin LeFebvre interesting article about building a number of highly available Scala web services and making the most impact by modifying code to maximize CPU utilization on a per service basis. Enter the “scala.concurrent.Future ” type!

A Future is an object representing a value which may not have been computed yet but will be “soon”. An incredibly useful abstraction for dealing with concurrent computation.

What is interesting about Future:

  • Initial calling thread frees up that thread to be available to service subsequent requests
  • Useful when working with web servers
  • Almost always initialize a limited size thread pool
  • A callback to execute when the Future completes
  • Can be composed with other futures via any number of transformations

You can read more in the article together with example code. More advanced example project is also available. Nice!

[Read More]

Tags programming scala functional-programming