diff --git a/README.md b/README.md
index 709e45d..04ab1e8 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ All applications implement the same functionality and expose the same REST api
- `./run-micronaut.sh`
- `./run-quarkus.sh`
4. Run Gatling:
- - `./gradlew :loadtest:gatlingRun-gatling.simulation.AppSimulation`
+ - `./gradlew :loadtest:gatlingRun --simulation gatling.simulation.AppSimulation`
Check wiremock performance
@@ -30,7 +30,7 @@ All applications implement the same functionality and expose the same REST api
1. Spin Up Wiremock:
- `docker-compose up -d wiremock`
4. Run Gatling:
- - `./gradlew :loadtest:gatlingRun-gatling.simulation.WiremockSimulation`
+ - `./gradlew :loadtest:gatlingRun --simulation gatling.simulation.WiremockSimulation`
diff --git a/loadtest/README.md b/loadtest/README.md
new file mode 100644
index 0000000..b13e376
--- /dev/null
+++ b/loadtest/README.md
@@ -0,0 +1,14 @@
+# Gatling
+
+## Run
+
+Run all simulations
+ - `gradle gatlingRun --all`
+
+Run one simulation
+- `gradle gatlingRun --simulation gatling.simulation.AppSimulation`
+
+
+## Useful links
+
+- [Official Demo Gatling Project](https://github.com/gatling/gatling-gradle-plugin-demo-java)
\ No newline at end of file
diff --git a/loadtest/build.gradle b/loadtest/build.gradle
index 750664f..44616de 100644
--- a/loadtest/build.gradle
+++ b/loadtest/build.gradle
@@ -1,6 +1,6 @@
plugins {
id 'java'
- id 'io.gatling.gradle' version '3.9.5'
+ id 'io.gatling.gradle' version '3.11.4'
}
group = 'bitxon'
@@ -16,9 +16,6 @@ dependencies {
}
gatling {
- // WARNING: options below only work when logback config file isn't provided
- logLevel = 'WARN' // logback root level
- logHttp = 'NONE' // set to 'ALL' for all HTTP traffic in TRACE, 'FAILURES' for failed HTTP traffic in DEBUG
enterprise {
// Enterprise Cloud (https://cloud.gatling.io/) configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/#working-with-gatling-enterprise-cloud
// Enterprise Self-Hosted configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/#working-with-gatling-enterprise-self-hosted
diff --git a/loadtest/src/gatling/java/gatling/Engine.java b/loadtest/src/gatling/java/gatling/Engine.java
deleted file mode 100644
index 75443c7..0000000
--- a/loadtest/src/gatling/java/gatling/Engine.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package gatling;
-
-import io.gatling.app.Gatling;
-import io.gatling.core.config.GatlingPropertiesBuilder;
-
-public class Engine {
-
- public static void main(String[] args) {
- GatlingPropertiesBuilder props = new GatlingPropertiesBuilder()
- .resourcesDirectory(IDEPathHelper.gradleResourcesDirectory.toString())
- .resultsDirectory(IDEPathHelper.resultsDirectory.toString())
- .binariesDirectory(IDEPathHelper.gradleBinariesDirectory.toString());
-
- Gatling.fromMap(props.build());
- }
-}
diff --git a/loadtest/src/gatling/java/gatling/IDEPathHelper.java b/loadtest/src/gatling/java/gatling/IDEPathHelper.java
deleted file mode 100644
index a571f03..0000000
--- a/loadtest/src/gatling/java/gatling/IDEPathHelper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package gatling;
-
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-public class IDEPathHelper {
-
- static final Path gradleSourcesDirectory;
- static final Path gradleResourcesDirectory;
- static final Path gradleBinariesDirectory;
- static final Path resultsDirectory;
-
- static {
- try {
- Path projectRootDir = Paths.get(IDEPathHelper.class.getClassLoader().getResource("gatling.conf").toURI()).getParent().getParent().getParent().getParent();
- Path gradleBuildDirectory = projectRootDir.resolve("build");
- Path gradleSrcDirectory = projectRootDir.resolve("src").resolve("gatling");
-
- gradleSourcesDirectory = gradleSrcDirectory.resolve("java");
- gradleResourcesDirectory = gradleSrcDirectory.resolve("resources");
- gradleBinariesDirectory = gradleBuildDirectory.resolve("classes").resolve("java").resolve("gatling");
- resultsDirectory = gradleBuildDirectory.resolve("reports").resolve("gatling");
- } catch (URISyntaxException e) {
- throw new ExceptionInInitializerError(e);
- }
- }
-}
diff --git a/loadtest/src/gatling/java/gatling/simulation/AppSimulation.java b/loadtest/src/gatling/java/gatling/simulation/AppSimulation.java
index 65739f1..cd9d1f8 100644
--- a/loadtest/src/gatling/java/gatling/simulation/AppSimulation.java
+++ b/loadtest/src/gatling/java/gatling/simulation/AppSimulation.java
@@ -49,7 +49,7 @@ public class AppSimulation extends Simulation {
//-----------------------------------------------------------------------------------------------------------------
private static ChainBuilder postAccount(String sessionFieldNameForId) {
- return exec().feed(feederPost).exec(http("Create")
+ return feed(feederPost).exec(http("Create")
.post("/accounts")
.header("Content-Type", "application/json")
.body(StringBody("""
@@ -68,7 +68,7 @@ private static ChainBuilder postAccount(String sessionFieldNameForId) {
}
private static ChainBuilder postInvalidAccount() {
- return exec().feed(feederInvalidPost).exec(http("Create (400,422)")
+ return feed(feederInvalidPost).exec(http("Create (400,422)")
.post("/accounts")
.header("Content-Type", "application/json")
.body(StringBody("""
@@ -100,7 +100,7 @@ private static ChainBuilder getAllAccounts() {
}
private static ChainBuilder postTransfer() {
- return exec().feed(feederTransfer).exec(http("Transfer")
+ return feed(feederTransfer).exec(http("Transfer")
.post("/accounts/transfers")
.header("Content-Type", "application/json")
.body(StringBody("""
diff --git a/loadtest/src/gatling/resources/gatling.conf b/loadtest/src/gatling/resources/gatling.conf
index 633054b..127d132 100644
--- a/loadtest/src/gatling/resources/gatling.conf
+++ b/loadtest/src/gatling/resources/gatling.conf
@@ -6,122 +6,113 @@
gatling {
core {
- #outputDirectoryBaseName = "" # The prefix for each simulation result folder (then suffixed by the report generation timestamp)
- #runDescription = "" # The description for this simulation run, displayed in each report
- #encoding = "utf-8" # Encoding to use throughout Gatling for file and string manipulation
- #simulationClass = "" # The FQCN of the simulation to run (when used in conjunction with noReports, the simulation for which assertions will be validated)
+ #encoding = "utf-8" # Encoding to use throughout Gatling for file and string manipulation
#elFileBodiesCacheMaxCapacity = 200 # Cache size for request body EL templates, set to 0 to disable
- #rawFileBodiesCacheMaxCapacity = 200 # Cache size for request body Raw templates, set to 0 to disable
- #rawFileBodiesInMemoryMaxSize = 1000 # Below this limit, raw file bodies will be cached in memory
- #pebbleFileBodiesCacheMaxCapacity = 200 # Cache size for request body Peeble templates, set to 0 to disable
+ #rawFileBodiesCacheMaxCapacity = 200 # Cache size for request body raw files, set to 0 to disable
+ #rawFileBodiesInMemoryMaxSize = 10240 # Max bite size of raw files to be cached in memory
+ #pebbleFileBodiesCacheMaxCapacity = 200 # Cache size for request body Pebble templates, set to 0 to disable
#feederAdaptiveLoadModeThreshold = 100 # File size threshold (in MB). Below load eagerly in memory, above use batch mode with default buffer size
#shutdownTimeout = 10000 # Milliseconds to wait for the actor system to shutdown
extract {
regex {
- #cacheMaxCapacity = 200 # Cache size for the compiled regexes, set to 0 to disable caching
+ #cacheMaxCapacity = 200 # Cache size for the compiled regexes, set to 0 to disable caching
}
xpath {
- #cacheMaxCapacity = 200 # Cache size for the compiled XPath queries, set to 0 to disable caching
+ #cacheMaxCapacity = 200 # Cache size for the compiled XPath queries, set to 0 to disable caching
}
jsonPath {
- #cacheMaxCapacity = 200 # Cache size for the compiled jsonPath queries, set to 0 to disable caching
+ #cacheMaxCapacity = 200 # Cache size for the compiled jsonPath queries, set to 0 to disable caching
}
css {
- #cacheMaxCapacity = 200 # Cache size for the compiled CSS selectors queries, set to 0 to disable caching
+ #cacheMaxCapacity = 200 # Cache size for the compiled CSS selectors queries, set to 0 to disable caching
}
}
- directory {
- #simulations = user-files/simulations # Directory where simulation classes are located (for bundle packaging only)
- #resources = user-files/resources # Directory where resources, such as feeder files and request bodies are located (for bundle packaging only)
- #reportsOnly = "" # If set, name of report folder to look for in order to generate its report
- #binaries = "" # If set, name of the folder where compiles classes are located: Defaults to GATLING_HOME/target.
- #results = results # Name of the folder where all reports folder are located
- }
}
socket {
- #connectTimeout = 10000 # Timeout in millis for establishing a TCP socket
+ #connectTimeout = 10000 # Timeout in millis for establishing a TCP socket
#tcpNoDelay = true
- #soKeepAlive = false # if TCP keepalive configured at OS level should be used
+ #soKeepAlive = false # if TCP keepalive configured at OS level should be used
#soReuseAddress = false
}
netty {
- #useNativeTransport = true # if Netty native transport should be used instead of Java NIO
- #allocator = "pooled" # switch to unpooled for unpooled ByteBufAllocator
- #maxThreadLocalCharBufferSize = 200000 # Netty's default is 16k
+ #useNativeTransport = true # if Netty Linux native transport should be used instead of Java NIO
+ #useIoUring = false # if io_uring should be used instead of epoll if available
+ #allocator = "pooled" # switch to unpooled for unpooled ByteBufAllocator
+ #maxThreadLocalCharBufferSize = 200000 # Netty's default is 16k
}
ssl {
- #useOpenSsl = true # if OpenSSL should be used instead of JSSE (only the latter can be debugged with -Djava.net.debug=ssl)
- #useOpenSslFinalizers = false # if OpenSSL contexts should be freed with Finalizer or if using RefCounted is fine
- #handshakeTimeout = 10000 # TLS handshake timeout in millis
- #useInsecureTrustManager = true # Use an insecure TrustManager that trusts all server certificates
- #enabledProtocols = [] # Array of enabled protocols for HTTPS, if empty use Netty's defaults
- #enabledCipherSuites = [] # Array of enabled cipher suites for HTTPS, if empty enable all available ciphers
- #sessionCacheSize = 0 # SSLSession cache size, set to 0 to use JDK's default
- #sessionTimeout = 0 # SSLSession timeout in seconds, set to 0 to use JDK's default (24h)
- #enableSni = true # When set to true, enable Server Name indication (SNI)
+ #useOpenSsl = true # if OpenSSL should be used instead of JSSE (only the latter can be debugged with -Djavax.net.debug=ssl)
+ #useOpenSslFinalizers = false # if OpenSSL contexts should be freed with Finalizer or if using RefCounted is fine
+ #handshakeTimeout = 10000 # TLS handshake timeout in millis
+ #useInsecureTrustManager = true # Use an insecure TrustManager that trusts all server certificates
+ #enabledProtocols = [] # Array of enabled protocols for HTTPS, if empty use Netty's defaults
+ #enabledCipherSuites = [] # Array of enabled cipher suites for HTTPS, if empty enable all available ciphers
+ #sessionCacheSize = 0 # SSLSession cache size, set to 0 to use JDK's default
+ #sessionTimeout = 0 # SSLSession timeout in seconds, set to 0 to use JDK's default (24h)
+ #enableSni = true # When set to true, enable Server Name indication (SNI)
keyStore {
- #type = "" # Type of SSLContext's KeyManagers store
- #file = "" # Location of SSLContext's KeyManagers store
- #password = "" # Password for SSLContext's KeyManagers store
- #algorithm = "" # Algorithm used SSLContext's KeyManagers store
+ #type = "" # Type of SSLContext's KeyManagers store, possible values are jks and p12
+ #file = "" # Location of SSLContext's KeyManagers store
+ #password = "" # Password for SSLContext's KeyManagers store
+ #algorithm = "" # Algorithm used SSLContext's KeyManagers store, typically RSA
}
trustStore {
- #type = "" # Type of SSLContext's TrustManagers store
- #file = "" # Location of SSLContext's TrustManagers store
- #password = "" # Password for SSLContext's TrustManagers store
- #algorithm = "" # Algorithm used by SSLContext's TrustManagers store
+ #type = "" # Type of SSLContext's TrustManagers store, possible values are jks and p12
+ #file = "" # Location of SSLContext's TrustManagers store
+ #password = "" # Password for SSLContext's TrustManagers store
+ #algorithm = "" # Algorithm used by SSLContext's TrustManagers store, typically RSA
}
}
charting {
- #noReports = false # When set to true, don't generate HTML reports
- #maxPlotPerSeries = 1000 # Number of points per graph in Gatling reports
- #useGroupDurationMetric = false # Switch group timings from cumulated response time to group duration.
+ #maxPlotPerSeries = 1000 # Number of points per graph in Gatling reports
+ #useGroupDurationMetric = false # Switch group timings from cumulated response time to group duration.
indicators {
- #lowerBound = 800 # Lower bound for the requests' response time to track in the reports and the console summary
- #higherBound = 1200 # Higher bound for the requests' response time to track in the reports and the console summary
- #percentile1 = 50 # Value for the 1st percentile to track in the reports, the console summary and Graphite
- #percentile2 = 75 # Value for the 2nd percentile to track in the reports, the console summary and Graphite
- #percentile3 = 95 # Value for the 3rd percentile to track in the reports, the console summary and Graphite
- #percentile4 = 99 # Value for the 4th percentile to track in the reports, the console summary and Graphite
+ #lowerBound = 800 # Lower bound for the requests' response time to track in the reports and the console summary
+ #higherBound = 1200 # Higher bound for the requests' response time to track in the reports and the console summary
+ #percentile1 = 50 # Value for the 1st percentile to track in the reports, the console summary and Graphite
+ #percentile2 = 75 # Value for the 2nd percentile to track in the reports, the console summary and Graphite
+ #percentile3 = 95 # Value for the 3rd percentile to track in the reports, the console summary and Graphite
+ #percentile4 = 99 # Value for the 4th percentile to track in the reports, the console summary and Graphite
}
}
http {
- #fetchedCssCacheMaxCapacity = 200 # Cache size for CSS parsed content, set to 0 to disable
- #fetchedHtmlCacheMaxCapacity = 200 # Cache size for HTML parsed content, set to 0 to disable
- #perUserCacheMaxCapacity = 200 # Per virtual user cache size, set to 0 to disable
- #warmUpUrl = "https://gatling.io" # The URL to use to warm-up the HTTP stack (blank means disabled)
- #enableGA = true # Very light Google Analytics (Gatling and Java version), please support
- #pooledConnectionIdleTimeout = 60000 # Timeout in millis for a connection to stay idle in the pool
- #requestTimeout = 60000 # Timeout in millis for performing an HTTP request
- #enableHostnameVerification = false # When set to true, enable hostname verification: SSLEngine.setHttpsEndpointIdentificationAlgorithm("HTTPS")
+ #fetchedCssCacheMaxCapacity = 200 # Cache size for CSS parsed content, set to 0 to disable
+ #fetchedHtmlCacheMaxCapacity = 200 # Cache size for HTML parsed content, set to 0 to disable
+ #perUserCacheMaxCapacity = 200 # Per virtual user cache size, set to 0 to disable
+ #warmUpUrl = "https://gatling.io" # The URL to use to warm-up the HTTP stack (blank means disabled)
+ #pooledConnectionIdleTimeout = 60000 # Timeout in millis for a connection to stay idle in the pool
+ #requestTimeout = 60000 # Timeout in millis for performing an HTTP request
+ #enableHostnameVerification = false # When set to true, enable hostname verification: SSLEngine.setHttpsEndpointIdentificationAlgorithm("HTTPS")
dns {
- #queryTimeout = 5000 # Timeout in millis of each DNS query in millis
- #maxQueriesPerResolve = 6 # Maximum allowed number of DNS queries for a given name resolution
+ #queryTimeout = 5000 # Timeout in millis of each DNS query in millis
+ #maxQueriesPerResolve = 6 # Maximum allowed number of DNS queries for a given name resolution
}
}
jms {
- #replyTimeoutScanPeriod = 1000 # scan period for timedout reply messages
+ #replyTimeoutScanPeriod = 1000 # scan period for timed out reply messages
}
data {
- #writers = [console, file] # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite)
+ #writers = [console, file] # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite)
+ #utcDateTime = true # Print date-times with the UTC zone instead of the System's default
console {
- #light = false # When set to true, displays a light version without detailed request stats
- #writePeriod = 5 # Write interval, in seconds
+ #light = false # When set to true, displays a light version without detailed request stats
+ #writePeriod = 5 # Write interval, in seconds
}
file {
- #bufferSize = 8192 # FileDataWriter's internal data buffer size, in bytes
+ #bufferSize = 8192 # FileDataWriter's internal data buffer size, in bytes
}
leak {
- #noActivityTimeout = 30 # Period, in seconds, for which Gatling may have no activity before considering a leak may be happening
+ #noActivityTimeout = 30 # Period, in seconds, for which Gatling may have no activity before considering a leak may be happening
}
graphite {
- #light = false # only send the all* stats
- #host = "localhost" # The host where the Carbon server is located
- #port = 2003 # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
- #protocol = "tcp" # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
- #rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
- #bufferSize = 8192 # Internal data buffer size, in bytes
- #writePeriod = 1 # Write period, in seconds
+ #light = false # only send the all* stats
+ #host = "localhost" # The host where the Carbon server is located
+ #port = 2003 # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
+ #protocol = "tcp" # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
+ #rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
+ #bufferSize = 8192 # Internal data buffer size, in bytes
+ #writePeriod = 1 # Write period, in seconds
}
+ #enableAnalytics = true # Anonymous Usage Analytics (no tracking), please support
}
-}
\ No newline at end of file
+}
diff --git a/loadtest/src/gatling/resources/logback-test.xml b/loadtest/src/gatling/resources/logback-test.xml
new file mode 100644
index 0000000..e808025
--- /dev/null
+++ b/loadtest/src/gatling/resources/logback-test.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx
+
+ false
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test.sh b/test.sh
index 62d4d83..75f5922 100755
--- a/test.sh
+++ b/test.sh
@@ -15,4 +15,4 @@ for run in {1..3}; do
done
# Performance Test
-./gradlew :loadtest:gatlingRun-gatling.simulation.AppSimulation
+./gradlew :loadtest:gatlingRun --simulation gatling.simulation.AppSimulation