diff --git a/.gitignore b/.gitignore index 9aaa16ba7..1e5202357 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,9 @@ go.work.sum # TODO_TECHDEBT: It seems that .dot files come and go so we need to figure out the root cause: https://github.com/pokt-network/poktroll/pull/177/files#r1392521547 # **/*.dot +# Load-test summary report, mentioning in gitignore to avoid accidentally committing it +summary.html + # Quickstart helpers shannon_appgate_config.yaml shannon_app_config.yaml diff --git a/Makefile b/Makefile index 025c397e1..9e1f8c40d 100644 --- a/Makefile +++ b/Makefile @@ -212,6 +212,10 @@ go_develop: proto_regen go_mockgen ## Generate protos and mocks .PHONY: go_develop_and_test go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests +.PHONY: load_test_simple +load_test_simple: ## Runs the simpliest load test through the whole stack (appgate -> relayminer -> anvil) + k6 run load-testing/tests/appGateServerEtherium.js + ############# ### TODOS ### ############# diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index dee3a5d07..3b94cb82a 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -79117,8 +79117,6 @@ definitions: description: params holds all the parameters of this module. type: object description: QueryParamsResponse is response type for the Query/Params RPC method. - poktroll.service.MsgAddServiceResponse: - type: object poktroll.tokenomics.Params: type: object properties: diff --git a/docusaurus/docs/configs/app_staking_config.md b/docusaurus/docs/configs/app_staking_config.md new file mode 100644 index 000000000..da6cff38d --- /dev/null +++ b/docusaurus/docs/configs/app_staking_config.md @@ -0,0 +1,77 @@ +--- +title: Application staking config +sidebar_position: 4 +--- + +# Application staking config + +This document describes the configuration file used by the `Application` actor +to submit a `stake`` transaction required to allow it to use the Pocket Network's +RPC services. + +- [Usage](#usage) +- [Configuration](#configuration) + - [`stake_amount`](#stake_amount) + - [`service_ids`](#service_ids) +- [Example](#example) + +## Usage + +The `stake-application` transaction submission command accepts a `--config` flag +that points to a `yaml` configuration file that defines the `stake_amount` and +`service_ids` which the `Application` is allowed to use. + +:::warning + +TestNet is not ready as of writing this documentation so you may +need to adjust the command below appropriately. + +::: + +```bash +poktrolld tx application stake-application \ + --home=./poktroll \ + --config ./stake_config.yaml \ + --keyring-backend test \ + --from application1 \ + --node tcp://poktroll-node:36657 +``` + +## Configuration + +The configuration file consists of a `stake_amount` entry denominated in `upokt` +and a `service_ids` list defining the services the `Application` is willing to +consume. + +### `stake_amount` + +_`Required`_ + +```yaml +stake_amount: upokt +``` + +Defines the amount of `upokt` to stake from the `Application` to be able to +consume the services. This amount will be transferred from the Application's +account balance and locked. It will be deducted at the end of every session +based on the Application's usage. + +### `service_ids` + +_`Required`_, _`Non-empty`_ + +```yaml +service_ids: + - +``` + +Defines the list of services the `Application` is willing to consume on the +Pocket network. Each entry in the list is a `service_id` that identifies a service +that is available on the Pocket network. + +It MUST be a string of at most 8 characters or less allowing only alphanumeric +characters, underscores, and dashes (i.e. matching the regex `^[a-zA-Z0-9_-]{1,8}$`). + +## Example + +A full example of the configuration file could be found at [application_staking_config.yaml](https://github.com/pokt-network/poktroll/tree/main/localnet/poktrolld/config/application1_stake_config.yaml) diff --git a/docusaurus/docs/configs/appgate_server_config.md b/docusaurus/docs/configs/appgate_server_config.md new file mode 100644 index 000000000..42086c157 --- /dev/null +++ b/docusaurus/docs/configs/appgate_server_config.md @@ -0,0 +1,112 @@ +--- +title: AppGateServer config +sidebar_position: 2 +--- + +# AppGateServer config + +This document describes the configuration options available for the +`AppGateServer`through the `appgate_server_config.yaml` file. + +It is responsible for multiple things: + +1. Determines how the `AppGateServer` with respect to Pocket network connectivity +2. Whether it acts as a self serving `Application` or a `Gateway` to other `Applications` +3. Configures the host(s) it listens on for incoming `RelayRequests` + +- [Usage](#usage) +- [Configuration](#configuration) + - [`query_node_rpc_url`](#query_node_rpc_url) + - [`query_node_grpc_url`](#query_node_grpc_url) + - [`self_signing`](#self_signing) + - [`signing_key`](#signing_key) + - [`listening_endpoint`](#listening_endpoint) + +## Usage + +The `AppGateServer` start command accepts a `--config` flag that points to a +configuration `.yaml` file that will be used to initialize the `AppGateServer`. + +:::warning + +TestNet is not ready as of writing this documentation so you may +need to adjust the command below appropriately. + +::: + +```bash +poktrolld appgate-server start \ + --config ./appgate_server_config.yaml \ + --keyring-backend test +``` + +## Configuration + +The `AppGateServer` configuration file is a `.yaml` file that contains the +following fields: + +```yaml +query_node_rpc_url: tcp://: +query_node_grpc_url: tcp://: +self_signing: +signing_key: +listening_endpoint: http://: +``` + +### `query_node_rpc_url` + +_`Required`_ + +The RPC URL of the Pocket node that allows the `AppGateServer` to subscribe to +on-chain CometBFT events via websockets. It is re-formatted by the SDK as +`ws://:/websocket` and establishes a persistent connection to +the Pocket Node in order to stream events such as latest blocks, and other +information such as on-chain (un)delegation events. + +### `query_node_grpc_url` + +_`Required`_ + +The gRPC URL of the Pocket node that allows the `AppGateServer` to fetch data +from the Pocket network (eg. Sessions, Accounts, Applications, etc...). + +### `self_signing` + +:::tip + +tl;dr + +- `true` -> `AppGateServer` acts as an `Application` +- `false` -> `AppGateServer` acts as a `Gateway` + +::: + +_`Optional`_ + +Indicates whether the `AppGateServer` acts as a self serving `Application` or a +`Gateway` to other `Application`s. + +If `true`, the `AppGateServer` will act as an `Application` and will only use +its own address to generate a ring-signer for signing `RelayRequest`s before +forwarding them to a `RelayMiner`. + +If `false`, the `AppGateServer` will act as a `Gateway` and will generate a +ring-signer from both its address and the `Application`'s address provided in +the request's `senderAddr` query parameter then use it to sign the `RelayRequests` +before forwarding them to a `RelayMiner`. + +### `signing_key` + +_`Required`_ + +Name of the key used to derive the public key and the corresponding address +for cryptographic rings generation used to sign `RelayRequests`. + +The key name must be present in the keyring that is specified when the +`AppGateServer` is started. + +### `listening_endpoint` + +_`Required`_ + +The endpoint that the `AppGateServer` will listen on for incoming requests. diff --git a/docusaurus/docs/configs/gateway_staking_config.md b/docusaurus/docs/configs/gateway_staking_config.md new file mode 100644 index 000000000..1db482639 --- /dev/null +++ b/docusaurus/docs/configs/gateway_staking_config.md @@ -0,0 +1,56 @@ +--- +title: Gateway staking config +sidebar_position: 5 +--- + +# Gateway staking config + +This document describes the configuration file used by the `Gateway` actor +to submit a stake transaction required to allow it to serve Pocket Network +RPC services. + +- [Usage](#usage) +- [Configuration](#configuration) + - [`stake_amount`](#stake_amount) +- [Example](#example) + +## Usage + +The `stake-gateway` transaction submission command accepts a `--config` flag +that points to a `yaml` configuration file that defines the `stake_amount` the +`Gateway` is willing to lock. + +:::warning + +TestNet is not ready as of writing this documentation so you may +need to adjust the command below appropriately. + +::: + +```bash +poktrolld tx gateway stake-gateway \ + --home=./poktroll \ + --config ./stake_config.yaml \ + --keyring-backend test \ + --from gateway1 \ + --node tcp://poktroll-node:36657 +``` + +## Configuration + +The configuration file consists of the `stake_amount` entry denominated in `upokt`. + +### `stake_amount` + +_`Required`_ + +```yaml +stake_amount: upokt +``` + +Defines the amount of `upokt` to stake by the `Gateway` to be able to serve +`RelayRequest` on the Pocket network on behalf of `Application`s. + +## Example + +A full example of the configuration file could be found at [gateway_staking_config.yaml](https://github.com/pokt-network/poktroll/tree/main/localnet/poktrolld/config/gateway1_stake_config.yaml) diff --git a/docusaurus/docs/configs/supplier_staking_config.md b/docusaurus/docs/configs/supplier_staking_config.md new file mode 100644 index 000000000..36c4020e1 --- /dev/null +++ b/docusaurus/docs/configs/supplier_staking_config.md @@ -0,0 +1,119 @@ +--- +title: Supplier staking config +sidebar_position: 3 +--- + +# Supplier staking config + +_This document describes the configuration file used by the `Supplier` to submit +a stake transaction required to provide RPC services on the Pocket Network._ + +- [Usage](#usage) +- [Configuration](#configuration) + - [`stake_amount`](#stake_amount) + - [`services`](#services) + - [`service_id`](#service_id) + - [`endpoints`](#endpoints) + - [`url`](#url) + - [`rpc_type`](#rpc_type) +- [Example](#example) + +## Usage + +The `stake-supplier` transaction submission command accepts a `--config` flag +that points to a `yaml` configuration file that defines their staking +configuration. This includes, but is not limited to things like `stake_amount`, the `service`s, their respective advertised `endpoints`, etc. + +The following is an example command of how to stake a supplier +in a LocalNet environment. + +:::warning + +TestNet is not ready as of writing this documentation so you may +need to adjust the command below appropriately. + +::: + +```bash +poktrolld tx supplier stake-supplier \ + --home=./poktroll \ + --config ./stake_config.yaml \ + --keyring-backend test \ + --from supplier1 \ + --node tcp://poktroll-node:36657 +``` + +## Configuration + +### `stake_amount` + +_`Required`_, _`Non-empty`_ + +```yaml +stake_amount: upokt +``` + +Defines the amount of `upokt` to stake for the `Supplier` account. +This amount covers all the `service`s defined in the `services` section. + +:::note + +If the `Supplier` account already has a stake and wishes to change or add +to the `service`s that it provides, then it MUST to increase the current +`stake_amount` by at least `1upokt`. + +For example, if the current stake is `1000upokt` and the `Supplier` wants to add a new `service` then `stake_amount: 1001upokt` should be specified in the configuration file. This will increase the stake by `1upokt` and deduct `1upokt` from the `Supplier`'s account balance. + +::: + +### `services` + +_`Required`_, _`Non-empty`_ + +```yaml +services: + - service_id: + endpoints: + - url: ://: + rpc_type: +``` + +`services` define the list of services that the `Supplier` wants to provide. +It takes the form of a list of `service` objects. Each `service` object +consists of a `service_id` and a list of `endpoints` that the `Supplier` will +advertise on the Pocket Network. + +#### `service_id` + +_`Required`_ + +`service_id` is a string that uniquely identifies the service that the `Supplier` +is providing. It MUST 8 characters or less and composed of alphanumeric characters, +underscores, and dashes only. + +For example, it must match the regex `^[a-zA-Z0-9_-]{1,8}$`, and spaces are disallowed. + +#### `endpoints` + +_`Required`_, _`Non-empty`_ + +`endpoints` is a list of `endpoint` objects that the `Supplier` will advertise +to the Pocket Network. Each `endpoint` object consists of an `url` and a `rpc_type`. + +##### `url` + +_`Required`_ + +`url` is a string formatted URL that defines the endpoint that MUST be reachable by +`Gateways` and `Applications` to send `RelayRequests` to. + +##### `rpc_type` + +_`Required`_ + +`rpc_type` is a string that defines the type of RPC service that the `Supplier` +is providing. The `rpc_type` MUST be one of the [supported types found here](https://github.com/pokt-network/poktroll/tree/main/pkg/relayer/config/types.go#L8) + +## Example + +A full example of the configuration file could be found at [supplier_staking_config.yaml](https://github.com/pokt-network/poktroll/tree/main/localnet/poktrolld/config/supplier1_stake_config.yaml) diff --git a/docusaurus/docs/infrastructure/testing/load_testing.md b/docusaurus/docs/infrastructure/testing/load_testing.md new file mode 100644 index 000000000..8825357d5 --- /dev/null +++ b/docusaurus/docs/infrastructure/testing/load_testing.md @@ -0,0 +1,136 @@ +--- +sidebar_position: 1 +title: Load Testing +--- + +# Load Testing + +Poktroll load-testing suite. + +- [Overview](#overview) +- [Dependencies](#dependencies) +- [How to run tests](#how-to-run-tests) + - [Common k6 CLI flags](#common-k6-cli-flags) +- [Understanding Output](#understanding-output) + - [CLI Output](#cli-output) + - [HTML Report](#html-report) + - [Adding a new load test](#adding-a-new-load-test) + - [Sophisticated Reporting](#sophisticated-reporting) +- [Troubleshooting](#troubleshooting) +- [File structure](#file-structure) + +## Overview + +We use [k6](https://k6.io/) for load testing. For detailed information about k6 internals and best practices, please refer to the [k6 documentation](https://grafana.com/docs/k6/latest/). + +## Dependencies + +- [k6](https://grafana.com/docs/k6/latest/get-started/installation/) +- (For local suite execution) [LocalNet](../localnet.md) + +## How to run tests + +Tests are stored in the [load-testing/tests](https://github.com/pokt-network/poktroll/tree/main/load-testing/tests) folder, covering various use cases. + +For instance, here's a basic load test sending requests through `AppGateServer`, which proxies them to `RelayMiner`: + +```bash +k6 run load-testing/tests/appGateServerEtherium.js +``` + +### Common k6 CLI flags + +The `k6` load testing tool provides various command-line flags to customize and control your load tests. Below are some of the key flags that you can use: + +- `--vus`: Specifies the number of virtual users (VUs) to simulate. This flag allows you to set the concurrency level of your load test. + - Example: `k6 run script.js --vus=50` runs the test with 50 virtual users. + +- `--duration`: Defines the duration for which the test should run. You can specify the time in seconds (s), minutes (m), or hours (h). + - Example: `k6 run script.js --duration=1m` runs the test for 1 minute. + +- `--http-debug`: Enables HTTP debugging. This flag can be set to `full` for detailed logging of all HTTP requests and responses. Useful for troubleshooting and debugging your tests. + - Use `--http-debug` for a summary of HTTP requests. + - Use `--http-debug=full` for detailed request and response logging. + - Example: `k6 run script.js --http-debug=full` provides a detailed log of HTTP transactions. + +The default configurations for VUs and duration are in the [config file](https://github.com/pokt-network/poktroll/tree/main/load-testing/config/index.js). Override these defaults by passing the appropriate flags to the `k6` command. For example: + +```bash +k6 run load-testing/tests/appGateServerEtherium.js --vus=300 --duration=30s +``` + +For a comprehensive list of available flags and their usage, refer to the [k6 documentation](https://grafana.com/docs/k6/latest/). + +## Understanding Output + +### CLI Output + +Post-test, basic performance metrics are available: + +``` + scenarios: (100.00%) 1 scenario, 100 max VUs, 1m30s max duration (incl. graceful stop): + * default: 100 looping VUs for 1m0s (gracefulStop: 30s) + +INFO[0061] [k6-reporter v2.3.0] Generating HTML summary report source=console + ✓ is status 200 + ✓ is successful JSON-RPC response + + checks.........................: 100.00% ✓ 12000 ✗ 0 + data_received..................: 1.6 MB 27 kB/s + data_sent......................: 1.2 MB 19 kB/s + http_req_blocked...............: avg=52.52µs min=0s med=2µs max=7.08ms p(90)=4µs p(95)=6µs + http_req_connecting............: avg=37.73µs min=0s med=0s max=5.48ms p(90)=0s p(95)=0s + http_req_duration..............: avg=8.51ms min=1.58ms med=5.98ms max=81.98ms p(90)=15.45ms p(95)=19.97ms + { expected_response:true }...: avg=8.51ms min=1.58ms med=5.98ms max=81.98ms p(90)=15.45ms p(95)=19.97ms + http_req_failed................: 0.00% ✓ 0 ✗ 6000 + http_req_receiving.............: avg=42.18µs min=5µs med=25µs max=5.71ms p(90)=65µs p(95)=125µs + http_req_sending...............: avg=26.5µs min=2µs med=9µs max=7.2ms p(90)=21µs p(95)=42µs + http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s + http_req_waiting...............: avg=8.44ms min=1.55ms med=5.93ms max=81.28ms p(90)=15.38ms p(95)=19.82ms + http_reqs......................: 6000 98.915624/s + iteration_duration.............: avg=1s min=1s med=1s max=1.08s p(90)=1.01s p(95)=1.02s + iterations.....................: 6000 98.915624/s + vus............................: 100 min=100 max=100 + +running (1m00.7s), 000/100 VUs, 6000 complete and 0 interrupted iterations +default ✓ [======================================] 100 VUs 1m0s +``` + +### HTML Report + +An HTML report is generated in the execution directory. Open it in your default browser: + +``` +open summary.html +``` + +### Adding a new load test + +TODO(@okdas): Add link to PR next time a new type of load test is added. + + +### Sophisticated Reporting + +We're developing advanced reporting that integrates additional tags set in the code. This will require time-series databases and is planned for DevNets. + +## Troubleshooting + +To debug, activate the logging feature: + +`--http-debug` or `--http-debug=full` + +## File structure + +``` +load-testing +├── README.md +├── config +│ └── index.js +├── modules # reusable code for scenarios and tests +│ └── etheriumRequests.js +├── scenarios # different scenarios for tests +│ └── requestBlockNumberEtherium.js +└── tests # test scripts + ├── anvilDirectEtherium.js + └── appGateServerEtherium.js +``` diff --git a/docusaurus/docs/infrastructure/testing/load_test_1.md b/docusaurus/docs/infrastructure/testing/load_testing_plan.md similarity index 99% rename from docusaurus/docs/infrastructure/testing/load_test_1.md rename to docusaurus/docs/infrastructure/testing/load_testing_plan.md index d01e94d3d..47c58bbe9 100644 --- a/docusaurus/docs/infrastructure/testing/load_test_1.md +++ b/docusaurus/docs/infrastructure/testing/load_testing_plan.md @@ -1,6 +1,6 @@ --- sidebar_position: 2 -title: Load Test 1 - Plan +title: Load Testing - Plan --- # Load Test #1 - Plan diff --git a/load-testing/README.md b/load-testing/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/load-testing/config/index.js b/load-testing/config/index.js new file mode 100644 index 000000000..12324d819 --- /dev/null +++ b/load-testing/config/index.js @@ -0,0 +1,66 @@ +import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js"; +import { textSummary } from "https://jslib.k6.io/k6-summary/0.0.1/index.js"; + +// Environment configuration +export const ENV_CONFIG = { + anvilBaseUrl: __ENV.ANVIL_BASE_URL || 'http://localhost:8547', + nginxBaseUrl: __ENV.NGINX_BASE_URL || 'http://localhost:8548', + AppGateServerAnvilUrl: __ENV.APP_GATE_SERVER_ANVIL_URL || 'http://localhost:42069/anvil', +}; + +// We can export this function in our tests to generate HTML summary. +export function handleSummary(data) { + return { + "summary.html": htmlReport(data), + stdout: textSummary(data, { indent: " ", enableColors: true }), + }; +} + +export const options = { + // A number specifying the number of VUs to run concurrently. + vus: 100, + // A string specifying the total duration of the test run. + duration: '60s', + + // The following section contains configuration options for execution of this + // test script in Grafana Cloud. + // + // See https://grafana.com/docs/grafana-cloud/k6/get-started/run-cloud-tests-from-the-cli/ + // to learn about authoring and running k6 test scripts in Grafana k6 Cloud. + // + // ext: { + // loadimpact: { + // // The ID of the project to which the test is assigned in the k6 Cloud UI. + // // By default tests are executed in default project. + // projectID: "", + // // The name of the test in the k6 Cloud UI. + // // Test runs with the same name will be grouped. + // name: "script.js" + // } + // }, + + // Uncomment this section to enable the use of Browser API in your tests. + // + // See https://grafana.com/docs/k6/latest/using-k6-browser/running-browser-tests/ to learn more + // about using Browser API in your test scripts. + // + // scenarios: { + // // The scenario name appears in the result summary, tags, and so on. + // // You can give the scenario any name, as long as each name in the script is unique. + // ui: { + // // Executor is a mandatory parameter for browser-based tests. + // // Shared iterations in this case tells k6 to reuse VUs to execute iterations. + // // + // // See https://grafana.com/docs/k6/latest/using-k6/scenarios/executors/ for other executor types. + // executor: 'shared-iterations', + // options: { + // browser: { + // // This is a mandatory parameter that instructs k6 to launch and + // // connect to a chromium-based browser, and use it to run UI-based + // // tests. + // type: 'chromium', + // }, + // }, + // }, + // } +}; \ No newline at end of file diff --git a/load-testing/modules/sendJsonRPCRequest.js b/load-testing/modules/sendJsonRPCRequest.js new file mode 100644 index 000000000..33f82812c --- /dev/null +++ b/load-testing/modules/sendJsonRPCRequest.js @@ -0,0 +1,39 @@ +// Import necessary modules +import http from 'k6/http'; +import { check } from 'k6'; + +// Function to send a generic JSON-RPC request to Anvil +export function sendJsonRPCRequest(baseUrl, method, params = [], tags = {}) { + const payload = JSON.stringify({ + jsonrpc: "2.0", + method: method, + params: params, + id: 1 + }); + + const requestOptions = { + headers: { + "Content-Type": "application/json", + }, + tags: tags + }; + + let response = http.post(baseUrl, payload, requestOptions); + + // Basic check for HTTP 200 OK and a valid JSON-RPC response + let passed = check(response, { + "is status 200": (r) => r.status === 200, + "is successful JSON-RPC response": (r) => { + let jsonResponse = JSON.parse(r.body); + // Check for 'result' and 'id', and ensure 'error' is not present + return jsonResponse.hasOwnProperty("result") && jsonResponse.hasOwnProperty("id") && !jsonResponse.hasOwnProperty("error"); + } + }, tags); + + if (!passed) { + // Logging output includes vital information for troubleshooting: request/response body, status code, etc. + console.log(`Request to ${response.request.url} failed:`, JSON.stringify(response, null, 2)); + } + + return response; +} diff --git a/load-testing/scenarios/requestBlockNumberEtherium.js b/load-testing/scenarios/requestBlockNumberEtherium.js new file mode 100644 index 000000000..3bc8a013e --- /dev/null +++ b/load-testing/scenarios/requestBlockNumberEtherium.js @@ -0,0 +1,26 @@ +// Import necessary modules +import { check } from 'k6'; +import { sendJsonRPCRequest } from '../modules/sendJsonRPCRequest.js'; + +export function requestBlockNumberEtheriumScenario(baseUrl) { + // Example method and parameters for the Ethereum JSON-RPC request + const method = "eth_blockNumber"; + const params = []; + + // We can populate tags in addition to the defaults. + // const tags = { + // method: method, + // baseUrl: baseUrl, + // } + + // Send request and receive response + let response = sendJsonRPCRequest(baseUrl, method, params); + + // Additional checks specific to the scenario can be written like that: + // check(response, { + // "is the response format correct": (r) => { + // let jsonResponse = JSON.parse(r.body); + // return jsonResponse.hasOwnProperty("result") && jsonResponse.hasOwnProperty("id"); + // }, + // }, tags); +} diff --git a/load-testing/tests/anvil.js b/load-testing/tests/anvil.js new file mode 100644 index 000000000..c9533ea18 --- /dev/null +++ b/load-testing/tests/anvil.js @@ -0,0 +1,17 @@ +// Our custom handleSummary produces HTML report with CLI output and some default configuration. +export { handleSummary, options } from '../config/index.js'; +import { requestBlockNumberEtheriumScenario } from '../scenarios/requestBlockNumberEtherium.js'; +import { ENV_CONFIG } from '../config/index.js'; +import { sleep } from 'k6'; + + +// The function that defines VU logic. +// +// See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more +// about authoring k6 scripts. +export default function () { + requestBlockNumberEtheriumScenario(ENV_CONFIG.anvilBaseUrl); + + // Simulate think time + sleep(1); +} \ No newline at end of file diff --git a/load-testing/tests/appGateServerEtherium.js b/load-testing/tests/appGateServerEtherium.js new file mode 100644 index 000000000..68ab4e551 --- /dev/null +++ b/load-testing/tests/appGateServerEtherium.js @@ -0,0 +1,25 @@ +// Our custom handleSummary produces HTML report with CLI output and some default configuration. +export { handleSummary, options } from '../config/index.js'; +import { requestBlockNumberEtheriumScenario } from '../scenarios/requestBlockNumberEtherium.js'; +import { ENV_CONFIG } from '../config/index.js'; +import { sleep } from 'k6'; + +// TODO(@okdas): expand options to allow multiple stages: +// export const options = { +// stages: [ +// { duration: '30s', target: 20 }, +// { duration: '1m30s', target: 10 }, +// { duration: '20s', target: 0 }, +// ], +// }; + +// The function that defines VU logic. +// +// See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more +// about authoring k6 scripts. +export default function () { + requestBlockNumberEtheriumScenario(ENV_CONFIG.AppGateServerAnvilUrl); + + // Simulate think time + sleep(1); +} \ No newline at end of file diff --git a/pkg/appgateserver/server.go b/pkg/appgateserver/server.go index f6c84a76a..6c3494a06 100644 --- a/pkg/appgateserver/server.go +++ b/pkg/appgateserver/server.go @@ -105,6 +105,8 @@ func NewAppGateServer( app.signingInformation.AppAddress = appAddress.String() } + // TODO_CONSIDERATION: Use app.listeningEndpoint scheme to determine which + // kind of server to create (HTTP, HTTPS, TCP, UNIX, etc...) app.server = &http.Server{Addr: app.listeningEndpoint.Host} return app, nil diff --git a/summary.html b/summary.html deleted file mode 100644 index 872958434..000000000 --- a/summary.html +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - - - - - - - K6 Load Test: 2023-12-19 00:37 - - - - -

- -   K6 Load Test: 2023-12-19 00:37 -

- -
-
- -

Total Requests

-
6000
-
-
- -
- -

Failed Requests

-
0
-
- -
- -

Breached Thresholds

-
0
-
-
- -

Failed Checks

-
12
-
-
- -
- -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CountRateAverageMaximumMedianMinimum90th Percentile95th Percentile
http_req_duration--26.29243.4422.211.0355.2584.69
http_req_waiting--26.23243.3322.181.0155.2184.63
http_req_connecting--0.073.74----
http_req_tls_handshaking--------
http_req_sending--0.023.030.010.000.030.04
http_req_receiving--0.044.540.030.010.060.08
http_req_blocked--0.095.160.00-0.010.01
iteration_duration--2054.652291.262040.872021.952089.462146.68
-
- - - - -
- - -    Note. All times are in milli-seconds -
- - - - -
-
- -
-

Checks

- -
Passed
11988
-
Failed
12
-
- - - -
-

Iterations

- -
Total
3000
-
Rate
48.53/s
-
- - -
-

Virtual Users

- -
Min
100
-
Max
100
-
-
- -
-
-

Requests

- -
Total
6000
-
Rate
97.06/s
-
- -
-

Data Received

- -
Total
1.29 MB
-
Rate
0.02 mB/s
-
- -
-

Data Sent

- -
Total
1.19 MB
-
Rate
0.02 mB/s
-
-
-
- - - - -
- - - -

• Other Checks

- - - - - - - - - - - - - - - - - -
Check NamePassesFailures
is status 20060000
is the response format correct598812
-
- -
- - -