<p>I've seen libraries pop up that claim to handle xxx amount of users/traffic. How are these numbers found?</p>
<p>A hypothetical example: I want to create a chat server with some features like blocking, banning, rooms etc. How do I measure how many concurrent users I can handle? How many messages/sec can I handle? etc.</p>
<hr/>**评论:**<br/><br/>CaptaincCodeman: <pre><p>Put it live and let users hit it :)</p>
<p>More seriously, you generate fake but realistic traffic patterns with load-testing software to see how it scales.</p></pre>mixedCase_: <pre><p>I've used wrk in the past for that task.</p></pre>elithrar_: <pre><p>wrk is also my go-to. Written in C, extremely fast, uses keep-alives, and scriptable via Lua (constructing payloads, headers, etc). </p>
<p>Combine that with Go's profiling tools (net/http/pprof) and benchmarking (testing.B) you have a stack of tooling to seek out bottlenecks. </p>
<p>I also find HTTP load testing to help provide context for individual benchmarks that might not have a performance impact once you take the network into account. </p></pre>hahainternet: <pre><p>Another vote for wrk here. It can be hard to carefully nurse out exactly what's going on, but it's probably the best tool for doing so I have found.</p></pre>robbles: <pre><p><a href="http://tsung.erlang-projects.org" rel="nofollow">http://tsung.erlang-projects.org</a> is a really powerful (although somewhat complex) tool that you can use to generate large numbers of users and script complex sessions for them. It can handle protocols other than HTTP, IIRC.</p>
<p>I've been using this docker image to run it easily:
<a href="https://hub.docker.com/r/ddragosd/tsung-docker/" rel="nofollow">https://hub.docker.com/r/ddragosd/tsung-docker/</a></p></pre>Grundlebuttskin: <pre><p>For programs, <a href="http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go" rel="nofollow">use the built-in benchmark support</a>. For services, write a go client and wire it into <a href="https://github.com/codahale/buster" rel="nofollow">buster</a>.</p></pre>dgryski: <pre><p>You should watch <a href="https://youtu.be/yg7zsuasIIE" rel="nofollow">https://youtu.be/yg7zsuasIIE</a> and <a href="https://youtu.be/lJ8ydIuPFeU" rel="nofollow">https://youtu.be/lJ8ydIuPFeU</a></p></pre>HectorJ: <pre><p>For simple HTTP services, something like <code>siege</code> does the job.</p>
<p>If it's more complicated, I'd go with JMeter.</p></pre>baijum: <pre><p>Vegeta is an HTTP load testing tool and library written in Go: <a href="https://github.com/tsenart/vegeta" rel="nofollow">https://github.com/tsenart/vegeta</a></p></pre>jart: <pre><p>I call up E_T. <a href="https://youtu.be/3TFdomgFjvg" rel="nofollow">https://youtu.be/3TFdomgFjvg</a></p></pre>karnd01: <pre><p>Along with profiling, benchmarks and siege I can definitely recommend gcvis <a href="https://github.com/davecheney/gcvis" rel="nofollow">https://github.com/davecheney/gcvis</a> as well, being able to visualise your apps memory and garbage collection in real time (or near real time) helps allot.</p></pre>dgryski: <pre><p>Also <a href="https://github.com/mkevac/debugcharts" rel="nofollow">https://github.com/mkevac/debugcharts</a></p></pre>nishanths: <pre><p><a href="https://github.com/rakyll/boom" rel="nofollow">https://github.com/rakyll/boom</a> is a straightforward to use HTTP load generator. </p></pre>
![](https://static.golangjob.cn/static/img/banner.png)