You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by "jamesweb3@yahoo.com.tw" <ja...@yahoo.com.tw> on 2014/06/27 12:16:27 UTC
回覆: How do you measure TPS of topology?
Because use basic storm instead of trident.Is there a good way to measure TPS in basic storm?
----- Reply message -----
寄件者: "Romain Leroux" <le...@gmail.com>
收件者: <us...@storm.incubator.apache.org>, "이승진" <sw...@navercorp.com>
主旨: How do you measure TPS of topology?
日期: 週五, 6月 27 日, 2014 年 3:54 下午
Probably not a good practice but at least gives you an idea :
public class LogThroughput extends BaseFunction{
private static final Logger LOG = LoggerFactory.getLogger(LogThroughput.class);
private AtomicInteger tuplesCounter;
private Thread tWatcher;
private String message;
private class WatcherThread implements Runnable {
@Override
public void run() {
while(!Thread.interrupted()) {
try {
Thread.sleep(1000);
LOG.info("<"+message+"> Throughput: "+tuplesCounter.getAndSet(0)+" tuples/sec at "+new Date().toString());
} catch (InterruptedException e) {
}
}
}
}
public LogThroughput(String message){
this.message = message;
}
public LogThroughput(){
this.message = "";
}
@Override
public void prepare(Map conf, TridentOperationContext context) {
tuplesCounter = new AtomicInteger(0);
tWatcher = new Thread(new WatcherThread(), "watcher1337");
tWatcher.start();
}
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
tuplesCounter.incrementAndGet();
collector.emit(tuple);
}
}
2014-06-25 17:10 GMT+09:00 이승진 <sw...@navercorp.com>:
Dear all,
Is there a good practice of measuring TPS of topology?
I have no idea where to start from since there's only latency information in storm UI
would be great if you can share your experience
Sincerly,