added average turnaround time calculation in benchmark
This commit is contained in:
@@ -13,6 +13,7 @@ import java.util.Base64
|
|||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
import java.util.concurrent.LinkedBlockingQueue
|
import java.util.concurrent.LinkedBlockingQueue
|
||||||
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
@CommandLine.Command(
|
@CommandLine.Command(
|
||||||
@@ -53,9 +54,12 @@ class BenchmarkCommand : GbcsCommand() {
|
|||||||
val entries = let {
|
val entries = let {
|
||||||
val completionQueue = LinkedBlockingQueue<Future<Pair<String, ByteArray>>>(numberOfEntries)
|
val completionQueue = LinkedBlockingQueue<Future<Pair<String, ByteArray>>>(numberOfEntries)
|
||||||
val start = Instant.now()
|
val start = Instant.now()
|
||||||
|
val totalElapsedTime = AtomicLong(0)
|
||||||
entryGenerator.take(numberOfEntries).forEach { entry ->
|
entryGenerator.take(numberOfEntries).forEach { entry ->
|
||||||
|
val requestStart = System.nanoTime()
|
||||||
val future = client.put(entry.first, entry.second).thenApply { entry }
|
val future = client.put(entry.first, entry.second).thenApply { entry }
|
||||||
future.whenComplete { _, _ ->
|
future.whenComplete { _, _ ->
|
||||||
|
totalElapsedTime.addAndGet((System.nanoTime() - requestStart))
|
||||||
completionQueue.put(future)
|
completionQueue.put(future)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +82,9 @@ class BenchmarkCommand : GbcsCommand() {
|
|||||||
val elapsed = Duration.between(start, end).toMillis()
|
val elapsed = Duration.between(start, end).toMillis()
|
||||||
"Insertion rate: ${numberOfEntries.toDouble() / elapsed * 1000} ops/s"
|
"Insertion rate: ${numberOfEntries.toDouble() / elapsed * 1000} ops/s"
|
||||||
}
|
}
|
||||||
|
log.info {
|
||||||
|
"Average time per insertion: ${totalElapsedTime.get() / numberOfEntries.toDouble() * 1000} ms"
|
||||||
|
}
|
||||||
inserted
|
inserted
|
||||||
}
|
}
|
||||||
log.info {
|
log.info {
|
||||||
@@ -86,8 +93,11 @@ class BenchmarkCommand : GbcsCommand() {
|
|||||||
if (entries.isNotEmpty()) {
|
if (entries.isNotEmpty()) {
|
||||||
val completionQueue = LinkedBlockingQueue<Future<Unit>>(entries.size)
|
val completionQueue = LinkedBlockingQueue<Future<Unit>>(entries.size)
|
||||||
val start = Instant.now()
|
val start = Instant.now()
|
||||||
|
val totalElapsedTime = AtomicLong(0)
|
||||||
entries.forEach { entry ->
|
entries.forEach { entry ->
|
||||||
|
val requestStart = System.nanoTime()
|
||||||
val future = client.get(entry.first).thenApply {
|
val future = client.get(entry.first).thenApply {
|
||||||
|
totalElapsedTime.addAndGet((System.nanoTime() - requestStart))
|
||||||
if (it == null) {
|
if (it == null) {
|
||||||
log.error {
|
log.error {
|
||||||
"Missing entry for key '${entry.first}'"
|
"Missing entry for key '${entry.first}'"
|
||||||
@@ -112,6 +122,9 @@ class BenchmarkCommand : GbcsCommand() {
|
|||||||
val elapsed = Duration.between(start, end).toMillis()
|
val elapsed = Duration.between(start, end).toMillis()
|
||||||
"Retrieval rate: ${entries.size.toDouble() / elapsed * 1000} ops/s"
|
"Retrieval rate: ${entries.size.toDouble() / elapsed * 1000} ops/s"
|
||||||
}
|
}
|
||||||
|
log.info {
|
||||||
|
"Average time per retrieval: ${totalElapsedTime.get() / numberOfEntries.toDouble() * 1e6} ms"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.error("Skipping retrieval benchmark as it was not possible to insert any entry in the cache")
|
log.error("Skipping retrieval benchmark as it was not possible to insert any entry in the cache")
|
||||||
}
|
}
|
||||||
|
@@ -48,8 +48,8 @@
|
|||||||
|
|
||||||
<xs:complexType name="tlsCertificateAuthorizationType">
|
<xs:complexType name="tlsCertificateAuthorizationType">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="group-extractor" type="gbcs:X500NameExtractorType"/>
|
<xs:element name="group-extractor" type="gbcs:X500NameExtractorType" minOccurs="0"/>
|
||||||
<xs:element name="user-extractor" type="gbcs:X500NameExtractorType"/>
|
<xs:element name="user-extractor" type="gbcs:X500NameExtractorType" minOccurs="0"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user