DISCLAIMER: Carbyne Stack Caliper is in proof-of-concept stage. The software is not ready for production use. It has neither been developed nor tested for a specific use case.
Caliper is the Load-Testing-as-Code harness for Carbyne Stack. This project is based on the Gatling load test tool and provides a plugin that can be used to communicate with backend services of a Carbyne Stack Virtual Cloud using the dedicated java-clients.
The cs
object is used to provide a common configuration that is shared between
all virtual users. A list of Amphora Service endpoint URIs and the SPDZ
parameters matching the backend service configuration are used to initialize an
Amphora client.
To test the performance of one or multiple backend services of a Carbyne Stack
Virtual Cloud we create scenarios that make requests to a backend service. The
exec
method is used to execute an Action, in the context of this plugin,
actions are requests performed by a client that will be sent during a
simulation.
To execute the simulation we can use the gatling-maven-plugin
where we specify
the simulation class we want to use, e.g.
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-maven-plugin-version}</version>
<configuration>
<simulationClass>CarbynestackSimulation</simulationClass>
</configuration>
</plugin>
Multiple simulations can be executed using
<runMultipleSimulations>true</runMultipleSimulations>
, by default the results
are stored in ${project.build.directory}/gatling
but this value can be
overriden using <resultsFolder>path/to/folder</resultsFolder>
. To run the
simulation simply use the test
goal ./mvnw gatling:test
. The following
example shows a simulation class that provides the functionality to upload data
to a Carbyne Stack Virtual Cloud.
class CarbynestackSimulation extends Simulation { //1
val csProtocol = cs //2
.endpoints(List("http://172.18.1.128/amphora", "http://172.18.2.128/amphora"))
.prime("198766463529478683931867765928436695041")
.r("141515903391459779531506841503331516415")
.invR("133854242216446749056083838363708373830")
val tagKeys = List.fill[String](2)(Random.alphanumeric.take(10).mkString)
val tagGenerator =
new TagGenerator(tagKeys, Some(1000000000L), Some(9999999999L))
val secretGenerator =
new SecretGenerator(tagGenerator, 1000000000L, 9999999999L, 1) //3
val feeder = Iterator.continually { //4
Map("secret" -> secretGenerator.generate)
}
val createSecret = scenario("Amphora-createSecret-scenario") //5
.feed(feeder) //6
.exec(amphora.createSecret("#{secret}")) //7
setUp( //8
createSecret.inject(atOnceUsers(10) //9
).protocols(csProtocol)) //10
}
- The class declaration, it needs to extend
Simulation
- The common configuration to all Carbynestack client requests, e.g. see amphora-java-client
- Create a secret with randomized data that can be used by the client
- A Feeder is used to inject data into the virtual user
- The Scenario definition
- The secret generated by the
secretGenerator.generate
method is injected into the virtual users session - An amphora-java-client-request calling the
createSecret
method of theio.carbynestack.amphora.client.AmphoraClient
. Using the Gatling Expression Language we can use dynamic parameters that will be replaced with the value stored in the virtual user's session - Setting up the scenario(s) we want to use in this simulation
- Declaring that 10 virtual users will be injected at once into the
createSecret
scenario - Attaching the
cs
configuration matching the backend service configuration
A caliper [...] is a device used to measure the dimensions of an object (Source).
The object being measured in our case is Carbyne Stack. The dimensions are primarily performance and scalability.
The Carbyne Stack Caliper Load-Testing-as-Code harness is open-sourced under the Apache License 2.0. See the LICENSE file for details.
For information on how license obligations for 3rd party OSS dependencies are fulfilled see the README file of the Carbyne Stack repository.
Please see the Carbyne Stack Contributor's Guide