|
| 1 | +# Iapyx Load |
| 2 | + |
| 3 | +Iapyx-load is a load cli & api project which operates on catalyst backend. |
| 4 | + |
| 5 | +## Build & Install |
| 6 | + |
| 7 | +In order to build iapyx-load in main project folder run: |
| 8 | +``` |
| 9 | +cd testing/iapyx |
| 10 | +cargo build |
| 11 | +cargo install --path . --force |
| 12 | +``` |
| 13 | + |
| 14 | +## Quick Start |
| 15 | + |
| 16 | +### CLI |
| 17 | + |
| 18 | +Iapyx-load can be used as a cli. It is capable of putting various load on catalyst backend. |
| 19 | +Available load types: |
| 20 | + |
| 21 | +* node-only - Load which targets blockchain calls only |
| 22 | +* static-only - Load which targets static data only |
| 23 | +* simulation - Load with simulate real user case (both blockchain and static data in some relation) |
| 24 | + |
| 25 | +Also `node-only` load provides two load characteristic: |
| 26 | +* bursts - Bursts mode. Sends votes in batches and then wait x seconds |
| 27 | +* const - Constant load. Sends votes with x votes per second speed |
| 28 | + |
| 29 | +And two scenario types: |
| 30 | +* duration - Duration based load. Defines how much time load should run |
| 31 | +* count - Requests count based load. Defines how many requests load should sent in total |
| 32 | + |
| 33 | +Simplest load configuration is to use node-only load with below parameters: |
| 34 | + |
| 35 | +`iapyx-load node-only const count --help` |
| 36 | + |
| 37 | +``` |
| 38 | +USAGE: |
| 39 | + iapyx-load.exe node-only const count [FLAGS] [OPTIONS] --requests-per-thread <count> |
| 40 | +
|
| 41 | +FLAGS: |
| 42 | + --debug Print additional information |
| 43 | + --help Prints help information |
| 44 | + --read-from-filename Read pin from filename of each qr code |
| 45 | + --reuse-accounts-early Update all accounts state before sending any vote |
| 46 | + --reuse-accounts-lazy Update account state just before sending vote |
| 47 | + -h, --https Use https for sending fragments |
| 48 | + -V, --version Prints version information |
| 49 | +
|
| 50 | +OPTIONS: |
| 51 | + -a, --address <address> Address in format: 127.0.0.1:8000 [default: 127.0.0.1:8000] |
| 52 | + -n, --requests-per-thread <count> How many requests per thread should be sent |
| 53 | + -c, --criterion <criterion> Pass criteria |
| 54 | + -d, --delay <delay> Amount of delay [miliseconds] between requests [default: 10000] |
| 55 | + --global-pin <global-pin> Global pin for all qr codes [default: 1234] |
| 56 | + -b, --progress-bar-mode <progress-bar-mode> |
| 57 | + Show progress. Available are (Monitor,Standard,None) [default: Monitor] |
| 58 | +
|
| 59 | + -q, --qr-codes-folder <qr-codes-folder> Qr codes source folder |
| 60 | + -s, --secrets-folder <secrets-folder> Secrets source folder |
| 61 | + --status-pace <status-pace> How frequent (in seconds) to print status [default: 1] |
| 62 | + -t, --threads <threads> Prints nodes related data, like stats,fragments etc [default: 3] |
| 63 | +``` |
| 64 | + |
| 65 | +### API |
| 66 | + |
| 67 | +Iapyx load main purpose is to serve as load api: |
| 68 | + |
| 69 | +``` |
| 70 | +use iapyx::{NodeLoad, NodeLoadConfig}; |
| 71 | +use jortestkit::{ |
| 72 | + load::{ConfigurationBuilder, Monitor}, |
| 73 | + measurement::Status, |
| 74 | +}; |
| 75 | +
|
| 76 | +... |
| 77 | +
|
| 78 | + let no_of_threads = 10; |
| 79 | + let no_of_wallets = 40_000; |
| 80 | + |
| 81 | + let mut qr_codes_folder = Path::new("qr-codes"); |
| 82 | +
|
| 83 | + let config = ConfigurationBuilder::duration(parameters.calculate_vote_duration()) |
| 84 | + .thread_no(threads_no) |
| 85 | + .step_delay(Duration::from_millis(delay)) |
| 86 | + .fetch_limit(250) |
| 87 | + .monitor(Monitor::Progress(100)) |
| 88 | + .shutdown_grace_period(Duration::from_secs(60)) |
| 89 | + .build(); |
| 90 | +
|
| 91 | + let load_config = NodeLoadConfig { |
| 92 | + batch_size, |
| 93 | + use_v1: false, |
| 94 | + config, |
| 95 | + criterion: Some(100), |
| 96 | + address: "127.0.0.1:8080".to_string(), |
| 97 | + qr_codes_folder: Some(qr_codes_folder), |
| 98 | + secrets_folder: None, |
| 99 | + global_pin: "".to_string(), |
| 100 | + reuse_accounts_lazy: false, |
| 101 | + reuse_accounts_early: false, |
| 102 | + read_pin_from_filename: true, |
| 103 | + use_https: false, |
| 104 | + debug: false, |
| 105 | + }; |
| 106 | +
|
| 107 | + let iapyx_load = NodeLoad::new(load_config); |
| 108 | + if let Some(benchmark) = iapyx_load.start().unwrap() { |
| 109 | + assert!(benchmark.status() == Status::Green, "too low efficiency"); |
| 110 | + } |
| 111 | +
|
| 112 | +``` |
| 113 | + |
| 114 | +### full list of available commands |
| 115 | + |
| 116 | +Full list of commands is available on `mjolnir --help` command. |
| 117 | + |
| 118 | +``` |
| 119 | +mjolnir 0.1.0 |
| 120 | +Jormungandr Load CLI toolkit |
| 121 | +
|
| 122 | +USAGE: |
| 123 | + mjolnir.exe [FLAGS] [SUBCOMMAND] |
| 124 | +
|
| 125 | +FLAGS: |
| 126 | + --full-version display full version details (software version, source version, targets and compiler used) |
| 127 | + -h, --help Prints help information |
| 128 | + --source-version display the sources version, allowing to check the source's hash used to compile this |
| 129 | + executable. this option is useful for scripting retrieving the logs of the version of this |
| 130 | + application |
| 131 | + -V, --version Prints version information |
| 132 | +
|
| 133 | +SUBCOMMANDS: |
| 134 | + explorer Explorer load |
| 135 | + fragment Fragment load |
| 136 | + help Prints this message or the help of the given subcommand(s) |
| 137 | + passive Passive Nodes bootstrap |
| 138 | + rest Rest load |
| 139 | +``` |
0 commit comments