SPBench Benchmarks¶
Single source benchmarks¶
These are the commom benchmarks. They read data from a single input and generate a single stream of input and output data. The source operator runs inside the stream region, as shown in the example bellow.
int main (int argc, char* argv[]){
/* Init of stream region */
while(1){
spb::Item item;
if(!spb::Source::op(item)) break;
spb::First::op(item);
spb::Second::op(item);
spb::Nth::op(item);
spb::Sink::op(item);
} // End of stream region
return 0;
}
Real time stream configuration¶
The behavior of the itens and input stream can be tunned through some global methods.
spb::setBatchSize()
This method can be used to change the batch size of the items on the stream.
spb::setFrequency()
If the in-memory option was not enable in the execution command, the minumim frequency will be limited by the speed of the disk. Ideally, this option may be used in an in-memory execution to achieve high speed data.
Multiple source benchmarks¶
These are benchmarks that can read data from different inputs and generate multiple input/output streams. Here, the n source operators are run each by a exclusive thread outside the stream region. Each source has its own queue with items that can be accessed by a getItem() method inside the stream region, as shown in the example bellow.
int main (int argc, char* argv[]){
spb::Source source1;
spb::Source source2;
source1.init();
source2.init();
/* Stream region */
while(!(source1.depleted() && source2.depleted())){
spb::Item item1 = source1.getItem();
spb::Item item2 = source2.getItem();
spb::First::op(item1);
spb::First::op(item2);
spb::Nth::op(item1);
spb::Nth::op(item2);
spb::Sink::op(item1);
spb::Sink::op(item2);
}
return 0;
}
Real time stream configuration¶
source.setBatchSize(unsigned int)
This method can be used to change the batch size of the items on the stream.
source.setFrequency(unsigned int)
If the in-memory option was not enable in the execution command, the minumim frequency will be limited by the speed of the disk. Ideally, this option may be used in an in-memory execution to achieve high speed data.
source.setQueueMaxSize(unsigned int);
This option changes the queue size for te respective source. It has no impact on the inter-stage queues of the parallel implementations.
source.init()
here it is necessary to run this method to start the source execution
Alternativelly, these attributes can be specified through the constructor of the source object:
spb::Source source(<batch_size>, <queue_size>, <reading_frequency>);