in holo-e2e-performance-tool/src/main/java/com/alibaba/hologres/performace/client/PutTest.java [39:115]
public void run(String confName) throws Exception {
LOG.info("confName:{}", confName);
this.confName = confName;
ConfLoader.load(confName, "put.", conf);
HoloConfig config = new HoloConfig();
ConfLoader.load(confName, "holoClient.", config);
Properties props = new Properties();
PGProperty.USER.set(props, config.getUsername());
PGProperty.PASSWORD.set(props, config.getPassword());
PGProperty.APPLICATION_NAME.set(props, config.getAppName());
LOG.info("props : {}", props);
String jdbcUrl = config.getJdbcUrl();
this.init();
Reporter reporter = new Reporter(confName);
try (Connection conn = DriverManager.getConnection(jdbcUrl, props)) {
if (conf.createTableBeforeRun) {
SqlUtil.createTable(conn, conf.partition, conf.tableName, conf.columnCount,
conf.shardCount,
conf.orientation, conf.enableBinlog, conf.binlogTTL, conf.enableBitmap, conf.additionTsColumn,
conf.hasPk, conf.prefixPk, conf.dataColumnType);
}
if (conf.enableBinlogConsumption) {
SqlUtil.createBinLogExtension(conn);
if (conf.recreatePublicationAndSlot) {
SqlUtil.dropPublication(conn, conf.publicationName);
try {
SqlUtil.deleteReplicationProgress(conn, conf.slotName);
} catch (SQLException e) {
e.printStackTrace();
}
try {
SqlUtil.dropSlot(conn, conf.slotName);
} catch (SQLException e) {
e.printStackTrace();
}
SqlUtil.createPublication(conn, conf.publicationName, conf.tableName);
SqlUtil.createSlot(conn, conf.publicationName, conf.slotName);
}
}
if (conf.vacuumTableBeforeRun) {
SqlUtil.vaccumTable(conn, conf.tableName);
}
version = ConnectionUtil.getHoloVersion(conn);
reporter.start(version);
}
barrier = new CyclicBarrier(conf.threadSize, ()->{
memoryUsage = Util.getMemoryStat();
Util.dumpHeap(confName);
});
targetTime = System.currentTimeMillis() + conf.testTime;
Thread[] threads = new Thread[conf.threadSize];
Metrics.startSlf4jReporter(60L, TimeUnit.SECONDS);
for (int i = 0; i < threads.length; ++i) {
threads[i] = new Thread(buildJob(i));
threads[i].start();
}
for (int i = 0; i < threads.length; ++i) {
threads[i].join();
}
LOG.info("finished, {} rows has written", totalCount.get());
Metrics.reporter().report();
{
Meter meter = Metrics.registry().meter(Metrics.METRICS_WRITE_RPS);
Histogram hist = Metrics.registry().histogram(Metrics.METRICS_WRITE_LATENCY);
reporter.report(meter.getCount(), meter.getOneMinuteRate(), meter.getFiveMinuteRate(),
meter.getFifteenMinuteRate(), hist.getSnapshot().getMean(),
hist.getSnapshot().get99thPercentile(), hist.getSnapshot().get999thPercentile(), memoryUsage);
}
if (conf.deleteTableAfterDone) {
SqlUtil.dropTableByHoloClient(config, conf.tableName);
}
}