The command queue is used as a central message bus to orchestrate the single components.

Structure of a message

The structure of the message is described in the following table.

start byte length meaning
0 4 session id length as 32 bit integer (s)
4 s session id
s + 4 1 Command id as byte
s + 5   data (optional)

It can be seen that the first part of a message contains the session id of the benchmark to which the message belongs to (preceded by the session id length). After that, the id of the “command” follows as single byte. Some messages might have additional data that is simply added at the end of the message behind the command id.

API

The command queue uses a RabbitMQ Exchange. Connecting a component to this exchange can be done as described in the RabbitMQ Publish/Subscribe tutorial. The exchange itself has to be setup with:

  • name="hobbit.command"
  • type="fanout"
  • durable=false
  • autoDelete=true
  • and no additional arguments.

The queue that is bound to the exchange can have an autogenerated name. The queue can be used to send messages to the exchange. Additionally, a consumer should be bound to the queue to be able to receive messages from the exchange.

Predefined command ids

The platform uses already predefined command ids. They can be reused by benchmark and system implementations if they are interacting with the platform. The predefined commands can be found in https://github.com/hobbit-project/core/blob/master/src/main/java/org/hobbit/core/Commands.java

constant name id description
SYSTEM_READY_SIGNAL 1 The signal sent by the benchmarked system to indicate that the system is ready.
BENCHMARK_READY_SIGNAL 2 The signal sent by the benchmark controller to indicate that the benchmark is ready.
DATA_GENERATOR_READY_SIGNAL 3 The signal sent by the data generator to indicate that it is ready.
TASK_GENERATOR_READY_SIGNAL 4 The signal sent by the task generator to indicate that it is ready.
EVAL_STORAGE_READY_SIGNAL 5 The signal sent by the evaluation storage to indicate that it is ready.
EVAL_MODULE_READY_SIGNAL 6 The signal sent by the evaluation module to indicate that it is ready.
DATA_GENERATOR_START_SIGNAL 7  
TASK_GENERATOR_START_SIGNAL 8  
EVAL_MODULE_FINISHED_SIGNAL 9  
EVAL_STORAGE_TERMINATE 10  
BENCHMARK_FINISHED_SIGNAL 11  
DOCKER_CONTAINER_START 12 Command used to ask a docker managing component to start a certain container. The command is followed by a String containing the following JSON data: {<br>"image": "image-to-run",<br> "type": "system|benchmark",<br> "parent":"parent-container-id"<br>}
DOCKER_CONTAINER_STOP 13 Command used to ask a docker managing component to stop a certain container. The command is followed by a String containing the following JSON data: {<br>"containerId": "container-to-stop"<br>}
DATA_GENERATION_FINISHED 14  
TASK_GENERATION_FINISHED 15  
DOCKER_CONTAINER_TERMINATED 16  
START_BENCHMARK_SIGNAL 17  
REQUEST_SYSTEM_RESOURCES_USAGE 18  

For implementing components, it is possible to use other than the predefined command ids. In this case it should be made sure that the used command ids do not overlap with the predefined ids. In general, it is recommended to use one an id of a free range listed in the following table.

id range status
0 - 100 reserved for predefined commands
101 - 122 free
123 reserved for future extensions
124 - 255 free