{"id":19608035,"url":"https://github.com/tidwall/redbench","last_synced_at":"2025-04-27T20:32:35.417Z","repository":{"id":57494981,"uuid":"86833437","full_name":"tidwall/redbench","owner":"tidwall","description":"Benchmarking for custom Redis commands and modules","archived":false,"fork":false,"pushed_at":"2021-01-25T22:06:56.000Z","size":5,"stargazers_count":33,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T03:12:16.318Z","etag":null,"topics":["benchmarking","golang","redis","redis-module","tile38"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidwall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-31T15:23:01.000Z","updated_at":"2024-10-20T16:53:42.000Z","dependencies_parsed_at":"2022-08-28T16:10:19.221Z","dependency_job_id":null,"html_url":"https://github.com/tidwall/redbench","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/tidwall%2Fredbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidwall%2Fredbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidwall%2Fredbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidwall%2Fredbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidwall","download_url":"https://codeload.github.com/tidwall/redbench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251204596,"owners_count":21552247,"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":["benchmarking","golang","redis","redis-module","tile38"],"created_at":"2024-11-11T10:13:50.137Z","updated_at":"2025-04-27T20:32:35.135Z","avatar_url":"https://github.com/tidwall.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redbench\n[![GoDoc](https://img.shields.io/badge/api-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/tidwall/redbench) \n\nRedbench is a Go package that allows for bootstrapping benchmarks\nfor servers using a custom implementation of the Redis protocol. It provides\nthe same inputs and outputs as the\n[redis-benchmark](https://redis.io/topics/benchmarks) tool. \n\nThe purpose of this library is to provide benchmarking for \n[Redcon](https://github.com/tidwall/redcon) compatible servers such as\n[Tile38](https://github.com/tidwall/tile38), but also works well for Redis\noperations that are not covered by the `redis-benchmark` tool such as the \n`GEO*` commands, custom lua scripts, or [Redis Modules](http://antirez.com/news/106).\n\n## Getting Started\n\n### Installing\n\nTo start using Redbench, install Go and run `go get`:\n\n```sh\n$ go get -u github.com/tidwall/redbench\n```\n\nThis will retrieve the library.\n\n### Example\n\nThe following example will run a benchmark for the `PING,SET,GET,GEOADD,GEORADIUS`\ncommands on a server at 127.0.0.1:6379.\n\n```go\npackage main\n\nimport (\n\t\"math/rand\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/tidwall/redbench\"\n)\n\nfunc main() {\n\tredbench.Bench(\"PING\", \"127.0.0.1:6379\", nil, nil, func(buf []byte) []byte {\n\t\treturn redbench.AppendCommand(buf, \"PING\")\n\t})\n\tredbench.Bench(\"SET\", \"127.0.0.1:6379\", nil, nil, func(buf []byte) []byte {\n\t\treturn redbench.AppendCommand(buf, \"SET\", \"key:string\", \"val\")\n\t})\n\tredbench.Bench(\"GET\", \"127.0.0.1:6379\", nil, nil, func(buf []byte) []byte {\n\t\treturn redbench.AppendCommand(buf, \"GET\", \"key:string\")\n\t})\n\trand.Seed(time.Now().UnixNano())\n\tredbench.Bench(\"GEOADD\", \"127.0.0.1:6379\", nil, nil, func(buf []byte) []byte {\n\t\treturn redbench.AppendCommand(buf, \"GEOADD\", \"key:geo\",\n\t\t\tstrconv.FormatFloat(rand.Float64()*360-180, 'f', 7, 64),\n\t\t\tstrconv.FormatFloat(rand.Float64()*170-85, 'f', 7, 64),\n\t\t\tstrconv.Itoa(rand.Int()))\n\t})\n\tredbench.Bench(\"GEORADIUS\", \"127.0.0.1:6379\", nil, nil, func(buf []byte) []byte {\n\t\treturn redbench.AppendCommand(buf, \"GEORADIUS\", \"key:geo\",\n\t\t\tstrconv.FormatFloat(rand.Float64()*360-180, 'f', 7, 64),\n\t\t\tstrconv.FormatFloat(rand.Float64()*170-85, 'f', 7, 64),\n\t\t\t\"10\", \"km\")\n\t})\n}\n```\n\nWhich is similar to executing:\n\n```\n$ redis-benchmark -t PING,SET,GET\n```\n\nFor a more complete example, check out [tile38-benchmark](https://github.com/tidwall/tile38/blob/master/cmd/tile38-benchmark/main.go) from the [Tile38](https://github.com/tidwall/tile38) project.\n\n### Custom Options\n\n```go\ntype Options struct {\n\tRequests int\n\tClients  int\n\tPipeline int\n\tQuiet    bool\n\tCSV      bool\n\tStdout   io.Writer\n\tStderr   io.Writer\n}\n```\n\n## Contact\nJosh Baker [@tidwall](http://twitter.com/tidwall)\n\n## License\nRedbench source code is available under the MIT [License](/LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidwall%2Fredbench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidwall%2Fredbench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidwall%2Fredbench/lists"}