Skip to content

Commit

Permalink
Optimize the definition of function
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriCoder committed Jan 3, 2024
1 parent 2e352aa commit 4c480af
Show file tree
Hide file tree
Showing 26 changed files with 15 additions and 97 deletions.
2 changes: 1 addition & 1 deletion configuration/benchmark.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ goto :eof

rem echo CLASSPATH: %CLASSPATH%

"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp .;./lib/* %MAIN_CLASS% -cf %BENCHMARK_HOME%/conf/config.properties
"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp .;./lib/* %MAIN_CLASS% -cf %BENCHMARK_HOME%/conf
goto finally

:err
Expand Down
5 changes: 2 additions & 3 deletions configuration/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ show_help() {
echo " -cf Specify configuration file."
echo " -heapsize Specify HEAP_SIZE."
echo " -maxheapsize Specify MAX_HEAP_SIZE."
echo "example: ./benchmark.sh -cf conf/config.properties -heapsize 1G -maxheapsize 2G"
echo "example: ./benchmark.sh -cf conf -heapsize 1G -maxheapsize 2G"
}

while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -85,7 +85,7 @@ fi

# check $benchmark_conf
if [ -z "${benchmark_conf}" ] ; then
benchmark_conf=${BENCHMARK_HOME}/conf/config.properties
benchmark_conf=${BENCHMARK_HOME}/conf
else
benchmark_conf="$(cd "$(dirname "$benchmark_conf")" && pwd)/$(basename "$benchmark_conf")"
if [ ! -e "$benchmark_conf" ]; then
Expand All @@ -106,7 +106,6 @@ done
# set benchmark_parms
benchmark_parms="$benchmark_parms -Duser.timezone=GMT+8"
benchmark_parms="$benchmark_parms -Dlogback.configurationFile=${BENCHMARK_HOME}/conf/logback.xml"
benchmark_parms="$benchmark_parms -DBENCHMARK_HOME=${BENCHMARK_HOME}"
if [ -n "$MAX_HEAP_SIZE" ]; then
echo Set MAX_HEAP_SIZE=$MAX_HEAP_SIZE
benchmark_parms="$benchmark_parms -Xmx${MAX_HEAP_SIZE}"
Expand Down
6 changes: 3 additions & 3 deletions configuration/conf/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# generateDataMode 生成数据模式,生成Benchmark本身识别的数据
# verificationWriteMode 单数据库正确性写入模式,需要配置 FILE_PATH 以及 DATA_SET
# verificationQueryMode 单数据库正确性查询模式,需要配置 FILE_PATH 以及 DATA_SET
# BENCHMARK_WORK_MODE=testWithDefaultPath
BENCHMARK_WORK_MODE=generateDataMode

# 对于数据写入或查询,限制最长耗时,设置为0表示无限制,单位为ms
# 对数据写入,最大误差约为WRITE_OPERATION_TIMEOUT_MS
Expand Down Expand Up @@ -111,13 +111,13 @@

############## 数据:设备、传感器、客户端 ##################
# 设备总数
# DEVICE_NUMBER=6000
DEVICE_NUMBER=10

# 实际写入设备比例,(0, 1]
# REAL_INSERT_RATE=1.0

# 每个设备的传感器总数
# SENSOR_NUMBER=200
SENSOR_NUMBER=6

# 各个传感器时间戳是否对齐
# IS_SENSOR_TS_ALIGNMENT=true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion core/src/main/java/cn/edu/tsinghua/iot/benchmark/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static void main(String[] args) throws SQLException {
+ "bytes.");

if (args == null || args.length == 0) {
args = new String[] {"-cf", "configuration/conf/config.properties"};
args = new String[] {"-cf", "configuration/conf"};
}
CommandCli cli = new CommandCli();
if (!cli.init(args)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import cn.edu.tsinghua.iot.benchmark.entity.Sensor;
import cn.edu.tsinghua.iot.benchmark.entity.enums.SensorType;
import cn.edu.tsinghua.iot.benchmark.function.Function;
import cn.edu.tsinghua.iot.benchmark.function.FunctionParam;
import cn.edu.tsinghua.iot.benchmark.function.FunctionXml;
import cn.edu.tsinghua.iot.benchmark.mode.enums.BenchmarkMode;
Expand All @@ -41,7 +40,7 @@
import java.util.concurrent.atomic.AtomicLong;

public class Config {
private static Logger LOGGER = LoggerFactory.getLogger(Config.class);
private static final Logger LOGGER = LoggerFactory.getLogger(Config.class);

// 初始化
// 初始化:清理数据
Expand Down Expand Up @@ -413,13 +412,9 @@ public String getHomeDir() {
/** init inner functions */
public void initInnerFunction() {
FunctionXml xml = null;
String configFolder = System.getProperty(Constants.BENCHMARK_CONF, "configuration/conf");
try {
InputStream input;
if (getHomeDir() == null) {
input = Function.class.getResourceAsStream("/function.xml");
} else {
input = Files.newInputStream(Paths.get(getHomeDir() + "/resources/function.xml"));
}
InputStream input = Files.newInputStream(Paths.get(configFolder + "/function.xml"));
JAXBContext context = JAXBContext.newInstance(FunctionXml.class, FunctionParam.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
xml = (FunctionXml) unmarshaller.unmarshal(input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ public Config getConfig() {

/** load properties from config.properties */
private void loadProps() {
String url =
System.getProperty(Constants.BENCHMARK_CONF, "configuration/conf/config.properties");
String url = System.getProperty(Constants.BENCHMARK_CONF, "configuration/conf");
if (url != null) {
url += "/config.properties";
InputStream inputStream;
try {
inputStream = new FileInputStream(new File(url));
inputStream = new FileInputStream(url);
} catch (FileNotFoundException e) {
LOGGER.warn("Fail to find config file {}", url);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Map;
Expand All @@ -51,7 +50,6 @@ public class CSVRecorder extends TestDataPersistence {
/** The count of write retry */
private static final int WRITE_RETRY_COUNT = 5;

private static final int MAX_COMPRESS_TIME = 10 * 60 * 1000;
/** reentrantLock used for writing result into file */
private static final ReentrantLock reentrantLock = new ReentrantLock(true);

Expand Down Expand Up @@ -101,10 +99,8 @@ public CSVRecorder() {
}
localName = localName.replace("-", "_");
localName = localName.replace(".", "_");
Date date = new Date(EXP_TIME);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd");
String day = dateFormat.format(date);
confDir = System.getProperty(Constants.BENCHMARK_CONF);

confDir = System.getProperty(Constants.BENCHMARK_CONF) + "/config.properties";
dataDir = confDir.substring(0, confDir.length() - 23) + "/data";
csvDir = dataDir + "/csv";
File dataFile = new File(dataDir);
Expand Down
4 changes: 0 additions & 4 deletions influxdb-2.0/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions influxdb/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions iotdb-0.12/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions iotdb-0.13/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions iotdb-1.0/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions iotdb-1.1/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions kairosdb/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions mssqlserver/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions opentsdb/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions pi/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions questdb/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions sqlite/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions tdengine-3.0/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions tdengine/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions timescaledb-cluster/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions timescaledb/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions verification/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down
4 changes: 0 additions & 4 deletions victoriametrics/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
<directory>${maven.multiModuleProjectDirectory}/configuration/conf/</directory>
<outputDirectory>conf</outputDirectory>
</fileSet>
<fileSet>
<directory>${maven.multiModuleProjectDirectory}/core/src/main/resources</directory>
<outputDirectory>resources</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
Expand Down

0 comments on commit 4c480af

Please sign in to comment.