You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 1660 Next »

Introduction

HAMA is a distributed computing framework based on BSP computing techniques for massive scientific computations (e.g., matrix, graph, network, ..., etc), Currently being incubated as one of the incubator project by the Apache Software Foundation.

The overall architecture of HAMA

Hama is consists of three major components: BSPMaster, GroomServers and Zookeeper. The below diagram displays a overview of the overall architecture and shows which components communicate with each other. The components will be explained in detail in the course of this document.

BSPMaster

BSPMaster is responsible to do the following:

  • Maintaining groom server status.
  • Controlling super steps in a cluster.
  • Maintaining job progress information.
  • Scheduling Jobs and Assigning tasks to groom servers
  • Disseminating execution class across groom servers.
  • Controlling fault.
  • Providing users with the cluster control interface.

A BSP Master and multiple grooms are started by the script. Then, the bsp master starts up with a RPC server for groom servers. Groom servers starts up with a BSPPeer instance - later, BSPPeer needs to be integrated with GroomServer - and a RPC proxy to contact the bsp master. After started, each groom periodically sends a heartbeat message that encloses its groom server status, including maximum task capacity, unused memory, and so on.

Each time the bsp master receives a heartbeat message, it brings up-to-date groom server status - the bsp master makes use of groom servers' status in order to effectively assign tasks to idle groom servers - and returns a heartbeat response that contains assigned tasks and others actions that a groom server has to do. For now, we have a FIFO job scheduler and very simple task assignment algorithms.

GroomServer

A Groom Server (shortly referred to as groom) is a process that performs bsp tasks assigned by BSPMaster. Each groom contacts the BSPMaster, and it takes assigned tasks and reports its status by means of periodical piggybacks with BSPMaster. Each groom is designed to run with HDFS or other distributed storages. Basically, a groom server and a data node should be run on one physical node.

Zookeeper

A Zookeeper is used to manage the efficient barrier synchronisation of the BSPPeers. Later, it will also be used for the area of a fault tolerance system.

BSP Programming Model

A BSP program consists of a sequence of supersteps. Each superstep consists of the three phases below:

  • Local computation
  • Process communication
  • Barrier synchronization

These phases will be defined by user in a bsp() method. Let's see the below example code:

public class BSPEaxmple {

  public static class MyBSP extends BSP {

    @Override
    public void bsp(BSPPeer bspPeer) throws IOException, KeeperException,
        InterruptedException {
      // 1. Do something locally
      
      // 2. Sends/receives data to/from neighbor nodes
      bspPeer.send(hostname, msg);

      while ((message = bspPeer.getCurrentMessage()) != null) {
         byte[] data = message.getData();
      }

      // 3. Barrier synchronization
      bspPeer.sync();
    }

    @Override
    public Configuration getConf() {
      return conf;
    }

    @Override
    public void setConf(Configuration conf) {
      this.conf = conf;
    }    

  }
  
  // BSP job configuration 
  public void main(String[] args) throws Exception {
    BSPJob bsp = new BSPJob(new HamaConfiguration(), BSPEaxmple.class);
    // Set the job name
    bsp.setJobName("My BSP Job");
    bsp.setBspClass(MyBSP.class);

    // Submit job
    BSPJobClient.runJob(bsp);
  }
}  

An BSP examples

  • No labels