-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[db voltdb] Add VoltDB client #1319
Merged
Merged
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
89e848f
[voltdb] Release Candidate
srmadscience 9200099
[voltdb] JavadocStyle: First sentence should end with a period.
srmadscience 0a534e8
[db voltdb] First pass at resolves issues raised around #1319
srmadscience 3b375e8
[db voltdb] Fix procedure class name issue
srmadscience 3eac920
[voltdb] Fixes for pull request #feedback
srmadscience 74f8bd2
[db voltdb] Fixes for pull request #1319 feedback
srmadscience cf9fe36
[voltdb] changed default value for threads in voltdb.properties to 1 …
srmadscience 363f724
[voltdb] fixed bin diretory SNAFU
srmadscience 1424ea4
[voltdb] fixed bindings
srmadscience da873b3
[voltdb] fixed jdbc README.md
srmadscience 0204c7c
Merge branch 'db_voltdb' of https://github.com/srmadscience/YCSB into…
srmadscience e8ddb53
[voltdb] fixed sortedvolttable package name
srmadscience 0ebc1ec
[voltdb] added SLF4J + Log4j 2
srmadscience 52fbced
[voltdb] Reverted cleint & server
srmadscience 05feedb
[voltdb] checkstyle violations
srmadscience 91e529a
[voltdb] checkstyle violations
srmadscience d120449
[voltdb] checkstyle violations
srmadscience 84e59b7
Fixed bin directory
srmadscience 209df09
[voltdb] Rewrote client handling, changed logic for creating DDL
srmadscience 870b322
[voltdb] checkstyle fixes
srmadscience f6eb76a
[voltdb] Moved to MIT compliant licences for VoltDB libs
srmadscience 7a5b2e6
[voltdb] Fixed %s formatting issue in log message
srmadscience 944ebca
[voltdb] Updated pom.xml to 9.1
srmadscience 69b199f
[voltdb] Various code changes
srmadscience 8c61359
[voltdb] switch to singleton holder idiom.
srmadscience b2b866f
[voltdb] change voltdb lib to runtime dependency
srmadscience f9e5b11
[voltdb] change voltdb lib to default compile dependency
srmadscience b84606d
[voltdb] change voltdb lib to provided dependency
srmadscience 4df5c83
[voltdb] now uses Assume.assumeTrue(haveDb)
srmadscience bbb968b
[voltdb] remove clientId
srmadscience 06a9656
[voltdb] Re-arranged calls to Assume.assumeTrue(haveDb);
srmadscience 4be8943
[voltdb] Addded call to Assume.assumeTrue(haveDb) to teardown
srmadscience a9a82b0
[voltdb] Put old Assume.assumeTrue(haveDb)'s back
srmadscience ff5ba0f
[voltdb] Remove Assume.assumeTrue from setup and teardown methods
srmadscience fffe7e7
[voltdb] Change all VoltDB versions to 9.1.1
srmadscience File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ output* | |
|
||
# ignore standard Mac OS X files/dirs | ||
.DS_Store | ||
/differentbin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<!-- | ||
Copyright (c) 2010 Yahoo! Inc., 2012 - 2019 YCSB contributors. | ||
All rights reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you | ||
may not use this file except in compliance with the License. You | ||
may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
implied. See the License for the specific language governing | ||
permissions and limitations under the License. See accompanying | ||
LICENSE file. | ||
--> | ||
# YCSB for VoltDB | ||
srmadscience marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
![VoltDB Logo](https://www.voltdb.com/wp-content/uploads/2016/10/VoltDB-logo-320x132.jpg?ycsb=true "VoltDB") | ||
|
||
## README | ||
|
||
This README describes how to run YCSB on VoltDB. | ||
|
||
Here at VoltDB we use 4 machines for testing - 1 client and a 3 node cluster. | ||
|
||
### 1. Install Java on all the machines involved. | ||
|
||
VoltDB uses Java. Either [Oracle Java](https://www.oracle.com/technetwork/java/javase/downloads/index.html) or [OpenJDK](https://openjdk.java.net/) will work. | ||
|
||
|
||
### 3. Install and configure VoltDB | ||
|
||
If you don't already have a copy of VoltDB you should [download](https://www.voltdb.com/try-voltdb/) and install it. | ||
Make sure you know the hostnames/ip addresses of all the nodes in the cluster and that [port 21212](https://docs.voltdb.com/AdminGuide/HostConfigPortOpts.php) is open for your client. | ||
|
||
A representative VoltDB cluster would have 3 nodes and a '[K factor](https://docs.voltdb.com/UsingVoltDB/KSafeEnable.php)' of 1. This configuration allows work to continue if a server dies. | ||
|
||
Note: If you contact us we can give you access to AWS Cloudformation scripts and a matching AMI to create a cluster for you. | ||
|
||
### 4. Install YCSB | ||
|
||
Download the [latest YCSB](https://github.com/brianfrankcooper/YCSB/releases/latest) file. Follow the instructions. | ||
|
||
### 5. Configure VoltDB parameters | ||
|
||
Create a file called (for example) voltdb.properties: | ||
|
||
recordcount=10000000 | ||
operationcount=10000000 | ||
voltdb.servers=localhost | ||
threadcount=1 | ||
maxexecutiontime=300 | ||
|
||
Other possible entries would be: | ||
|
||
- `voltdb.user` | ||
- Username. Only needed if username/passwords enabled. | ||
- `voltdb.password` | ||
- Password. Only needed if username/passwords enabled. | ||
- `voltdb.ratelimit` | ||
- Maximum number of transactions allowed per second per 50 threads - e.g. 'voltdb.ratelimit=70000'. Note that as you increase the workload you eventually get to a point where throwing more and more transactions at a given configuration is counterproductive. For the three node configuration we mentioned above 70000 would be a good starting point for this value. | ||
- `voltdb.scanall` | ||
- When set to 'yes' uses a single query to return data for 'Scan' operations ('workload e') instead of a separate query per partition. The later is much more scalable but generates more network traffic. | ||
|
||
### 6. Run YCSB | ||
|
||
See: [Running a Workload](https://github.com/brianfrankcooper/YCSB/wiki/Running-a-Workload) | ||
|
||
Make sure you keep an eye on the voltdb GUI. If you installed VoltDB on the same computer you are running YCSB on it will be at: | ||
|
||
http://localhost:8080/ | ||
|
||
First load the data: | ||
|
||
bin/ycsb.sh load voltdb -P workloads/workloada -P voltdb.properties | ||
|
||
Then run the different workloads - 'a' through 'e': | ||
|
||
bin/ycsb.sh run voltdb -P workloads/workloada -P voltdb.properties | ||
bin/ycsb.sh run voltdb -P workloads/workloadb -P voltdb.properties | ||
bin/ycsb.sh run voltdb -P workloads/workloadc -P voltdb.properties | ||
bin/ycsb.sh run voltdb -P workloads/workloadd -P voltdb.properties | ||
bin/ycsb.sh run voltdb -P workloads/workloade -P voltdb.properties | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Copyright (c) 2012 - 2016 YCSB contributors. All rights reserved. Licensed | ||
under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | ||
applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. See accompanying | ||
LICENSE file. --> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.yahoo.ycsb</groupId> | ||
<artifactId>binding-parent</artifactId> | ||
<version>0.17.0-SNAPSHOT</version> | ||
<relativePath>../binding-parent</relativePath> | ||
</parent> | ||
|
||
<artifactId>voltdb-binding</artifactId> | ||
<name>VoltDB Binding</name> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.yahoo.ycsb</groupId> | ||
<artifactId>core</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.28</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-api</artifactId> | ||
<version>2.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<version>2.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j-impl</artifactId> | ||
<version>2.7</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.voltdb/voltdbclient --> | ||
<dependency> | ||
<groupId>org.voltdb</groupId> | ||
<artifactId>voltdbclient</artifactId> | ||
<version>9.1.1</version> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/org.voltdb/voltdb --> | ||
<dependency> | ||
<groupId>org.voltdb</groupId> | ||
<artifactId>voltdb</artifactId> | ||
srmadscience marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<version>9.1.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> | ||
|
180 changes: 180 additions & 0 deletions
180
voltdb/src/main/java/com/yahoo/ycsb/db/voltdb/ConnectionHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
/** | ||
* Copyright (c) 2015-2019 YCSB contributors. All rights reserved. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you | ||
* may not use this file except in compliance with the License. You | ||
* may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
* implied. See the License for the specific language governing | ||
* permissions and limitations under the License. See accompanying | ||
* LICENSE file. | ||
*/ | ||
|
||
/* | ||
* VoltDB Connection Utility. | ||
*/ | ||
package com.yahoo.ycsb.db.voltdb; | ||
|
||
import java.io.IOException; | ||
import java.net.Socket; | ||
import java.util.concurrent.CountDownLatch; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.voltdb.client.Client; | ||
import org.voltdb.client.ClientConfig; | ||
import org.voltdb.client.ClientFactory; | ||
|
||
/** | ||
* Help class to create VoltDB connections for YCSB benchmark. | ||
*/ | ||
public final class ConnectionHelper { | ||
|
||
/** | ||
* Default port for VoltDB. | ||
*/ | ||
private static final int VOLTDB_DEFAULT_PORT = 21212; | ||
|
||
/** | ||
* hidden constructor. | ||
*/ | ||
private ConnectionHelper() { | ||
|
||
} | ||
|
||
/** | ||
* Creates a factory used to connect to a VoltDB instance. (Note that if a | ||
* corresponding connection exists, all parameters other than 'servers' are | ||
* ignored) | ||
* | ||
* @param clientId A unique identifier for the connecting client | ||
* @param servers The comma separated list of VoltDB servers in | ||
* hostname[:port] format that the instance will use. | ||
* @param user The username for the connection | ||
* @param password The password for the specified user | ||
* @param ratelimit A limit on the number of transactions per second for the | ||
* VoltDB instance | ||
* @return The existing factory if a corresponding connection has already been | ||
* created; the newly created one otherwise. | ||
* @throws IOException Throws if a connection is already open with a | ||
* different server string. | ||
* @throws InterruptedException | ||
*/ | ||
public static Client createConnection(Long clientId, String servers, String user, String password, | ||
int ratelimit) throws IOException, InterruptedException { | ||
|
||
ClientConfig config = new ClientConfig(user, password); | ||
config.setMaxTransactionsPerSecond(ratelimit); | ||
Client client = ClientFactory.createClient(config); | ||
|
||
// Note that in VoltDB there is a distinction between creating an instance of a client | ||
// and actually connecting to the DB... | ||
connect(client, servers); | ||
|
||
return client; | ||
} | ||
|
||
|
||
/** | ||
* Connect to a single server with retry. Limited exponential backoff. No | ||
* timeout. This will run until the process is killed if it's not able to | ||
* connect. | ||
* | ||
* @param server hostname:port or just hostname (hostname can be ip). | ||
*/ | ||
private static void connectToOneServerWithRetry(final Client client, String server) { | ||
|
||
Logger logger = LoggerFactory.getLogger(ConnectionHelper.class); | ||
|
||
int sleep = 1000; | ||
while (true) { | ||
try { | ||
client.createConnection(server); | ||
break; | ||
} catch (Exception e) { | ||
logger.error("Connection failed - retrying in %d second(s).\n", sleep / 1000); | ||
try { | ||
Thread.sleep(sleep); | ||
} catch (java.lang.InterruptedException e2) { | ||
logger.error(e2.getMessage()); | ||
} | ||
if (sleep < 8000) { | ||
sleep += sleep; | ||
} | ||
} | ||
} | ||
|
||
logger.info("Connected to VoltDB node at:" + server); | ||
} | ||
|
||
/** | ||
* See if DB servers are present on the network. | ||
* | ||
* @return true or false | ||
*/ | ||
public static boolean checkDBServers(String servernames) { | ||
|
||
String[] serverNamesArray = servernames.split(","); | ||
|
||
boolean dbThere = false; | ||
|
||
Socket socket = null; | ||
try { | ||
// Connect | ||
socket = new Socket(serverNamesArray[0], VOLTDB_DEFAULT_PORT); | ||
dbThere = true; | ||
} catch (IOException connectFailed) { | ||
dbThere = false; | ||
} finally { | ||
if (socket != null) { | ||
try { | ||
socket.close(); | ||
} catch (IOException ignore) { | ||
// Ignore. | ||
} | ||
} | ||
socket = null; | ||
} | ||
|
||
return dbThere; | ||
|
||
} | ||
|
||
/** | ||
* Connect to a set of servers in parallel. Each will retry until connection. | ||
* This call will block until all have connected. | ||
* | ||
* @param servers A comma separated list of servers using the hostname:port | ||
* syntax (where :port is optional). | ||
* @throws InterruptedException if anything bad happens with the threads. | ||
*/ | ||
private static void connect(final Client client, String servers) throws InterruptedException { | ||
|
||
Logger logger = LoggerFactory.getLogger(ConnectionHelper.class); | ||
|
||
logger.info("Connecting to VoltDB..."); | ||
|
||
String[] serverArray = servers.split(","); | ||
final CountDownLatch connections = new CountDownLatch(serverArray.length); | ||
|
||
// use a new thread to connect to each server | ||
for (final String server : serverArray) { | ||
new Thread(new Runnable() { | ||
@Override | ||
public void run() { | ||
connectToOneServerWithRetry(client, server); | ||
connections.countDown(); | ||
} | ||
}).start(); | ||
} | ||
// block until all have connected | ||
connections.await(); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was specifically version 9.1.1 we needed? Also it doesn't look like the voltdb-binding pom is using this currently?