Database Benchmark Quarkus(Java) Client

Requirements

  • Java 11
  • Maven 3.x
  • Internet accesses to download needed artifacts

Design notes

Running the Database benchmark in Development mode

Launching the application

mvn quarkus:dev

Running the application by connecting to Mongo on Openshift

# Expose the mongo deployed on open shift cluster so that you can access it locally. Exposing mongo on port 34000.
oc port-forward mongodb-benchmark-replica-set-0 34000:27017

# add/update the configuration in Application.properties
quarkus.mongodb.connection-string=mongodb://localhost:34000

# Connect to mongo using mongo CLI tool.
mongo mongodb://developer:password@localhost:34000

Running the benchmark

The client application exposes an API that can be used to start the test:

http://localhost:9090/benchmark/TYPE/DURATION/THREADS

Where:

  • TYPE can be any of:
    • databaseWrite: Does write to the database mentioned as part of the JDBC URL. At this moment only mongo supported.
    • databaseRead: Does read to the database mentioned as part of the JDBC URL. At this moment only mongo supported and reads the record with ID=1. We can extend the functionality based on requirement.
  • DURATION is the duration in seconds of the test
  • THREADS is the number of parallel threads to spawn (AKA number of users)

Examples:

 curl -X GET http://localhost:9090/benchmark/databaseWrite/120/3

Result is in JSON format:

{
  "noOfExecutions" : 34135,
  "noOfFailures" : 0,
  "minResponseTime" : {
    "index" : 615,
    "responseTime" : 1
  },
  "maxResponseTime" : {
    "index" : 9144,
    "responseTime" : 80
  },
  "averageResponseTime" : 2,
  "percentile95" : 3,
  "percentile99" : 4,
  "totalTimeMillis" : 74882,
  "elapsedTimeMillis" : 30010,
  "requestsPerSecond" : 1137.0
}

Note The index attribute in minResponseTime and maxResponseTime represent the (first) index of the request for which that time what calculated

Deploying the application on to Open Shift Cluster

Refer Deploying the application on to Open Shift Cluster

Running the Benchmark for multiple users

Refer Running the benchmark for multiple users in automated way