{"id":20956285,"url":"https://github.com/moxious/graph-workload","last_synced_at":"2025-05-14T05:31:34.502Z","repository":{"id":42356372,"uuid":"170564733","full_name":"moxious/graph-workload","owner":"moxious","description":"Generate workloads for Neo4j via Bolt and Cypher","archived":false,"fork":false,"pushed_at":"2023-01-06T07:38:08.000Z","size":387,"stargazers_count":14,"open_issues_count":9,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-09-16T11:07:46.771Z","etag":null,"topics":["bolt","cypher","load-testing","neo4j","workload"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moxious.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-13T19:16:40.000Z","updated_at":"2023-09-16T11:07:46.771Z","dependencies_parsed_at":"2023-02-05T15:46:03.517Z","dependency_job_id":null,"html_url":"https://github.com/moxious/graph-workload","commit_stats":null,"previous_names":[],"tags_count":6,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fgraph-workload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fgraph-workload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fgraph-workload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moxious%2Fgraph-workload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moxious","download_url":"https://codeload.github.com/moxious/graph-workload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225276894,"owners_count":17448591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bolt","cypher","load-testing","neo4j","workload"],"created_at":"2024-11-19T01:25:14.434Z","updated_at":"2024-11-19T01:25:15.097Z","avatar_url":"https://github.com/moxious.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Graph Workloads\n\n[![CircleCI](https://circleci.com/gh/moxious/graph-workload.svg?style=svg)](https://circleci.com/gh/moxious/graph-workload)\n\nTools for generating workloads on Neo4j.\n\nI use this for benchmarking and load testing Neo4j instances.  It provides a framework where you \ncan either design your own mixed read/write workload from strategies provided, or design your own\nreads/writes to execute against a database, while keeping track of execution stats.\n\nYou can run workloads timed (i.e. for 5,000 ms) or numbered (i.e. 5,000 runs).  \n\n# Usage\n\n```\nUsage: run-workload.js -p password\n   [-a address]\n   [-u username]\n   [-n hits] how many total queries to run\n   [--ms milliseconds] how many milliseconds to test for\n   [--workload /path/to/workload.json] probability table spec\n   [--query CYPHER_QUERY] single cypher query to run\n   [--schema /path/to/schema.json] schema for generated records (only used with\n   --query)\n   [--batchsize [1000]] number of records from schema to generate per batch\n   [--concurrency c] how many concurrent queries to run (default: 10)\n   [--checkpoint cn] how often to print results in milliseconds (default: 5000)\n   [--fail-fast] if specified, the work will stop after encountering one\n   failure.\n\nYou may only specify one of the options --n or --ms.\nYou may only specify one of the options --workload or --query\n\n\nOptions:\n  --help         Show help                                             [boolean]\n  --version      Show version number                                   [boolean]\n  -a             address to connect to                    [default: \"localhost\"]\n  -u             username                                     [default: \"neo4j\"]\n  -p             password                                             [required]\n  -d             database\n  --schema       batch schema file\n  --batchsize    number of records per batch, usable only with schema\n  -n             number of hits on the database\n  --ms           number of milliseconds to execute\n  --workload     absolute path to JSON probability table/workload\n  --query        Cypher query to run\n  --concurrency                                                    [default: 10]\n  --checkpoint                                                   [default: 5000]\n\nExamples:\n  run-workload.js -a localhost -u neo4j -p  Run 10 hits on the local database\n  secret -n 10\n```\n\n# Run in Docker\n\nSimply pass any arguments the command recognizes to the docker container.\n\n```\ndocker run --tty --interactive mdavidallen/graph-workload:latest -a my-neo4j-host.com -u neo4j -p password 2\u003e\u00261\n```\n\n# Running Stand-Alone from Source\n\n```\nyarn install\nnode src/run-workload.js -a localhost -u neo4j -p password\n```\n\nSee the `workloads` directory for the format of the probability table.\n\nYou can use the script `npm run graph-workload` as a synonym for running the index.js file, but keep in mind npm requires an extra `--` argument prior to passing\nprogram arguments, as in, `npm run graph-workload -- --n 20`\n\n# Examples\n\n## Create a lot of nodes as fast as possible:\n\n```\nnpm run graph-workload -- -a localhost -u neo4j -p admin --query 'Unwind range(1,1000000) as id create (n);' -n 50 --concurrency 4\n```\n\n## Write custom data generated in batches \n\nFake/mock data can be generated with functions from [fakerjs](https://www.npmjs.com/package/faker).\n\nUsing this technique you can generate your own data and create\ncustom load patterns.  Similar to other Neo4j utilities, the batch will be present in the query form: \"UNWIND batch AS event\".\n\n```\nnpm run graph-workload -- -a localhost -u neo4j -p admin \\\n  --query 'CREATE (t:Test) SET t += event' \\\n  --batchsize 1000 \\\n  --schema /absolute/path/to/schemas/myschema.json\n```\n\nSee `src/schemas/user.json` as an example of a schema you can use in this way.  Keys are field names to generate, values are the faker functions used to populate that field.\n\n## Explicit Transactions\n\nIf you use the `--query` option, you may also use `--mode READ` or `WRITE`.  This enables the program\nto use explicit read or write transactions, so that when queries are sent to a cluster, they are routed\nappropriately according to the Neo4j routing rules.\n\n# Neo4j 4.0 / Multidatabase\n\nAs of Neo4j 4.0, sessions support multi-database.  Use the `-d` or `--database` argument to direct\nwhere the workload should go.  By default, the workload goes to the default database (usually `neo4j`).\n\nExample:\n\n```\nnpm run graph-workload -- -a neo4j://my-cluster -u neo4j -p admin -d mydb\n```\n\n# Tests\n\n```\nyarn run test\n```\n\n# Building Graph Workloads as a Docker Container\n\n```\ndocker build -t mdavidallen/graph-workload:latest -f Dockerfile . \n```\n\n# Defining your own Custom Workload\n\n- Stress tester has a number of 'read strategies' and 'write strategies'\n- There is a probability table; the stress tester rolls random numbers and picks a strategy\nbased on the probability table.\n- By tweaking which strategies are available and what their probability is,  you can generate\nwhichever kind of load you like\n- You can write a new strategy to simulate any specific kind of load you like.\n\nSee workload.js for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxious%2Fgraph-workload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxious%2Fgraph-workload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxious%2Fgraph-workload/lists"}