From the last few days, I have been writing about Apache Hama on my blog. Check them out.

Today, I am going to show you a small example for generating random number using Apache Hama. This example will help you in understanding how to use Sync and how to write a Hama job. Here is the scenario

  • The Master task will set a CONVERGENCE_VALUE
  • Master will send the current max random number ( between 0 and CONVERGENCE_VALUE) to all the slaves
  • All slave tasks will try to generate a random number between the value received and CONVERGENCE_VALUE and send the value back to Master.
  • This process will continue unless we reach CONVERGENCE_VALUE.

To run the above example, just download Apache Hama and setup Hama in Eclipse.  The above code should work without any problems. You can also find more examples on Hama here.