daml/ledger-service/http-json-perf
Moritz Kiefer aa3e5a7dbe
Support multi-party reads on the JSON API (#7571)
* Support multi-party reads on the JSON API

Given that those aren’t going away and we’re instead doubling down on
this and adding multi-party writes as well, the JSON API needs to
support this. This PR only implements the read side (since the ledgers
do not yet support the write side).

This does not deviate from the approach chosen by the JSON API to
infer the parties from the token, we just don’t error out anymore when
more than one party is passed.

changelog_begin
changelog_end

* Apply suggestions from code review

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Remove dependency on doobie_postgres from db-backend

changelog_begin
changelog_end

* Fix offset update

changelog_begin
changelog_end

* Use nonempty sets for parties

changelog_begin
changelog_end

* Fix updateOffset under concurrent transactions

changelog_begin
changelog_end

* Add tests for multi-party websocket queries and fetches

changelog_begin
changelog_end

* fmt

changelog_begin
changelog_end

* Fix perf tests

changelog_begin
changelog_end

* Cleanup

changelog_begin
changelog_end

* Update ledger-service/http-json/src/main/scala/com/digitalasset/http/dbbackend/ContractDao.scala

Co-authored-by: Stephen Compall <stephen.compall@daml.com>

* Move ParsePayload instances, thanks Stephen!

changelog_begin
changelog_end

* More unsubst

changelog_begin
changelog_end

* Fix off by 1 error

changelog_begin
changelog_end

* Remove redundant type annotation

changelog_begin
changelog_end

* fmt

changelog_begin
changelog_end

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-10-08 13:46:15 +02:00
..
release JSON API perf test main that starts sandbox and json-api services (#7283) 2020-08-31 22:55:01 +00:00
src/main Support multi-party reads on the JSON API (#7571) 2020-10-08 13:46:15 +02:00
BUILD.bazel JSON API Perf Test Runner Query Store Index Support (#7434) 2020-09-17 16:39:00 -04:00
README.md JSON API Perf Test Runner Query Store Index Support (#7434) 2020-09-17 16:39:00 -04:00

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

2. Running Gatling Scenarios from Bazel

2.2. 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"

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)

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