This repository has been archived by the owner on Jan 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
14 changed files
with
995 additions
and
634 deletions.
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 |
---|---|---|
@@ -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 | ||
``` |
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,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); | ||
} | ||
} |
Oops, something went wrong.