Skip to content

Commit

Permalink
Merge pull request #138 from dice-group/fix/small_query_performance
Browse files Browse the repository at this point in the history
Fix/small query performance
  • Loading branch information
Lixi authored Apr 14, 2021
2 parents 29e8973 + 5b1266e commit 154d9ed
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,41 @@ It contains the following files:
You can use the [basic configuration](https://github.com/dice-group/IGUANA/blob/master/example-suite.yml) we provide and modify it to your needs.
For further information please visit our [configuration](http://iguana-benchmark.eu/docs/3.2/usage/configuration/) and [Stresstest](http://iguana-benchmark.eu/docs/3.0/usage/stresstest/) wiki pages. For a detailed, step-by-step instruction please attend our [tutorial](http://iguana-benchmark.eu/docs/3.2/usage/tutorial/).



## Execute the Benchmark

Use the start script
```
./start-iguana.sh example-suite.yml
```
Now Iguana will execute the example benchmark suite configured in the example-suite.yml file


# How to Cite

```bibtex
@InProceedings{10.1007/978-3-319-68204-4_5,
author="Conrads, Felix
and Lehmann, Jens
and Saleem, Muhammad
and Morsey, Mohamed
and Ngonga Ngomo, Axel-Cyrille",
editor="d'Amato, Claudia
and Fernandez, Miriam
and Tamma, Valentina
and Lecue, Freddy
and Cudr{\'e}-Mauroux, Philippe
and Sequeda, Juan
and Lange, Christoph
and Heflin, Jeff",
title="Iguana: A Generic Framework for Benchmarking the Read-Write Performance of Triple Stores",
booktitle="The Semantic Web -- ISWC 2017",
year="2017",
publisher="Springer International Publishing",
address="Cham",
pages="48--65",
abstract="The performance of triples stores is crucial for applications driven by RDF. Several benchmarks have been proposed that assess the performance of triple stores. However, no integrated benchmark-independent execution framework for these benchmarks has yet been provided. We propose a novel SPARQL benchmark execution framework called Iguana. Our framework complements benchmarks by providing an execution environment which can measure the performance of triple stores during data loading, data updates as well as under different loads and parallel requests. Moreover, it allows a uniform comparison of results on different benchmarks. We execute the FEASIBLE and DBPSB benchmarks using the Iguana framework and measure the performance of popular triple stores under updates and parallel user requests. We compare our results (See https://doi.org/10.6084/m9.figshare.c.3767501.v1) with state-of-the-art benchmarking results and show that our benchmark execution framework can unveil new insights pertaining to the performance of triple stores.",
isbn="978-3-319-68204-4"
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
* Helper functions to work with streams.
*/
public class Streams {

public static final int bufferSize = 16 * 1024 * 1024; // 16 MB buffer

protected static final ThreadLocal<byte[]> threadBuffer = ThreadLocal.withInitial(() -> new byte[bufferSize]);

protected static final ThreadLocal<ByteArrayOutputStream> threadByteArrayOutputStream = ThreadLocal.withInitial(() -> new ByteArrayOutputStream(bufferSize));

/**
* Fastest way to serialize a stream to UTF-8 according to https://stackoverflow.com/a/35446009/6800941
*
Expand All @@ -21,7 +28,8 @@ public class Streams {
* @throws IOException from inputStream.read
*/
static public ByteArrayOutputStream inputStream2String(InputStream inputStream) throws IOException {
ByteArrayOutputStream result = new ByteArrayOutputStream();
ByteArrayOutputStream result = threadByteArrayOutputStream.get();
result.reset();
try {
inputStream2ByteArrayOutputStream(inputStream, null, -1.0, result);
} catch (TimeoutException e) {
Expand Down Expand Up @@ -61,7 +69,7 @@ static public ByteArrayOutputStream inputStream2String(InputStream inputStream,
public static long inputStream2ByteArrayOutputStream(InputStream inputStream, Instant startTime, double timeout, ByteArrayOutputStream result) throws IOException, TimeoutException {
assert (result != null);
boolean enable_timeout = timeout > 0;
byte[] buffer = new byte[10 * 1024 * 1024]; // 10 MB buffer
byte[] buffer = threadBuffer.get();
int length;
while ((length = inputStream.read(buffer)) != -1) {
if (enable_timeout && durationInMilliseconds(startTime, Instant.now()) > timeout)
Expand All @@ -82,7 +90,7 @@ public static long inputStream2ByteArrayOutputStream(InputStream inputStream, In
public static long inputStream2ByteArrayOutputStream(InputStream inputStream, ByteArrayOutputStream result) throws IOException {
try {
return inputStream2ByteArrayOutputStream(inputStream, Instant.now(), -1, result);
}catch(TimeoutException e){
} catch (TimeoutException e) {
//will never happen
return 0;
}
Expand All @@ -98,15 +106,14 @@ public static long inputStream2ByteArrayOutputStream(InputStream inputStream, By
* @throws TimeoutException Maybe thrown any time after if startTime + timeout is exceed
*/
static public long inputStream2Length(InputStream inputStream, Instant startTime, double timeout) throws IOException, TimeoutException {
byte[] buffer = new byte[10 * 1024 * 1024]; // 10 MB buffer
byte[] buffer = threadBuffer.get();
long length;
long ret = 0;
while ((length = inputStream.read(buffer)) != -1) {
if (durationInMilliseconds(startTime, Instant.now()) > timeout && timeout >0)
if (durationInMilliseconds(startTime, Instant.now()) > timeout && timeout > 0)
throw new TimeoutException("reading the answer timed out");
ret += length;
}
return ret;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ synchronized protected void addResultsOnce(QueryExecutionStats queryExecutionSta

@Override
public void executeQuery(String query, String queryID) {
requestStartTime = Instant.now();
queryId = queryID;
resultsSaved = false;
requestTimedOut = false;
Expand All @@ -148,7 +147,8 @@ public void executeQuery(String query, String queryID) {
buildRequest(query, queryId);

setTimeout(timeOut.intValue());


requestStartTime = Instant.now();
response = client.execute(request, getAuthContext(con.getEndpoint()));
// method to process the result in background
processHttpResponse();
Expand Down

0 comments on commit 154d9ed

Please sign in to comment.