diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..21e5ef9 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{ email }}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/Makefile b/Makefile index a846dd0..767c78b 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,3 @@ -args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}` - -CONFIG_FILE= - - - -build-docker: build-docker-lbot build-docker-agent - -build-docker-lbot: - docker build -t lbot -f docker/Dockerfile.lbot . -build-docker-agent: - docker build -t lbot-agent -f docker/Dockerfile.agent . build-dev: # only your platform @@ -19,18 +7,4 @@ build-all: # only your platform goreleaser build --snapshot --clean -run-docker-lbot: - @docker run --net=host -t --rm lbot $(call args,) -run-docker-lbot-config: - docker run --net=host -i --rm lbot config --stdin < $(CONFIG_FILE) - -run-docker-agent: - docker run -p 1234:1234 -t --rm lbot-agent - - -NEXT_VERSION=$(shell svu next) -release: - git tag -a $(NEXT_VERSION) -m "Release $(NEXT_VERSION)" - - -.PHONY: build-docker build-docker-agent build-docker-lbot run-docker-lbot run-docker-agent +.PHONY: build-dev build-all diff --git a/README.md b/README.md index f1f3098..27600d3 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,57 @@ -# lbot - workload database driver (currently supporting only MongoDB) +# loadbot ## Introduction -The purpose of this tool is to simulate workloads to facilitate testing the failover capabilities of database cluster under load. This code, being an open-source project, is in its early development stage and likely contains various bugs. +Loadbot is a workload driver designed to simulate heavy loads on systems for performance testing and benchmarking purposes. It allows users to generate various types of workloads to stress-test their systems under different scenarios. -## How to use: -1. Build image - `make build-docker` -2. Run agent - `make run-docker-agent` -3. Configure agent by running lbot config command - `make run-docker-lbot-config CONFIG_FILE="_config.json"` -4. Run workload tests - `make run-docker-lbot start` +This code, being an open-source project, is in its early development stage and likely contains various bugs. We welcome contributions from the community to help improve loadbot, make it more robust and reliable, and introduce new features. -> Note: If running with local db remember to use host network and configure connection_string to 127.0.0.1 `docker run --network="host" --rm -t mload < config_file.json` or check Makefile -This tool offers two ways to access it: one through CLI arguments and the other via a configuration file. Utilizing the configuration file provides additional functionalities for the tool. +## How to Install + +Using Homebrew (MacOS/Linux)💡 + +```bash +brew tap kuzxnia/loadbot +brew install loadbot +``` + +Alternatively, you can install **loadbot** from sources or run it directly in a Docker container. For more information on these installation methods, please refer to the [documentation](https://kuzxnia.github.io/getting_started/install/). + + +## Getting started +After installing loadbot, you can quickly get started by following these steps: -### CLI usage: - A command-line database workload +1. Run LoadBot agent with your desired configuration using the command: +```bash +loadbot start-agent -f config_file.json +``` - Usage: - lbot [command] +2. Start the workload using the LoadBot client: +```bash +loadbot start +``` - Driver Commands: - config Config - start Start stress test - stop Stop stress test +3. Monitor the progress of the workload using the command: +```bash +loadbot progress +``` - Additional Commands: - completion Generate the autocompletion script for the specified shell - help Help about any command +4. To stop the workload, use the following command: +```bash +loadbot stop +``` - Flags: - -u, --agent-uri string loadbot agent uri (default: 127.0.0.1:1234) - -h, --help help for lbot - -v, --version version for lbot +For more information and detailed instructions, please refer to the [quick start guide](https://kuzxnia.github.io/getting_started/quick-start/). - Use "lbot [command] --help" for more information about a command. + +## Documentation +For detailed documentation on how to use loadbot and its available features, please refer to the [official documentation](https://kuzxnia.github.io/loadbot/). + + +> Note: If running with local db remember to use host network and configure connection_string to 127.0.0.1 `docker run --network="host" --rm -t mload < config_file.json` or check Makefile + +This tool offers two ways to access it: one through CLI arguments and the other via a configuration file. Utilizing the configuration file provides additional functionalities for the tool. Known issue: diff --git a/docs/USAGE.md b/docs/USAGE.md deleted file mode 100644 index c8a8c87..0000000 --- a/docs/USAGE.md +++ /dev/null @@ -1,328 +0,0 @@ - - -### Configuration file: -Due to the limited functionalities of the CLI, in order to fully harness the capabilities of this tool, it is advisable to utilize a configuration file. The program can be executed by specifying the configuration file with: -1. stdin with binary `cat config_file.json | mload` or stdin with docker `docker run mload -t mload < config_file.json` -2. flag with `--config-file ` or `-f `. - -> Note: If you want to use config file with docker you need to mount volume with file or copy when building image. - -Example file: - -```json -{ - "connection_string": "mongodb://localhost:27017", - "debug": true, - "jobs": [ - { - "name": "Write 100c 1k ops", - "type": "write", - "schema": "user_schema", - "connections": 100, - "operations": 1000, - }, - { - "name": "Dummy job name/ read 30s 100rps", - "type": "read", - "schema": "user_schema", - "connections": 100, - "pace": 100, - "duration": "30s", - "filter": { - "special_name": "#special_name" - } - } - ], - "schemas": [ - { - "name": "user_schema", - "database": "load_test", - "collection": "load_test", - "schema": { - "_id": "#_id", - "special_name": "#string", - "lastname": "#string" - }, - "save": [ - "special_name" // will be avaliable in job.filter under "#special_name" - ] - }, - ], - "reporting_formats": [ - { - "name": "simple", - "interval": "5s", - "template": "Job: {{.JobType}}, total reqs: {{.TotalReqs}}, RPS {{f2 .Rps}} success: {{.SuccessReqs}}\n\n" - } - ] -} -``` -
-Defining schemas - -
- -**Schema fields** - -- `name` - unique name, used in jobs (see job.schema) for determining which template use -- `database` - database name -- `collection` - collection name -- `schema` - actual document template - -**Schema document template fields:** - -General -- `#id` -- `#string` -- `#word` - -Internet -- `#email` -- `#username` -- `#password` - -Person -- `#name` -- `#first_name` -- `#first_name_male` -- `#first_name_female` -- `#last_name` -- `#title_male` -- `#title_female` -- `#phone_number` - -**More examples** - -
- -
-Defining Jobs - -
- -**Example write with schema 100ops** - -```json -{ - "name": "insert with schema", - "type": "write", - "schema": "user_schema", - "connections": 10, - "operations": 100 -} -``` - -**Write without schema 20s** - -```json -{ - "name": "insert without schema", - "type": "write", - "database": "load_test", - "collection": "load_test", - "connections": 10, - "data_size": 100, - "duration": "20s", - "timeout": "1s" -} -``` - -**Read with schema 20s** - -```json -{ - "name": "read with schema", - "type": "read", - "schema": "user_schema", - "connections": 10, - "operations": 100, - "filter": { - "user_name": "#user_name", - "name": "#generate_value" // here you can use remember/saved value as well as generated one - } -} -``` - -**Let the database rest** - -```json -{ - "type": "sleep", - "duration": "5s" -} -``` - -**Drop collection** - -```json -{ - "type": "drop_collection", - "database": "load_test", - "collection": "load_test", - "operations": 1 -} -``` -or with schema -```json -{ - "type": "drop_collection", - "schema": "example_schema", - "operations": 1 -} -``` - -**Jobs fields:** - -* `name`(string, optional) - job name -* `type`(enum `write|bulk_write|read|update|create_index|drop_collection|sleep`) - operation type -* `template`(string) - schema name, if you will not provide schema data will be inserted in `{'data': }` format -* `database`(string, required if schema is not set) - database name -* `schema`(string, optional) - string foreign-key to schemas list -* `filter`(string, required for read and update) - filter schema -* `indexes`(list, optional) - list of indexes to create (only for type "create_index") -* `format`(string, optional) - string foreign-key to reporting_formats list -* `collection`(string, required if schema is not set) - collection name -* `connection`(unsigned int) - number of concurrent connections, number is not limited to physical threads number -* `data_size`(unsigned int) - data size inserted (currently only works for default schema) -* `batch_size`(unsigned int) - insert batch size (only applicable for `bulk_write` job type) -* `duration`(string) - duration time ex. 1h, 15m, 10s -* `operations`(unsigned int) - number of requests to perform, ex. 100 reads, 100 bulk_writes -* `timeout`(string) - connection timeout ex. 1h, 15m, 10s - -
- -
-Custom reporting format - -
- -By default, you have access to several available output formats: `default`, `simple`, `write`, and `bulk_write`. If you do not provide the 'default' format, the default format associated with the type will be utilized. Moreover, you have the flexibility to override all formats except for the `default` one. - -**default** - -``` -2023/08/12 15:10:44 Job: "lovely job name" -Reqs: 7500, RPS 500.00, s:7500/err:0/tout:0/errRate:0.0% -AVG: 1.395ms P50: 0.484ms, P90: 0.703ms P99: 8.048ms -``` - -**simple** - -``` -2023/08/12 17:28:47 Reqs: 2592, RPS 500.05 s:2592/err:0 -``` - -**write** - -``` -2023/08/12 17:28:52 Reqs: 2595, RPS 499.91, s:2595/err:0/tout:0/errRate:0.0% -AVG: 1.987ms P50: 0.989ms, P90: 1.634ms P99: 34.556ms - -``` - -**bulk_write** - -``` -2023/08/12 17:28:57 Reqs: 2590, OPS: 259000, RPS 499.50, OPS 49949.52, s:2590/err0/tout:0/errRate:0.0 -AVG: 6.867ms P50: 3.814ms, P90: 6.786ms P99: 79.938ms -``` - -**Example custom reporting format** - -```json -{ - "name": "custom", - "interval": "5s", - "template": "{{.Now}} Job: {{.JobType}}, total reqs: {{.TotalReqs}}, RPS {{f2 .Rps}} success: {{.SuccessReqs}}\n\n" -} -``` -- `name` - used to determine which template to use (see section job.format) -- `interval` - if set, tests reports/summaries will be displayed at set time intervals -- `template` - report format - - -**Template fields** - -`Now`, `JobName`, `JobType`, `JobBatchSize`,`SuccessReqs`, `ErrorReqs`, `TotalReqs`, `TotalOps`, `TimeoutErr`, `NoDataErr`, `OtherErr`, `ErrorRate`, `Rps`, `Ops` - -**Math fields** - -`Min`, `Max`, `Avg`, `Rps` and `P` ex. `P90` - percentiles - -**Floating point fields formatters** - -`f` - format number to n places (1 to 4) ex. `{{f2 .Rps}}` - -`msf` - format number to n places (1 to 4) and convert to milliseconds ex. `{{msf2 .P99}}` - - -
- -
-More examples - -
- -- Index creation job -```json -{ - "type": "create_index", - "template": "default", - "indexes": [ - { - "keys": { "name": 1 }, - "options": { "unique": false, "name": "dummy_name_index_name" }, - } - ] -} -``` -or without using schema -```json -{ - "type": "create_index", - "database": "load_test", - "collection": "load_test", - "operations": 1, - "indexes": [ - { - "keys": {"name": 1}, - } - ] -} -``` - -
- -
-Other features - -
- -**Features** - -- JSON standardization - comments and trailing commas support ex. -```json -{ - "jobs": [ - { - "type": "drop_collection", - "database": "load_test", - "collection": "load_test", - "operations": 1 - }, - /*{ - "type": "sleep", - "duration": "5s", - "format": "simple" - },*/ - ] -} -``` - - -
- -> Note: -> If you don't provide the requests amount or duration limit program will continue running -> indefinitely unless it is manually stopped by pressing `ctrl-c`. - diff --git a/docs/cli/lbot-agent.md b/docs/cli/lbot-agent.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/cli/lbot.md b/docs/cli/lbot.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/cli/loadbot.md b/docs/cli/loadbot.md new file mode 100644 index 0000000..85e85ea --- /dev/null +++ b/docs/cli/loadbot.md @@ -0,0 +1,5 @@ +--- +hide: + - navigation +--- + diff --git a/docs/contributing/bug_reporting.md b/docs/contributing/bug_reporting.md new file mode 100644 index 0000000..4ce495b --- /dev/null +++ b/docs/contributing/bug_reporting.md @@ -0,0 +1,18 @@ +# Reporting a Bug + +If you encounter any bugs or issues while using loadbot, we encourage you to report them so that we can address them promptly. Here's how you can report a bug effectively: + +1. **Check Existing Issues**: Before reporting a new bug, please check the existing issues on the [GitHub issue tracker](https://github.com/kuzxnia/loadbot/issues) to see if the bug has already been reported by someone else. + +2. **Provide Details**: When reporting a bug, provide as much detail as possible about the issue you're experiencing. Include information such as: + - Steps to reproduce the bug + - Any error messages or logs you encountered + - Your operating system and loadbot version + - loadbot version: You can find this information by running `loadbot -v` in your terminal. + - System version: Include information about your operating system version (e.g., macOS 10.15.7, Ubuntu 20.04). + +3. **Create a New Issue**: If you couldn't find an existing issue that matches your problem, create a new issue on the GitHub issue tracker. Be sure to give your issue a clear and descriptive title and include all relevant information in the description. + +4. **Follow Up**: Once you've reported the bug, feel free to follow up on the issue thread if you have additional information or if there are any updates on the bug. + +By following these steps, you'll help us identify and address bugs in loadbot more efficiently, improving the overall quality of the tool for everyone. diff --git a/docs/contributing/code_of_conduct.md b/docs/contributing/code_of_conduct.md new file mode 100644 index 0000000..01f2ea2 --- /dev/null +++ b/docs/contributing/code_of_conduct.md @@ -0,0 +1 @@ +--8<-- "CODE_OF_CONDUCT.md" diff --git a/docs/contributing/development.md b/docs/contributing/development.md new file mode 100644 index 0000000..ad90208 --- /dev/null +++ b/docs/contributing/development.md @@ -0,0 +1,13 @@ + +# Development + +If you're interested in contributing to the development of loadbot, here are a few things you'll need to set up: + +1. Install Golang: loadbot is written in Go, so you'll need to have Go installed on your system. You can download and install it from the [official Go website](https://golang.org/dl/). + +2. Install GoReleaser: GoReleaser is used for releasing Go projects. You can install it using Go itself: + ```bash + go install github.com/goreleaser/goreleaser@latest + ``` + +This section outlines the basic requirements for setting up your development environment for loadbot. Feel free to add more details or specific instructions as needed. diff --git a/docs/contributing/known_issues.md b/docs/contributing/known_issues.md new file mode 100644 index 0000000..bb01573 --- /dev/null +++ b/docs/contributing/known_issues.md @@ -0,0 +1,6 @@ + + + +* srv not working with some DNS servers - golng 1.13+ issue see [this](https://github.com/golang/go/issues/37362) and [this](https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#hdr-Potential_DNS_Issues) + + > Old versions of kube-dns and the native DNS resolver (systemd-resolver) on Ubuntu 18.04 are known to be non-compliant in this manner. diff --git a/docs/contributing/license.md b/docs/contributing/license.md new file mode 100644 index 0000000..f409d45 --- /dev/null +++ b/docs/contributing/license.md @@ -0,0 +1 @@ +--8<-- "LICENSE" diff --git a/docs/getting_started/how-it-works.md b/docs/getting_started/how-it-works.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/getting_started/install.md b/docs/getting_started/install.md index bf9a030..1f75193 100644 --- a/docs/getting_started/install.md +++ b/docs/getting_started/install.md @@ -7,7 +7,6 @@ brew tap kuzxnia/loadbot brew install loadbot ``` - ## Running directly in Docker container Alternatively, you can use the @@ -17,7 +16,6 @@ that come with the `loadbot` binary pre-installed: docker run --rm kuzxnia/loadbot --help ``` - ## By downloading the binaries (MacOS/Linux) 1. Go to the [releases](https://github.com/kuzxnia/loadbot/releases) and download diff --git a/docs/getting_started/intro.md b/docs/getting_started/intro.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/getting_started/quick-start.md b/docs/getting_started/quick-start.md index e69de29..e9a0dc1 100644 --- a/docs/getting_started/quick-start.md +++ b/docs/getting_started/quick-start.md @@ -0,0 +1,97 @@ + +After installing loadbot, you can quickly get started by following these steps: + +1. Run loadbot agent with your desired configuration using the command: +```bash +loadbot start-agent -f config_file.json +``` + +2. Start the workload using the loadbot client: +```bash +loadbot start +``` + +3. Monitor the progress of the workload using the command: +```bash +loadbot progress +``` + +4. To stop the workload, use the following command: +```bash +loadbot stop +``` + +### Example config file + +For more information on defining [jobs](https://kuzxnia.github.io/loadbot/loadbot/setup/job/) and [schemas](https://kuzxnia.github.io/loadbot/loadbot/setup/schema/), visit the [configuration](https://kuzxnia.github.io/loadbot/loadbot/setup/) section of the documentation. + +```json +{ + "connection_string": "mongodb://myadmin:abc123@127.0.0.1:27017", + "jobs": [ + { // start on empty collection - fresh start + "type": "drop_collection", + "database": "tmp-kuzxnia-showcase-db", + "collection": "tmp-kuzxnia-showcase-col", + "operations": 1 + }, + { + "name": "Workload 20s max throughput", + "type": "write", + "database": "tmp-kuzxnia-showcase-db", + "collection": "tmp-kuzxnia-showcase-col", + "data_size": 200, + "connections": 100, + "duration": "20s", + }, + { // gile little rest to db + "type": "sleep", + "duration": "5s", + "format": "simple" + }, + { + "name": "Workload 1_000_000 elements with pace 10K rps", + "type": "write", + "batch_size": 100, + "database": "tmp-kuzxnia-showcase-db", + "collection": "tmp-kuzxnia-showcase-col", + "data_size": 100, + "connections": 200, + "pace": 10000, + "operations": 1000000, + } +} + +``` + +### CLI usage + +``` +$ loadbot +A command-line database workload driver + +Usage: + lbot [command] + +Agent Commands: + start-agent Start lbot-agent + +Driver Commands: + config Config + progress Watch stress test + start Start stress test + stop Stopping stress test + +Additional Commands: + completion Generate the autocompletion script for the specified shell + help Help about any command + +Flags: + -u, --agent-uri string loadbot agent uri (default: 127.0.0.1:1234) (default "127.0.0.1:1234") + -h, --help help for lbot + --log-format string log format, must be one of: json, fancy (default "fancy") + --log-level string log level, must be one of: trace, debug, info, warn, error, fatal, panic (default "info") + -v, --version version for lbot + +Use "lbot [command] --help" for more information about a command. +``` diff --git a/docs/index.md b/docs/index.md index 612c7a5..7eab323 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1 +1,6 @@ +--- +hide: + - navigation + - toc +--- --8<-- "README.md" diff --git a/docs/setup/index.md b/docs/setup/index.md index e69de29..e29c9c3 100644 --- a/docs/setup/index.md +++ b/docs/setup/index.md @@ -0,0 +1,56 @@ +# Configuration file + +Due to the limited functionalities of the CLI, in order to fully harness the capabilities of this tool, it is advisable to utilize a configuration file. + +> Note: If you want to use config file with docker you need to mount volume with config file. + +Example file: + +```json +{ + "connection_string": "mongodb://localhost:27017", + "debug": true, + "jobs": [ + { + "name": "Write 100c 1k ops", + "type": "write", + "schema": "user_schema", + "connections": 100, + "operations": 1000, + }, + { + "name": "Dummy job name/ read 30s 100rps", + "type": "read", + "schema": "user_schema", + "connections": 100, + "pace": 100, + "duration": "30s", + "filter": { + "special_name": "#special_name" + } + } + ], + "schemas": [ + { + "name": "user_schema", + "database": "load_test", + "collection": "load_test", + "schema": { + "_id": "#_id", + "special_name": "#string", + "lastname": "#string" + }, + "save": [ + "special_name" // will be avaliable in job.filter under "#special_name" + ] + }, + ], + "reporting_formats": [ + { + "name": "simple", + "interval": "5s", + "template": "Job: {{.JobType}}, total reqs: {{.TotalReqs}}, RPS {{f2 .Rps}} success: {{.SuccessReqs}}\n\n" + } + ] +} +``` diff --git a/docs/setup/job.md b/docs/setup/job.md index e69de29..b678ad4 100644 --- a/docs/setup/job.md +++ b/docs/setup/job.md @@ -0,0 +1,91 @@ + +### Jobs fields: + +- `name`(string, optional) - job name +- `type`(enum `write|bulk_write|read|update|create_index|drop_collection|sleep`) - operation type +- `template`(string) - schema name, if you will not provide schema data will be inserted in `{'data': }` format +- `database`(string, required if schema is not set) - database name +- `schema`(string, optional) - string foreign-key to schemas list +- `filter`(string, required for read and update) - filter schema +- `indexes`(list, optional) - list of indexes to create (only for type "create_index") +- `format`(string, optional) - string foreign-key to reporting_formats list +- `collection`(string, required if schema is not set) - collection name +- `connection`(unsigned int) - number of concurrent connections, number is not limited to physical threads number +- `data_size`(unsigned int) - data size inserted (currently only works for default schema) +- `batch_size`(unsigned int) - insert batch size (only applicable for `bulk_write` job type) +- `duration`(string) - duration time ex. 1h, 15m, 10s +- `operations`(unsigned int) - number of requests to perform, ex. 100 reads, 100 bulk_writes +- `timeout`(string) - connection timeout ex. 1h, 15m, 10s + + +### Defining Jobs +Example write with schema 100ops + +```json +{ + "name": "insert with schema", + "type": "write", + "schema": "user_schema", + "connections": 10, + "operations": 100 +} +``` + +### Write without schema 20s + +```json +{ + "name": "insert without schema", + "type": "write", + "database": "load_test", + "collection": "load_test", + "connections": 10, + "data_size": 100, + "duration": "20s", + "timeout": "1s" +} +``` + +### Read with schema 20s + +```json +{ + "name": "read with schema", + "type": "read", + "schema": "user_schema", + "connections": 10, + "operations": 100, + "filter": { + "user_name": "#user_name", + "name": "#generate_value" // here you can use remember/saved value as well as generated one + } +} +``` + +### Let the database rest + +```json +{ + "type": "sleep", + "duration": "5s" +} +``` + +### Drop collection + +```json +{ + "type": "drop_collection", + "database": "load_test", + "collection": "load_test", + "operations": 1 +} +``` +or with schema +```json +{ + "type": "drop_collection", + "schema": "example_schema", + "operations": 1 +} +``` diff --git a/docs/setup/other.md b/docs/setup/other.md new file mode 100644 index 0000000..30ef079 --- /dev/null +++ b/docs/setup/other.md @@ -0,0 +1,25 @@ +# Other features + +- JSON standardization - comments and trailing commas support ex. +```json +{ + "jobs": [ + { + "type": "drop_collection", + "database": "load_test", + "collection": "load_test", + "operations": 1 + }, + /*{ + "type": "sleep", + "duration": "5s", + "format": "simple" + },*/ + ] +} +``` + +> Note: +> If you don't provide the requests amount or duration limit program will continue running +> indefinitely unless it is manually stopped by pressing `ctrl-c`. + diff --git a/docs/setup/schema.md b/docs/setup/schema.md new file mode 100644 index 0000000..588ca22 --- /dev/null +++ b/docs/setup/schema.md @@ -0,0 +1,32 @@ + +# Defining schemas + + +### Schema fields + +- `name` - unique name, used in jobs (see job.schema) for determining which template use +- `database` - database name +- `collection` - collection name +- `schema` - actual document template + +### Schema document template fields + +General +- `#id` +- `#string` +- `#word` + +Internet +- `#email` +- `#username` +- `#password` + +Person +- `#name` +- `#first_name` +- `#first_name_male` +- `#first_name_female` +- `#last_name` +- `#title_male` +- `#title_female` +- `#phone_number` diff --git a/mkdocs.yaml b/mkdocs.yaml index f979045..1c62864 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -1,5 +1,5 @@ site_name: loadbot -# site_url: "https://loadbot.github.com" +site_url: "https://kuzxnia.github.io/loadbot/" site_description: "Workload database driver" repo_url: "https://github.com/kuzxnia/loadbot" repo_name: "kuzxnia/loadbot" @@ -19,6 +19,7 @@ theme: - navigation.instant - navigation.tracking - navigation.tabs + - toc.integrate palette: - scheme: slate primary: teal @@ -40,28 +41,28 @@ theme: nav: - Home: - # showcase and redirect to getting started - index.md - Getting Started: - - Intro: getting_started/intro.md + # - Intro: getting_started/intro.md - Install Guide: getting_started/install.md - Quick Start: getting_started/quick-start.md - - How it works: getting_started/how-it-works.md + # - How it works: getting_started/how-it-works.md + + # - Command Line Usage: + # - cli/loadbot.md - Setup: - - Configuration file: setup/index.md + - setup/index.md - Jobs: setup/job.md - - Schemas: setup/job.md - - Reporting formats: setup/job.md - # workloads / defining jobs / configuration - # examples + - Schemas: setup/schema.md + - Other features: setup/other.md - # introduction - - Command Line Usage: - # agent and cli - # descriptive description of both cli's - - lbot: cli/lbot.md - - lbot-agent: cli/lbot-agent.md + - Contributing: + - Development: contributing/development.md + - Code of conduct: contributing/code_of_conduct.md + - License: contributing/license.md + - How to report a bug: contributing/bug_reporting.md + - Known issues: contributing/known_issues.md markdown_extensions: