{"id":15482995,"url":"https://github.com/devth/alpine-bench","last_synced_at":"2025-04-22T16:26:15.217Z","repository":{"id":136770944,"uuid":"61053390","full_name":"devth/alpine-bench","owner":"devth","description":":whale: An Alpine Docker image which runs Apache Bench and parses its results","archived":false,"fork":false,"pushed_at":"2016-06-24T20:35:20.000Z","size":5,"stargazers_count":29,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T07:16:47.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/devth/alpine-bench/","language":"Go","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/devth.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-06-13T16:45:20.000Z","updated_at":"2025-02-24T00:57:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8b941f6-2f22-4592-b9fe-c317210da256","html_url":"https://github.com/devth/alpine-bench","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devth%2Falpine-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devth%2Falpine-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devth%2Falpine-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devth%2Falpine-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devth","download_url":"https://codeload.github.com/devth/alpine-bench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250276140,"owners_count":21403808,"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-10-02T05:10:28.727Z","updated_at":"2025-04-22T16:26:15.189Z","avatar_url":"https://github.com/devth.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alpine-bench\n\n`alpine-bench` is useful for running Apache Bench in your cluster to gather\nlatency metrics from your services. It does this by:\n\n1. Running Apache Bench using provided options\n1. Parsing the results into a JSON data structure and printing them to stdout\n\nThis makes it useful for running from your automation (e.g. CI/CD) and making\ndecisions based on the results. For example, in a CD pipeline it can be useful\nto deploy a new build to `dev`, measure its latency, and if the result is within\nsome threshold, proceed to `prod` rollout.\n\n## Usage\n\nNearly all of `ab`'s options can simply be passed in using Docker's normal cmd\nmechnaism, e.g.:\n\n```bash\ndocker run -it --rm -t devth/alpine-bench -n3 http://google.com/\n```\n\nSample output:\n\n```json\n{\n  \"connect\": {\n    \"max\": 154,\n    \"mean\": 69,\n    \"median\": 66,\n    \"min\": 54,\n    \"stdDev\": 18.60000038147\n  },\n  \"percentiles\": {\n    \"100\": 340,\n    \"50\": 258,\n    \"66\": 264,\n    \"75\": 269,\n    \"80\": 283,\n    \"90\": 291,\n    \"95\": 296,\n    \"98\": 340,\n    \"99\": 340\n  },\n  \"processing\": {\n    \"max\": 274,\n    \"mean\": 196,\n    \"median\": 196,\n    \"min\": 142,\n    \"stdDev\": 18.60000038147\n  },\n  \"total\": {\n    \"max\": 340,\n    \"mean\": 266,\n    \"median\": 258,\n    \"min\": 250,\n    \"stdDev\": 18.799999237061\n  },\n  \"waiting\": {\n    \"max\": 274,\n    \"mean\": 196,\n    \"median\": 196,\n    \"min\": 141,\n    \"stdDev\": 18.60000038147\n  }\n}\n```\n\nThe output can be parsed by your CI tool to make decisions about whether to\nrollout a deployment (or whatever else you might want to do).\n\n## Special options\n\nOptions which require reading from a file can be passed in via ENV instead.\nInternally the contents will be written to a file and the corresponding `ab`\noption will be used.\n\n### Example\n\n```\ndocker run -e 'POST=post body' -it --rm -t devth/alpine-bench -n3 http://google.com/\n```\n\n### Options\n\n| `ab` Option    | Env Var |\n| -------------- | ------- |\n| `-p POST-file` | POST    |\n| `-u PUT-file`  | PUT     |\n\n## Unsupported options\n\nOptions which cause ab to write to a file are not supported.\n\n- `-e csv-file`\n- `-g gnuplot-file`\n\nThey will work, but the resulting file will be lost inside the Docker container\nwhen it terminates.\n\n## Get a shell in the container\n\n```bash\ndocker run -it --rm --entrypoint sh devth/alpine-bench\n```\n\n## Development\n\nBuild the image, obtain your docker machine IP, run an Nginx container to\nmeasure, and run `alpine-bench` against it:\n\n```bash\ndocker build -t devth/alpine-bench .\nexport DM_IP=$(dm ip dev)\ndocker run -p 8080:80 -it --rm nginx:alpine\ndocker run -it --rm devth/alpine-bench -n3 http://$DM_IP:8080/\n```\n\nOr run it outside of Docker:\n\n```bash\nPOST='post body' go run main.go -n3 http://$DM_IP:8080/\n```\n\nIn your nginx logs you'll see something like:\n\n```\n172.17.0.1 - - [14/Jun/2016:20:20:42 +0000] \"GET / HTTP/1.0\" 200 612 \"-\" \"ApacheBench/2.3\" \"-\"\n172.17.0.1 - - [14/Jun/2016:20:20:42 +0000] \"GET / HTTP/1.0\" 200 612 \"-\" \"ApacheBench/2.3\" \"-\"\n172.17.0.1 - - [14/Jun/2016:20:20:42 +0000] \"GET / HTTP/1.0\" 200 612 \"-\" \"ApacheBench/2.3\" \"-\"\n```\n\n## License\n\nCopyright 2016 Trevor C. Hartman. Distributed under the\n[MIT](https://opensource.org/licenses/MIT) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevth%2Falpine-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevth%2Falpine-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevth%2Falpine-bench/lists"}