{"id":42482615,"url":"https://github.com/cloudspannerecosystem/spanner-stress-test-demo","last_synced_at":"2026-01-28T11:15:44.732Z","repository":{"id":65753013,"uuid":"570211918","full_name":"cloudspannerecosystem/spanner-stress-test-demo","owner":"cloudspannerecosystem","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-25T06:30:42.000Z","size":2415,"stargazers_count":3,"open_issues_count":15,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-26T06:27:23.980Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudspannerecosystem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","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":"2022-11-24T15:41:30.000Z","updated_at":"2024-03-26T17:13:54.000Z","dependencies_parsed_at":"2024-04-17T02:59:14.845Z","dependency_job_id":"97bb9756-50b3-4da6-bad9-baf417e37cf2","html_url":"https://github.com/cloudspannerecosystem/spanner-stress-test-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloudspannerecosystem/spanner-stress-test-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudspannerecosystem%2Fspanner-stress-test-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudspannerecosystem%2Fspanner-stress-test-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudspannerecosystem%2Fspanner-stress-test-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudspannerecosystem%2Fspanner-stress-test-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudspannerecosystem","download_url":"https://codeload.github.com/cloudspannerecosystem/spanner-stress-test-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudspannerecosystem%2Fspanner-stress-test-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28844862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-28T11:15:43.885Z","updated_at":"2026-01-28T11:15:44.724Z","avatar_url":"https://github.com/cloudspannerecosystem.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spanner Load Test App\n\nThis repository contains sample game API code, load test sample code and arroud middleware for distributed load testing:\n\n- Game API server\n- Locust load test code\n- Setup make file via terraform and gcloud\n\n![](./docs/img/architecture.png)\n\n## Requirements\n\n`Highly recommend`: you to use it on [Cloud Shell](https://cloud.google.com/shell), because of easing to prepare settings for this demo\n\n### Cloud Environment\n\n__We expected to set organization policy default__\n\n- [Google Cloud Project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)\n- [Google Account](https://cloud.google.com/iam/docs/overview?hl=ja#google_account)\n  - It needs roles/owner permission on your project\n\n__Of course, you can deploy user account, but we recommend you to use Service Account.__\n\n- [Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating)\n  - It needs roles/owner permission on your project\n- [Service Account Key file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating)\n\n```bash\n# Example to create account and keyfile\nexport SA_NAME=terraformer\nexport PROJECT_ID=YOUR_PROJECT_ID\n\ngcloud config set project $PROJECT_ID\n\n# Create Service Account\ngcloud iam service-accounts create $SA_NAME \\\n  --description=\"Operation service account for spanner stress demo\" \\\n  --display-name=$SA_NAME\ngcloud projects add-iam-policy-binding $PROJECT_ID \\\n    --member=\"serviceAccount:${SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com\" \\\n    --role=\"roles/owner\"\n# Download a key file\n# Set JSON as a key file type \nexport KEY_FILE=terraformer.json\ngcloud iam service-accounts keys create $KEY_FILE \\\n  --iam-account=${SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com\n```\n\n\n### Deploy Tools\n\n__Cloud Shell has already installed followings:__\n\n- [gcloud](https://cloud.google.com/sdk/gcloud)\n- [terraform](https://www.terraform.io/) (auther version: Terraform v1.2.9 on linux_amd64)\n- [make command](https://www.gnu.org/software/make/manual/make.html)\n- [envsubst](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html)\n\n### Development Tools\n\nIf you need to develop this repository, you should install followings: \n\n- [python](https://www.python.org/downloads/) (auther version: 3.9.2)\n  - [pip](https://pip.pypa.io/en/stable/installation/) (auther version: 22.2)\n  - [pipenv](https://pipenv.pypa.io/en/latest/) (auther version: 2022.7.24)\n- [docker](https://docs.docker.com/engine/install/) (auther version: 20.10.17, API version: 1.41)\n- [docker-compose](https://docs.docker.jp/compose/install/index.html) (auther version: version 1.24.0)\n- [tbls](https://github.com/k1LoW/tbls) (Optional)\n- [terraform-docs](https://github.com/terraform-docs/terraform-docs) (Optional)\n- [act](https://github.com/nektos/act) (Optional)\n\n## How to use this demo\n\n### Setup env settings\n\n__You should set own environment by followings:__\n\n```bash\ngit clone https://github.com/cloudspannerecosystem/spanner-stress-test-demospanner-stress-test-demo.git\ncd spanner-stress-test-demo\n\n# You should change .env_sample to .env for gcloud environment\n# and edit .env file\ncp .env_sample .env\nvim .env\n```\n\n#### Spesifications of .env file\n\n|                      |                                                                                                                                    |                                                                                                                          | \n| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | \n| Key name             | Description                                                                                                                        | Example value                                                                                                            | \n| GOOGLE_CLOUD_PROJECT | Google Cloud Project ID                                                                                                            | test                                                                                                                     | \n| ACCOUNTS             | Account list for access to bastion                                                                                                 | [\"serviceAccount:terraformer1@test.iam.gserviceaccount.com\", \"serviceAccount:terraformer2@test.iam.gserviceaccount.com\"] | \n| KEY_PATH             | Credential key file path                                                                                                           | ~/workspace/terraformer.json                                                                                             | \n| REGION               | Google Cloud Region you hope                                                                                                       | asia-northeast1                                                                                                          | \n| SERVICE_NAME         | Cloud Run's service name                                                                                                           | sample-game                                                                                                              | \n| INSTANCE_NAME        | Cloud Spanner's instance name                                                                                                      | spanner-demo                                                                                                             | \n| DATABASE_NAME        | Cloud Spanner's database name for testing                                                                                          | sample-game                                                                                                              | \n| ENV                  | Env id, but we expected to use \"production\" when you deploy on Google Cloud.                                                       | production                                                                                                               | \n| LOG_LEVEL            | Loglevel of app and Locust                                                                                                         | INFO                                                                                                                     | \n| POD_NUM              | The number of Pod for load test containers                                                                                         | 10                                                                                                                       | \n| USERS                | [Peak number of concurrent Locust users](https://docs.locust.io/en/stable/configuration.html#all-available-configuration-options)  | 10                                                                                                                       | \n| RUN_TIME             | [Stop after the specified amount of time](https://docs.locust.io/en/stable/configuration.html#all-available-configuration-options) | 1h                                                                                                                       | \n\n### Deploy on Google Cloud\n\n```bash\n# Create environment via terraform and gcloud\nmake create.cloud.environment\n\n# Run load testing\nmake deploy.locust\n```\n\n### Watch the result\n\n__You can check the result in real time by followings:__\n\n- [Google Cloud's operations suite](https://cloud.google.com/products/operations)\n  - [Cloud Monitoring](https://cloud.google.com/monitoring/charts/metrics-selector)\n  - [Cloud Logging](https://cloud.google.com/logging/docs/view/logs-explorer-interface#getting_started)\n  - [Cloud Trace](https://cloud.google.com/trace/docs/viewing-details)\n\n- [Locust plugin dashboard](https://github.com/SvenskaSpel/locust-plugins/blob/master/locust_plugins/dashboards/README.md)\n\n![](https://github.com/SvenskaSpel/locust-plugins/raw/master/locust_plugins/dashboards/screenshots/main_dashboard.png)\n\n#### How to connect to grafana dashboard\n\n```bash\n# SSH port-forwording to grafana\nmake open.grafana\noutput: \n  Grafana dashboard: https://3443-xxxxyyyzzzz\n\n# Cloud Shell envronment(You can access via proxy)\nopen https://3443-xxxxyyyzzzz\n\n# Other environment\nopen http://localhost:3443\n```\n\n### Change Cloud Spanner cluster size\n\n__Note: If your spanner mark high CPU usage, you should change Cloud Spanner size manually__\n\n- [How to change conpute capacity of Cloud Spanner](https://cloud.google.com/spanner/docs/create-manage-instances?hl=ja#change-compute-capacity)\n\n### Delete all components after tests\n\n```bash\nmake delete.cloud.environment\n```\n\n## Features\n\n### Asis\n\n- Rest API for dummy game\n  - opperate Cloud Spanner([database schema](./apps/dbdoc/README.md))\n- API docs of Swagger by FastAPI\n- Distributed Stressor by Locust\n- IaC by terraform and gcloud\n\n### Tobe\n\n- [Auto Scalling for Cloud Spanner](https://cloud.google.com/architecture/autoscaling-cloud-spanner), instead of manual scalling\n\n## Reference\n\n### Internal modules reference\n\n- [Sample game app documents](./apps/README.md)\n- [Test senario documents by locust](./locust/README.md)\n- [Terraform documents](./terraform/README.md)\n\n```bash\n# Terraform document was generated by the following command\nterraform-docs markdown table terraform/ \u003e terraform/README.md\n```\n\n### 3rd party reference\n\n- [FastAPI](https://fastapi.tiangolo.com/)\n- [Locust](https://docs.locust.io/en/stable/)\n- [Locust Plugins](https://github.com/SvenskaSpel/locust-plugins)\n- [OpenTelemetry FastAPI Instrunentation](https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/fastapi/fastapi.html)\n\n## Contribution\n\n__Note: Understand [how to check your PR](.github/workflows/action.yml) before you send PR__\n\n### Some of tips in CI testing\n\nCI by github actions covered unit-testing in apps and integration test in this repo, and so basically you should check the result of test, but there are some caustions as followings:\n\n  - CI check just linting and validation to .tf files, and so please run terraform by own environment when you chenge .tf files\n  - This Integration test is not perfect, and so you should check following points by manually\n    - A fails ratio about GET characters/$user_id under 30%, because test senario cause 4XX error, and so it was not 0% of fail ratio\n    - Fails ratios in other endpoint are 0%\n\n![](./docs/img/intergration-test-result1.png)\n![](./docs/img/intergration-test-result2.png)\n\n\n- Others\n  - [CONTRIBUTING docs](./docs/contributing.md)\n\n\n## License\n\nThis is [Apache 2.0 License](./LICENSE)\n\n## Note\n\nThis is not an officially supported Google product","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudspannerecosystem%2Fspanner-stress-test-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudspannerecosystem%2Fspanner-stress-test-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudspannerecosystem%2Fspanner-stress-test-demo/lists"}