{"id":46370907,"url":"https://github.com/blocklet/server-benchmark-tool","last_synced_at":"2026-03-05T03:37:37.075Z","repository":{"id":166336344,"uuid":"641795151","full_name":"blocklet/server-benchmark-tool","owner":"blocklet","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-02T04:53:01.000Z","size":5750,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-02T05:33:09.915Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blocklet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-17T07:23:54.000Z","updated_at":"2025-07-02T04:53:05.000Z","dependencies_parsed_at":"2025-03-21T01:22:19.509Z","dependency_job_id":"0c485ed3-563c-4a40-8c13-2c5030343ea5","html_url":"https://github.com/blocklet/server-benchmark-tool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blocklet/server-benchmark-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocklet%2Fserver-benchmark-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocklet%2Fserver-benchmark-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocklet%2Fserver-benchmark-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocklet%2Fserver-benchmark-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blocklet","download_url":"https://codeload.github.com/blocklet/server-benchmark-tool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocklet%2Fserver-benchmark-tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30108823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:32:43.378Z","status":"ssl_error","status_checked_at":"2026-03-05T03:32:22.667Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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-03-05T03:37:36.429Z","updated_at":"2026-03-05T03:37:37.067Z","avatar_url":"https://github.com/blocklet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @blocklet/benchmark\n\nA powerful, flexible HTTP API benchmarking tool tailored for Blocklet and general Node.js services. Supports multiple modes (RPS, concurrency), ramp-up testing, AI-powered analysis, and outputs performance charts and logs.\n\n## 📦 Installation\n\n```bash\nnpm install -g @blocklet/benchmark\n```\n\nOr use it directly via `npx`:\n\n```bash\nnpx @blocklet/benchmark\n```\n\n## 🚀 Quick Start\n\n### Step 1: Initialize Config File\n\n```bash\nnpx @blocklet/benchmark init --type server\n```\n\nOther available types:\n\n- `discuss-kit`\n- `tool`\n- You can also combine them: `--type server,tool`\n\nThis will generate a `benchmark.yml` file in your current directory.\n\n### Step 2: Run the Benchmark\n\n```bash\nnpx @blocklet/benchmark run\n```\n\nOptions:\n\n| Option     | Description                                | Default         |\n| ---------- | ------------------------------------------ | --------------- |\n| `--config` | Path to config file                        | `benchmark.yml` |\n| `--format` | Output format: `row`, `json`, or `table`   | `table`         |\n| `--mode`   | Benchmark mode: `rps`, `concurrent`, `all` | `all`           |\n\n## 🧩 Configuration\n\nHere's a sample `benchmark.yml` and explanation of the fields:\n\n```yaml\norigin: https://example.blocklet.dev\nconcurrency: 100\ntimelimit: 20\nramp: 20\ndata:\n  loginToken: your-login-token\n  teamDid: your-team-did\n  userDid: your-user-did\nbody: '{\"example\": true}'\nlogError: true\nlogResponse: false\naiAnalysis:\n  enable: true\n  language: en\n  techStack: node.js\n  model: gpt-4o\napis:\n  - name: Get User Info\n    api: /api/user/info\n    method: GET\n    assert:\n      id: not-null\n  - name: Update Status\n    api: /api/status\n    method: POST\n    body: '{\"status\": \"ok\"}'\n    assert:\n      success: true\n```\n\n### Top-Level Fields\n\n| Field         | Description                                                                   |\n| ------------- | ----------------------------------------------------------------------------- |\n| `origin`      | Base URL of the API server                                                    |\n| `concurrency` | Number of concurrent users                                                    |\n| `timelimit`   | Duration of the test per mode (in seconds)                                    |\n| `ramp`        | (Optional) Ramp step to gradually increase concurrency                        |\n| `data`        | Dynamic values to be injected into API paths or headers                       |\n| `body`        | Default request body                                                          |\n| `logError`    | Print error logs to console                                                   |\n| `logResponse` | Print full API responses                                                      |\n| `aiAnalysis`  | Enable GPT-powered result interpretation (requires `OPENAI_CLIENT` in `.env`) |\n| `sitemap`     | The remote endpoint should return a JSON response                             |\n\n### API List (`apis`)\n\nEach item defines one endpoint to test:\n\n| Field    | Description                                                           |\n| -------- | --------------------------------------------------------------------- |\n| `name`   | Human-readable name of the test case                                  |\n| `api`    | API path (joined with `origin`)                                       |\n| `method` | HTTP method (GET, POST, etc.)                                         |\n| `body`   | Request body (if POST/PUT)                                            |\n| `assert` | Assertions on response (supports `not-null`, `null`, or fixed values) |\n| `only`   | If true, run **only** this endpoint                                   |\n| `skip`   | If true, skip this endpoint                                           |\n\n## 🌐 Using `sitemap` to Auto-Load API Definitions\n\nTo simplify and centralize API configuration, `@blocklet/benchmark` supports loading APIs dynamically from a remote `sitemap`. This allows you to avoid manually writing all your API definitions in the `benchmark.yml` file, and instead retrieve them from a maintained endpoint.\n\n### 🧩 Configuration\n\nYou can enable and configure the `sitemap` in your `benchmark.yml` like this:\n\n```yaml\nsitemap:\n  enable: true\n  url: 'https://your-server-url.com/sitemap'\n```\n\n- `enable`: Set to `true` to activate the feature.\n- `url`: URL of the remote endpoint that returns the sitemap JSON.\n\n\u003e 📌 If `enable` is set to `false`, or the request to the sitemap fails, it will fall back to using the `apis` defined in your `benchmark.yml` file.\n\n---\n\n### 📝 Expected Sitemap Response Format\n\nThe remote endpoint should return a JSON response with the following structure:\n\n```json\n{\n  \"apis\": [\n    {\n      \"name\": \"/api/example\",\n      \"api\": \"/api/example\"\n    },\n    {\n      \"name\": \"/api/full\",\n      \"api\": \"/api/full\",\n      \"method\": \"GET\",\n      \"cookie\": \"login_token=$$loginToken\",\n      \"format\": \"json\",\n      \"headers\": {\n        \"Content-Type\": \"application/json; charset=utf-8\"\n      },\n      \"skip\": false,\n      \"only\": false,\n      \"body\": {},\n      \"assert\": {}\n    }\n  ],\n  \"data\": {\n    \"key\": \"option use some data\"\n  }\n}\n```\n\n## 📊 Output\n\nAll results are saved to the `benchmark-output` folder:\n\n- `benchmark.log`: All logs\n- `0-benchmark-raw.yml`: Raw result file\n- `*.png`: Chart images (RPS, latency percentiles)\n- `console output`: A summary table of all benchmark results\n\nIf `aiAnalysis` is enabled and `OPENAI_CLIENT` is set in `.env`, a GPT-powered summary of the test will be provided in the console.\n\n## 📘 License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocklet%2Fserver-benchmark-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblocklet%2Fserver-benchmark-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocklet%2Fserver-benchmark-tool/lists"}