Skip to content

Commit

Permalink
YCSB runner script
Browse files Browse the repository at this point in the history
  • Loading branch information
eolivelli committed Feb 14, 2017
1 parent c84a870 commit 0bec570
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 16 deletions.
27 changes: 17 additions & 10 deletions herddb-core/src/main/java/herddb/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,11 @@ public Server(ServerConfiguration configuration) {
int port = configuration.getInt(ServerConfiguration.PROPERTY_PORT, ServerConfiguration.PROPERTY_PORT_DEFAULT);
LOGGER.severe("Configured network parameters: " + ServerConfiguration.PROPERTY_HOST + "=" + host + ", " + ServerConfiguration.PROPERTY_PORT + "=" + port);
if (host.trim().isEmpty()) {
try {
String _host = NetworkUtils.getLocalNetworkAddress();
LOGGER.log(Level.SEVERE, "As configuration parameter "
+ ServerConfiguration.PROPERTY_HOST + " is {0}, I have choosen to use {1}."
+ " Set to a non-empty value in order to use a fixed hostname", new Object[]{host, _host});
host = _host;
} catch (IOException err) {
LOGGER.log(Level.SEVERE, "Cannot get local host name", err);
throw new RuntimeException(err);
}
String _host = "0.0.0.0";
LOGGER.log(Level.SEVERE, "As configuration parameter "
+ ServerConfiguration.PROPERTY_HOST + " is {0}, I have choosen to use {1}."
+ " Set to a non-empty value in order to use a fixed hostname", new Object[]{host, _host});
host = _host;
}
if (port <= 0) {
try {
Expand All @@ -156,6 +151,18 @@ public Server(ServerConfiguration configuration) {
}
}
String advertised_host = configuration.getString(ServerConfiguration.PROPERTY_ADVERTISED_HOST, host);
if (advertised_host.trim().isEmpty() || advertised_host.equals("0.0.0.0")) {
try {
String _host = NetworkUtils.getLocalNetworkAddress();
LOGGER.log(Level.SEVERE, "As configuration parameter "
+ ServerConfiguration.PROPERTY_ADVERTISED_HOST + " is {0}, I have choosen to use {1}."
+ " Set to a non-empty value in order to use a fixed hostname", new Object[]{advertised_host, _host});
advertised_host = _host;
} catch (IOException err) {
LOGGER.log(Level.SEVERE, "Cannot get local host name", err);
throw new RuntimeException(err);
}
}
int advertised_port = configuration.getInt(ServerConfiguration.PROPERTY_ADVERTISED_PORT, port);

HashMap<String, String> realData = new HashMap<>();
Expand Down
7 changes: 7 additions & 0 deletions herddb-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>herddb-jdbc</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
<classifier>uber</classifier>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
20 changes: 14 additions & 6 deletions herddb-services/src/main/assemble/zip-assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>release</id>
<formats>
<format>zip</format>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
Expand All @@ -30,12 +30,10 @@
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<unpack>false</unpack>
<includes>
<include>*:jar</include>
</includes>
<unpack>false</unpack>
<excludes>
<exclude>org.herddb:herddb-cli:*</exclude>
<exclude>org.herddb:herddb-cli:*</exclude>
<exclude>org.herddb:herddb-jdbc:*</exclude>
</excludes>
<outputDirectory>lib</outputDirectory>
</dependencySet>
Expand All @@ -48,6 +46,16 @@
</includes>
<outputDirectory>.</outputDirectory>
<outputFileNameMapping>herddb-cli.jar</outputFileNameMapping>
</dependencySet>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<useStrictFiltering>true</useStrictFiltering>
<unpack>false</unpack>
<includes>
<include>org.herddb:herddb-jdbc:*</include>
</includes>
<outputDirectory>.</outputDirectory>
<outputFileNameMapping>herddb-jdbc-${project.version}.jar</outputFileNameMapping>
</dependencySet>
</dependencySets>

Expand Down
4 changes: 4 additions & 0 deletions ycsb-runner/herd.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
db.driver=herddb.jdbc.Driver
db.url=jdbc:herddb:server:127.0.0.1:7000
db.user=sa
db.passwd=hdb
26 changes: 26 additions & 0 deletions ycsb-runner/run-ycsb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#/bin/bash

HERE=$(dirname $0)
HERE=$(realpath $HERE)
YCSB_PATH=$1
HERDDB_PATH=$(realpath $2)
WORKLOAD=$3
JDBC_DRIVER=$(ls $HERDDB_PATH/*jdbc*.jar)

echo "Running YCSB workload $WORKLOAD from $YCSB_PATH"
echo "Using HerdDB instance at $HERDDB_PATH"
echo "Using JDBC Driver $JDBC_DRIVER"

$HERDDB_PATH/bin/service server kill

rm -Rf $HERDDB_PATH/dbdata

$HERDDB_PATH/bin/service server start

sleep 1

$HERDDB_PATH/bin/herddb-cli.sh -q "DROP TABLE usertable"
$HERDDB_PATH/bin/herddb-cli.sh -q "CREATE TABLE usertable ( YCSB_KEY VARCHAR(191) NOT NULL, FIELD0 STRING, FIELD1 STRING, FIELD2 STRING, FIELD3 STRING, FIELD4 STRING, FIELD5 STRING, FIELD6 STRING, FIELD7 STRING, FIELD8 STRING, FIELD9 STRING, PRIMARY KEY (YCSB_KEY));"

$YCSB_PATH/bin/ycsb load jdbc -P $YCSB_PATH/workloads/$WORKLOAD -P $HERE/herd.properties -cp $HERDDB_PATH/herddb-jdbc* -threads 200 -s

0 comments on commit 0bec570

Please sign in to comment.