{"id":37114805,"url":"https://github.com/taoxinyi/rua","last_synced_at":"2026-01-14T13:29:48.284Z","repository":{"id":57560006,"uuid":"325909997","full_name":"taoxinyi/rua","owner":"taoxinyi","description":"Fastest load generator in Go, comparable to wrk","archived":false,"fork":false,"pushed_at":"2021-01-02T18:12:58.000Z","size":737,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T08:21:50.120Z","etag":null,"topics":["http-benchmarking","load-generator","load-testing"],"latest_commit_sha":null,"homepage":"","language":"Go","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/taoxinyi.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":"2021-01-01T03:22:31.000Z","updated_at":"2021-10-22T21:28:38.000Z","dependencies_parsed_at":"2022-08-26T07:01:15.502Z","dependency_job_id":null,"html_url":"https://github.com/taoxinyi/rua","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/taoxinyi/rua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoxinyi%2Frua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoxinyi%2Frua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoxinyi%2Frua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoxinyi%2Frua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taoxinyi","download_url":"https://codeload.github.com/taoxinyi/rua/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taoxinyi%2Frua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28421212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"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":["http-benchmarking","load-generator","load-testing"],"created_at":"2026-01-14T13:29:47.522Z","updated_at":"2026-01-14T13:29:48.265Z","avatar_url":"https://github.com/taoxinyi.png","language":"Go","readme":"# Rua\n\nRua, written in Go, is the one of the **fastest** http(s) load generators (see [Benchmark](##benchmark)). Entirely inspired by [wrk](https://github.com/wg/wrk), rua can generate load as fast as [wrk](https://github.com/wg/wrk).\n\nRua is also intended to be one of the best load generator frameworks. You can design your own load configuration and start the load generation programmatically with only a few lines of code.\n\nRua by default supports its own optimized http implementation, as well as `net/http` , `valyala/fasthttp` client out of the box. It also has pluggable interface so that you can replace and configure your own http client as needed.\n\n## Benchmark\n\nRua has been benchmarked along with some of the most performant load generators with 6 different response types (short, medium and long response body \u0026 headers). In most situations it's as fast as `wrk` and `wrk2`, which are written in C and considered to be the fastest for many years.\n\nSee [Benchmark Details](benchmark)\n\n![RPS](benchmark/result/out_rps.png)\n\n## Install\n\n### Get from go\n\n```shell\ngo get -u github.com/taoxinyi/rua\n```\n\n`rua` will inside `$GOPATH/bin`\n\n### Build from source\n\n```shell\ngit clone github.com/taoxinyi/rua\ncd rua\ngo build\n```\n\n## Basic Usage\n\nThe following command runs a benchmark for 5 seconds, using 2 threads, and using 10 connections(goroutines).\n\n```\n$ rua -t 2 -c 10 -d 5s http://example.com\nRunning 5s test @ http://example.com\n 2 threads and 10 connections\n------------------------------------------------------------------------\n            Connection  Timeout     Status       \nErrors      0           0           0           \n------------------------------------------------------------------------\n            Avg         Min         Max         Stdev        +/- Stdev    \nLatency     12.010ms    10.915ms    31.974ms    1.210ms     95.347%     \n------------------------------------------------------------------------\n            50%         75%         90%         99%         99.9%        \nLatency     11.999ms    12.021ms    13.000ms    18.003ms    22.030ms    \n------------------------------------------------------------------------\n            Count       Count/s     Size        Throughput   \nRequests    4169        831.29      151 KiB     30 KiB/s    \nResponses   4169        831.29      6.3 MiB     1.3 MiB/s   \n\n4169 responses received in 5.0151051s, 6.3 MiB read\n```\n\n## Command Line Options\n\n```\nUsage: rua \u003coptions\u003e url\nOptions:\n  -d, --duration duration   Duration of test (default 10s)\n  -c, --connections int     Number of connections (default 10)\n  -t, --threads int         Number of OS threads to be used (default 8)\n  -H, --header string       HTTP header to add to the request (default \"map[]\")\n  -T, --timeout duration    Timeout in seconds (default 1s)\n  -B, --recvbuf int         The buffer size in bytes for read. Should be large enough for status line and headers if raw is used (default 4096)\n  -m, --method string       The HTTP method to be used (default \"GET\")\n  -b, --body string         The file path containing the HTTP body to add to the request\n  -C, --client string       Use the underlying HTTP client using one of [raw fasthttp net] (default \"raw\")\n  -v, --verbose             Whether print verbose information\n```\n\n## Framework Usage\nThe following code runs a benchmark for 5 seconds, using 2 threads, and using 10 connections(goroutines).\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\trua \"github.com/taoxinyi/rua/framework\"\n\t\"github.com/taoxinyi/rua/framework/client\"\n\t\"os\"\n\t\"time\"\n)\nfunc main() {\n\tconfig := \u0026rua.LgConfig{\n\t\tRequestConfig: rua.RequestConfig{URL: \"http://example.com\"},\n\t\tDuration:      5 * time.Second,\n\t\tConnections:   10,\n\t}\n\tlg, err := rua.NewLoadGenerator(config, client.NewRawHttpClient())\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(-1)\n\t}\n\tstats, actualRunningTime := lg.Start()\n\tfmt.Printf(\"RPS: %.3f\\n\", float64(stats.ResponsesRecv)/actualRunningTime.Seconds())\n}\n\n```\n\n## Implement Your Own Http Client\n\n`HttpClient` and `User` interface can be implemented so that the framework can use your `HttpClient` for your workloads. e.g. HTTP/2, Redirect, customized configurations, etc.\n\nSee [Client](framework/client)\n\n## Optimizations\nRua with customized raw HTTP client directly operates on TCP connections, which is optimized to send unchanged requests.\n\n1. Each goroutine has a dedicated a TCP connection, there's no need to do any synchronization on them at all.\n\n2. In most scenarios, it's not the load generator's job to test the correctness of the response. There is no need to parse the headers and copy the body. We only need the status code, content length so that we know whether the response is complete or not.\n\n3. If the request will not change, then it's immutable. There is no need to build them or convert them to bytes every time. Directly send the request bytes.\n\n4. Zero memory allocation during the load generation, avoid copy as much as possible.\n\n## Limitations\n\nRua's optimized raw client is implemented in the following ways:\n\nRead until reaches the first `\\r\\n\\r\\n`, then find `Content-Length` in the header. Then read until the body size equals `Content-Length`. Therefore HTTP pipelining is not supported. (I think it's rarely used in practice.)\n\nIf you have extremely long headers, the recv buffer is full, and `\\r\\n\\r\\n` hasn't reached yet, an error will be thrown. So you should increase the `-B, --recvbuf` receiver buffer size instead, so the size can at least large enough for the first `\\r\\n\\r\\n`\n\n`Content-Length` must be present in the response, otherwise an error will be thrown since the parser doesn't know the body size. Therefore, `Connection: close` is not supported, only `keep-alive` is supported. Also, `Chunk` is not supported since it only knows the body size. Use `--client fasthttp` instead if you need `Connection: close` or `Chunk`.\n\nIn summary, use `--client fasthttp` for reliable, use the default `raw` if you need extreme performance and your responses doesn't have any corner cases.\n\n## Future Improvements\n\nRua is still in early stage and there are a lot of features to come. These Go APIs are subject to change.\n\nI wonder if it's the already reach the limit of Go in terms of speed and performance. \n\nIf you have any ideas to improve rua, welcome to submit a PR!\n\n## Acknowledgements\n\nThis project is entirely inspired by [wrk](https://github.com/wg/wrk), also thanks to other great projects like [wrk2](https://github.com/giltene/wrk2), [go-wrk](https://github.com/tsliwowicz/go-wrk), [fasthttp](https://github.com/valyala/fasthttp)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaoxinyi%2Frua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaoxinyi%2Frua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaoxinyi%2Frua/lists"}