How do you go about stress testing a program or service?

blov · · 517 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;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&#39;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&#39;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&#39;s going on, but it&#39;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&#39;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&#39;s more complicated, I&#39;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>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

517 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传