Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
Complete rewrite with:
Browse files Browse the repository at this point in the history
* automatically detect which version of fcrepo we are connecting to
* simple random byte array template to decrease the RNG usage
* per thread and overall throughput calculation
* updated README and added duration log output
* updated logging framework
* factored out initial object creation and final purging
  • Loading branch information
fasseg authored and escowles committed Dec 3, 2013
1 parent 45dfabe commit e98090c
Show file tree
Hide file tree
Showing 14 changed files with 995 additions and 634 deletions.
51 changes: 31 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,69 @@
BenchTool for Fedora 3/4
=======================================================================================
This is a simple ingest benchmark to compare performance of Fedora 3 and Fedora 4.
The suite consists of two main classes responsible for running the benchmarks.
This is a simple ingest/retrieve/update/delete benchmark to compare performance of Fedora 3 and Fedora 4.
The suite consists of a jar file which can be run directly. The Fedora version will be automatically discovered depending on the given URL.
The url should include the context path of the webapp. For example `http://localhost:8080/fcrepo` for a Fedora version deployed at the context path `fcrepo`.

Fedora 3
--------
Tool to run an ingest benchmark against Fedora 3

### Usage

```
BenchToolFC3 <fedora-uri> <user> <pass> <num-objects> <datastream-size> [ingest|read|update|delete]
usage: BenchTool
-a,--action <action> The action to perform. Can be one of
ingest, read, update or delete.
[default=ingest]
-f,--fedora-url <fedora-url> The URL of the Fedora instance. The url
must include the context path of the
webapp. [default=http://localhost:8080]
-h,--help print the help screen
-l,--log <log> The log file to which the durations will
get written. [default=durations.log]
-n,--num-actions <num-actions> The number of actions performed.
[default=1]
-p,--password <password> The user's password
-s,--size <size> The size of the individual binaries
used. [default=1024]
-t,--num-threads <num-threads> The number of threads used for
performing all actions. [default=1]
-u,--user <user> The fedora user name
```

Fedora 3
--------

##### Example
Login with the user `fedoraAdmin` and the passwd `changeme` and ingest 1000 Objects each with one datastream of 1024kb size

```
#> java -cp bench-tool-${VERSION}-jar-with-dependencies.jar org.fcrepo.bench.BenchToolFC3 http://localhost:8080/fedora fedoraAdmin changeme 1000 1024 ingest
#> java -jar target/bench-tool-${VERSION}-jar-with-dependencies.jar -f http://localhost:8080/fedora -u fedoraAdmin -p changeme -s 1048576 -n 1000
```

Login with the user `fedoraAdmin` and the passwd `changeme` and update 1000 Objects each with one datastream of 1024kb size

```
#> java -cp bench-tool-${VERSION}-jar-with-dependencies.jar org.fcrepo.bench.BenchToolFC3 http://localhost:8080/fedora fedoraAdmin changeme 1000 1024 update
#> java -jar target/bench-tool-${VERSION}-jar-with-dependencies.jar -f http://localhost:8080/fedora -u fedoraAdmin -p changeme -s 1048576 -n 1000 -a update
```

Fedora 4
--------
Tool to run an ingest benchmark against Fedora 4

### Usage

```
BenchToolFC4 <fedora-uri> <num-objects> <datastream-size> <num-threads> [ingest|read|update|delete]
```

#### Example
Ingest 1000 Objects each with one datastream of 1024kb size using a max of 15 threads

```
#> java -cp bench-tool-${VERSION}-jar-with-dependencies.jar org.fcrepo.bench.BenchToolFC4 http://localhost:8080/fcrepo 1000 1024 15
#> java -jar target/bench-tool-${VERSION}-jar-with-dependencies.jar -f http://localhost:8080/fcrepo -s 1048576 -n 1000 -t 15
```

Delete 1000 Objects with a single thread

```
#> java -cp bench-tool-${VERSION}-jar-with-dependencies.jar org.fcrepo.bench.BenchToolFC4 http://localhost:8080/fcrepo 1000 1024 1 delete
#> java -jar target/bench-tool-${VERSION}-jar-with-dependencies.jar -f http://localhost:8080/fcrepo -s 1048576 -n 1000 -t 15 -a delete
```

Results
-------
Both main classes will generate a file called `ingest.log` containing the request durations in milliseconds which can be turned easily into a graph by using e.g. gnuplot
The durations file can be easily turned into a graph using gnuplot

#### Example
```
gnuplot> plot "ingest.log" title "FCRepo3 Ingest" with lines
gnuplot> plot "durations.log" title "Duration" with lines
```
32 changes: 31 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -25,6 +25,16 @@
<groupId>com.hp.hpl.jena</groupId>
<artifactId>jena</artifactId>
<version>2.6.4</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.uncommons.maths</groupId>
Expand All @@ -41,6 +51,21 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.16</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>0.9.16</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -56,6 +81,11 @@
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.fcrepo.bench.BenchTool</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
Expand Down
75 changes: 75 additions & 0 deletions src/main/java/org/fcrepo/bench/ActionWorker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

package org.fcrepo.bench;

import java.io.IOException;
import java.net.URI;
import java.util.concurrent.Callable;

import org.fcrepo.bench.BenchTool.Action;
import org.fcrepo.bench.BenchTool.FedoraVersion;

public class ActionWorker implements Callable<BenchToolResult> {

private final FedoraRestClient fedora;

private final long binarySize;

private final Action action;

private final String pid;

public ActionWorker(Action action, URI fedoraUri, String pid, long binarySize,
FedoraVersion version) {
super();
this.binarySize = binarySize;
this.fedora = FedoraRestClient.createClient(fedoraUri, version);
this.action = action;
this.pid = pid;
}

/*
* (non-Javadoc)
* @see java.util.concurrent.Callable#call()
*/
@Override
public BenchToolResult call() throws Exception {
/* check the action and run the appropriate test */
switch (this.action) {
case INGEST:
return doIngest();
case UPDATE:
return doUpdate();
case READ:
return doRead();
case DELETE:
return doDelete();
default:
throw new IllegalArgumentException("The Action " +
action.name() +
" is not available in the worker thread");
}
}

private BenchToolResult doDelete() throws IOException {
long duration = fedora.deleteDatastream(pid);
return new BenchToolResult(-1f, duration, binarySize);
}

private BenchToolResult doRead() throws IOException {
long duration = fedora.retrieveDatastream(pid);
float tp = binarySize * 1000f / duration;
return new BenchToolResult(tp, duration, binarySize);
}

private BenchToolResult doUpdate() throws IOException {
long duration = fedora.updateDatastream(pid,binarySize);
float tp = binarySize * 1000f / duration;
return new BenchToolResult(tp, duration, binarySize);
}

private BenchToolResult doIngest() throws IOException {
long duration = fedora.createDatastream(pid, binarySize);
float tp = binarySize * 1000f / duration;
return new BenchToolResult(tp, duration, binarySize);
}
}
Loading

0 comments on commit e98090c

Please sign in to comment.