{"id":20613951,"url":"https://github.com/dgraph-io/dgraph-locust","last_synced_at":"2025-10-27T07:07:10.999Z","repository":{"id":222183897,"uuid":"756487382","full_name":"dgraph-io/dgraph-locust","owner":"dgraph-io","description":"locust testing framework for Dgraph, without initial data set to save space","archived":false,"fork":false,"pushed_at":"2024-04-25T20:22:26.000Z","size":114263,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-17T04:09:36.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/dgraph-io.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-12T18:59:54.000Z","updated_at":"2024-11-12T07:07:54.000Z","dependencies_parsed_at":"2024-04-25T21:42:45.477Z","dependency_job_id":null,"html_url":"https://github.com/dgraph-io/dgraph-locust","commit_stats":null,"previous_names":["dgraph-io/dgraph-locust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgraph-io%2Fdgraph-locust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgraph-io%2Fdgraph-locust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgraph-io%2Fdgraph-locust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgraph-io%2Fdgraph-locust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgraph-io","download_url":"https://codeload.github.com/dgraph-io/dgraph-locust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242268636,"owners_count":20100067,"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":[],"created_at":"2024-11-16T11:11:29.492Z","updated_at":"2025-10-27T07:07:10.936Z","avatar_url":"https://github.com/dgraph-io.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Setup: \n\nCreate a virtual env using `venv`, for example:\n\n```\npython3 -m venv .dgraph-locust \u0026\u0026 \\ \nsource .dgraph-locust/bin/activate \u0026\u0026 \\ \ncd dgraph-locust  \n```\n\nInstall dependencies from `requirements.txt` using `pip` :\n\n```\npip install -r requirements.txt\n```\n\nSetup a Dgraph cluster quickly using `docker compose`:\n\n```\ndocker compose up -d \n```\n\nUpload the schema and load test data: \n```\npython3 common/seed.py\n```   \nThis test data (available in the `data` dir) was generated using the Dgraph `datagen` tool which can be downloaded [here](https://github.com/dgraph-io/dgraph/tree/main/graphql/testdata/datagen). \nPlease refer the `schema.graphql` for more info on that data-model.  \n\n## Run Tests:\n\nAdd queries and mutations to the `queries.txt` and `mutations.txt` files respectively. The files in this repo contain sample queries corresponding to the test-data, but all queries/mutations must be added to these files. \n\n**NOTE:** Please ensure that each query/mutation is separated by a newline which the parser relies on as a delimiter, to identify separate queries or mutations. The parsing will fail if the newlines are not added or are included within queries themselves.\n\n### With Web-UI: \n\nTo start the query load-tests:\n\n```\nlocust -f locustfiles/query.py\n```\n\nThe Locust Web UI can be accessed at http://localhost:8089.  \n\nTo start mutation load-tests:\n\n```\nlocust -f locustfiles/mutation.py\n```\n\nTo start a mixed-load test comprising of both queries and mutations:\n\n```\nlocust -f locustfiles/mixed_load.py\n```\n\n\n\n### Without WebUI:\n\n```\nlocust -f locustfiles/query.py --headless -H http://localhost:8080 -u 1000 -r 100 --run-time 3h30m\n```\n\n## Project Structure:\n\n#### common\n\n- The `seed.py` is used to upload the GraphQL schema and load data using the Dgraph Live Loader. \n\n- The `job.py` is used to setup and collect Go profiles for CPU, heap and goroutines. The files are saved in the `output` dir, within the respective sub-directories.  \n\n- The `setup.py` file contains logic to retrieve data to be used as filter values in the queries to test.  \n\n- The `helpers.py` contains common reusable methods for the tests. \n\n\n#### locustfiles\n\n- Contains the locust test files that can be run as noted above.\n\n\n#### output\n\n- Contains sub-directories for storing profiling info. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgraph-io%2Fdgraph-locust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgraph-io%2Fdgraph-locust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgraph-io%2Fdgraph-locust/lists"}