Skip to content

Instantly share code, notes, and snippets.

@alanzhao
Created March 26, 2012 18:35
Show Gist options
  • Save alanzhao/2208558 to your computer and use it in GitHub Desktop.
Save alanzhao/2208558 to your computer and use it in GitHub Desktop.
Java Hector Performance Test
package com.onescreen.conduit.report.cassandra;
import static org.junit.Assert.*;
import org.junit.Test;
import com.onescreen.conduit.report.timer.Timer;
public class CassandraBenchmarkTest {
@Test
public void testSetKeyspaceDateStringLong() {
Timer t = new Timer();
t.start();
Cassandra c = new Cassandra("reports", "test");
for(long i=0; i<1000000; i++){
c.set(CConfig.CASSANDRA_KEYSPACE_REPORTS, i, i, "test");
c.get(CConfig.CASSANDRA_KEYSPACE_REPORTS, i, i, "");
c.delete(CConfig.CASSANDRA_KEYSPACE_REPORTS, i, i, "");
}
t.stop();
System.out.println(t.diff());
assertTrue(true);
}
}
//output
//
//Mar 26, 2012 11:24:09 AM me.prettyprint.cassandra.connection.CassandraHostRetryService <init>
//INFO: Downed Host Retry service started with queue size -1 and retry delay 10s
//Mar 26, 2012 11:24:10 AM me.prettyprint.cassandra.service.JmxMonitor registerMonitor
//INFO: Registering JMX me.prettyprint.cassandra.service_Reports:ServiceType=hector,MonitorType=hector
//551.854
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment