Skip to content

How to add a new benchmark

QianHao Dong edited this page Sep 1, 2014 · 10 revisions

We assume that the user knows how to run the benchmark with tachyon-perf.

To add a new benchmark, the basic requisite is to extend tachyon.perf.basic.PerfTask and tachyon.perf.basic.TaskContext, then modify the configuration files. Optionally, you can implement tachyon.perf.basic.Supervisible or extend tachyon.perf.basic.PerfTotalReport to make more tools supported.

We recommend that all your own classes in a new package tachyon.perf.benchmark.<YourTaskType>.

Necessary steps

Extend PerfTask

Create a new class extends tachyon.perf.basic.PerfTask, e.g. tachyon.perf.benchmark.foo.FooTask, which contains the executing logic of your benchmark.

There are three abstract methods you should override, setupTask(TaskContext), runTask(TaskContext) and cleanupTask(TaskContext), in which the parameter is the TaskContext you should implement in the next step.

In setupTask(TaskContext), you need to do the initialization and some preparations for your benchmark. Note that you should not add the constructor of this class but initialize all the properties you need in this setupTask(TaskContext). However, you are able to get all the configurations of your benchmark by mTaskConf, which contains the properties in your benchmark's xml file.

In runTask(TaskContext), you need to add the executing logic to run your benchmark and record the statistics into the context when needed.

In cleanupTask(TaskContext), you can do some following work, e.g. cleaning the workspace, or set some ending statistics to the context.

Extend TaskContext

Create a new class extends tachyon.perf.basic.TaskContext, e.g. tachyon.perf.benchmark.foo.FooTaskContext, which contains the statistics of your benchmark.

The only abstract method you need to override is writeToFile(String fileName), which is used to output the context to a local file.

This class will be the parameter when setup, run and cleanup the task. And similar to FooTask, you should do the initialization when setup the task but not add a constructor.

Add configurations

Optional steps

Implement Supervisible

Extend PerfTotalReport

Clone this wiki locally