7. Esper
• ESP/CEP with expressive Event
Processing Language: continuous queries,
aggregation, joins, causality and missing
events, joins to historical data, output flow
control...
• High throughput, low latency
• Standalone or embedded, open API
• Multi platform support
8. Computing Rates Per Feed
insert into TicksPerSecond
select feed, rate(10) as cnt
from MarketDataEvent
group by feed
9. Detecting a Fall-off
select feed, avg(cnt) as avgCnt, cnt as
feedCnt
from TicksPerSecond.win:time(10 seconds)
group by feed
having cnt < avg(cnt) * 0.75
11. Storm do
• Guaranteed message processing
• Robust process management
• Fault detection and automatic
reassignment
• Efficient message passing
• Local mode and distributed mode
12.
13.
14.
15. TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(1, new KestrelSpout("kestrel.backtype.com",
22133,
"sentence_queue",
new StringScheme()));
builder.setBolt(2, new SplitSentence(), 10)
.shuffleGrouping(1);
builder.setBolt(3, new WordCount(), 20)
.fieldsGrouping(2, new Fields("word"));
16. public class SplitSentence implements IBasicBolt {
public void execute(Tuple tuple, BasicOutputCollector collector) {
String sentence = tuple.getString(0);
for(String word: sentence.split(" ")) {
collector.emit(new Values(word));
}
}
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
}
}
17. public class WordCount implements IBasicBolt {
private Map<String, Integer> _counts = new HashMap<String,
Integer>();
public void execute(Tuple tuple, BasicOutputCollector collector) {
String word = tuple.getString(0);
int count;
if(_counts.containsKey(word)) {
count = _counts.get(word);
} else {
count = 0;
}
count++;
_counts.put(word, count);
collector.emit(new Values(word, count));
}
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word", "count"));
}
}