5595d55c79
* Use the token from incoming requests to update the package list changelog_begin changelog_end * Lazily initialize the ledger client * Fix ee integration tests * Fix package reloading behaviour by using a semaphore to check for ongoing updates * Refactor out the semaphore code into a concurrency utility class * Use correct locking for the updateTask so every thread always uses an up to date task * Remove unused imports in utils.Concurrent & remove packages from the tests * Hide & mark the token file cli option deprecated because we dont need it anymore and only keep it so client deployment code doesn't break * Fix scala 2.12 build by adding more type annotations * Update ledger-service/http-json-cli/src/main/scala/com/daml/http/OptionParser.scala Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * Update ledger-service/http-json/src/main/scala/com/digitalasset/http/PackageService.scala Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * Readd pgkManagementClient after it was removed accidentally (but now it's lazy) * Remove concurrent object & use atomic boolean instead of a mutex because it makes more sense * Replace semaphore with countdownlatch * Refactor the caching into a separate class * Use Instant instead of LocalDateTime * Remove that ** of bad synchonization and do stupid simple synchronization because it JUST WORKS, besides adapt when we want to reload * Remove await in tests because it can result in buggy tests * remove unused code in WebSocketService.scala * Unhide the access-token-file option as per request of Stefano * Less implicit jwts per request of Stefano * Try making some code more readable as by request of Akshay * Use more shark because it expresses better than flatMaps if I don't need the arg * Move defs in predicate in WebsocketService.scala around * Try to minimize diff further in WebsocketService.scala * Fix build and minimize diff in WebSocketService.scala further * Minimize diff of function getTransactionSourceForParty in WebSocketService.scala * Share the ec in WebSocketService.scala to minimize the diff * Minimize in function predicate in WebSocketService.scala * Further minimize in function predicate in WebSocketService.scala * Change some case classes to be normal classes but with apply method * Update ledger-service/http-json/src/main/scala/com/digitalasset/http/PackageService.scala Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * Update ledger-service/http-json/src/main/scala/com/digitalasset/http/Endpoints.scala Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * Get rid of implicit jwt tokens, the world is already confusing and full of implicits enough * Improve readability * Integrate the new LedgerClient which does not depend on a leder id * Fix tests * Apply suggestions from code review thanks to @S11001001 Co-authored-by: Stephen Compall <stephen.compall@daml.com> * Apply further review comments * Remove outcommented code * Deprecate access token file option in the description too changelog_begin - [JSON API] The cli option `--access-token-file` is now deprecated. It is not needed anymore and you can safely remove it. Reason is that the operations which prior required a token at startup are now done on demand using the token of the incoming request. changelog_end Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> Co-authored-by: Stephen Compall <stephen.compall@daml.com> |
||
---|---|---|
.. | ||
daml | ||
release | ||
src/main | ||
BUILD.bazel | ||
README.md |
1. Gatling Scenarios
1.1. Prerequisites
All current Gatling scenarios require quickstart-model.dar
with IOU example. You can build one using:
bazel build //docs:quickstart-model
ls "${PWD}/bazel-bin/docs/quickstart-model.dar"
1.2. List of Scenarios
Gatling scenarios extend from io.gatling.core.scenario.Simulation
:
com.daml.http.perf.scenario.CreateCommand
com.daml.http.perf.scenario.ExerciseCommand
com.daml.http.perf.scenario.CreateAndExerciseCommand
com.daml.http.perf.scenario.AsyncQueryConstantAcs
com.daml.http.perf.scenario.SyncQueryConstantAcs
com.daml.http.perf.scenario.SyncQueryNewAcs
com.daml.http.perf.scenario.SyncQueryVariableAcs
com.daml.http.perf.scenario.OracleMultiUserQueryScenario
2. Running Gatling Scenarios from Bazel
2.1. Help
$ bazel run //ledger-service/http-json-perf:http-json-perf-binary -- --help
2.2. Example
$ bazel run //ledger-service/http-json-perf:http-json-perf-binary -- \
--scenario=com.daml.http.perf.scenario.CreateCommand \
--dars="${PWD}/bazel-bin/docs/quickstart-model.dar" \
--reports-dir=/home/leos/tmp/results/ \
--jwt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJNeUxlZGdlciIsImFwcGxpY2F0aW9uSWQiOiJmb29iYXIiLCJhY3RBcyI6WyJBbGljZSJdfX0.VdDI96mw5hrfM5ZNxLyetSVwcD7XtLT4dIdHIOa9lcU"
2.3 Running OracleMultiUserQueryScenario
We use an external docker oracle vm, so we want to retain the data between runs to specifically focus on testing query performance.
use RETAIN_DATA
and USE_DEFAULT_USER
env vars to use a static user(ORACLE_USER
) and preserve data.
This scenario uses a single template KeyedIou
defined in LargeAcs.daml
.
We can control a few scenario parameters i.e NUM_RECORDS
NUM_QUERIES
NUM_READERS
NUM_WRITERS
via env variables
- Populate Cache
USE_DEFAULT_USER=true RETAIN_DATA=true RUN_MODE="populateCache" bazel run //ledger-service/http-json-perf:http-json-perf-binary-ee -- --scenario=com.daml.http.perf.scenario.OracleMultiUserQueryScenario --jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJNeUxlZGdlciIsImFwcGxpY2F0aW9uSWQiOiJmb29iYXIiLCJhY3RBcyI6WyJBbGljZSJdfX0.VdDI96mw5hrfM5ZNxLyetSVwcD7XtLT4dIdHIOa9lcU --dars=$PWD/bazel-bin/ledger-service/http-json-perf/LargeAcs.dar --query-store-index oracle
- Fetch By Key
Query contracts by the defined key field.
USE_DEFAULT_USER=true RETAIN_DATA=true RUN_MODE="fetchByKey" NUM_QUERIES=100 bazel run //ledger-service/http-json-perf:http-json-perf-binary-ee -- --scenario=com.daml.http.perf.scenario.OracleMultiUserQueryScenario --jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJNeUxlZGdlciIsImFwcGxpY2F0aW9uSWQiOiJmb29iYXIiLCJhY3RBcyI6WyJBbGljZSJdfX0.VdDI96mw5hrfM5ZNxLyetSVwcD7XtLT4dIdHIOa9lcU --dars=$PWD/bazel-bin/ledger-service/http-json-perf/LargeAcs.dar --query-store-index oracle
- Fetch By Query
Query contracts by a field on the payload which is the id
in this case.
USE_DEFAULT_USER=true RETAIN_DATA=true RUN_MODE="fetchByQuery" bazel run //ledger-service/http-json-perf:http-json-perf-binary-ee -- --scenario=com.daml.http.perf.scenario.OracleMultiUserQueryScenario --jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJNeUxlZGdlciIsImFwcGxpY2F0aW9uSWQiOiJmb29iYXIiLCJhY3RBcyI6WyJBbGljZSJdfX0.VdDI96mw5hrfM5ZNxLyetSVwcD7XtLT4dIdHIOa9lcU --dars=$PWD/bazel-bin/ledger-service/http-json-perf/LargeAcs.dar --query-store-index oracle
3. Running Gatling Scenarios Manually
The following instructions tested on Linux but should also work on macOs.
3.1. Install Gatling (open-source load testing solution)
- the website: https://gatling.io/open-source
- direct URL: https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/3.3.1/gatling-charts-highcharts-bundle-3.3.1-bundle.zip
3.2. Create quickstart Daml project
$ daml new quickstart-java --template quickstart-java
$ cd quickstart-java/
$ daml build
3.3. Start Sandbox with quickstart DAR
Ledger ID MyLedger
is important, it is currently hardcoded in the com.daml.http.perf.scenario.SimulationConfig
. See aliceJwt
.
$ daml sandbox --ledgerid MyLedger ./.daml/dist/quickstart-0.0.1.dar
3.4. Start JSON API
daml json-api --ledger-host=localhost --ledger-port=6865 --http-port=7575 --package-reload-interval 5h --allow-insecure-tokens
3.5. Run Gatling scenario
$ <GATLING_HOME>/bin/gatling.sh --simulations-folder=<DAML_PROJECT_HOME>/ledger-service/http-json-perf/src/main/scala/com/daml/http/perf/scenario --simulation=com.daml.http.perf.scenario.CreateCommand
Where:
<GATLING_HOME>
-- path to the Gatling directory<DAML_PROJECT_HOME>
-- path to the Daml Repository on the local disk--simulation=com.daml.http.perf.scenario.CreateCommand
-- full class name of the scenario from the--simulations-folder