Go中的性能测试-从哪里开始? [关闭]

I've been learning Go. I'm just a newbie. I've just finished my web (still in localhost). I want to ask if there is any tools or framework, library that allows to test server performance, track response time parallel to running server.

I don't know where to begin from, criteria is from measuring response time for each request, creating virtual automatic session to send request to server (login, do something, logout), calculating how many requests sent simultaneously to server are properly responded, etc.

What should I start now? And what will I use?

Using the built in tools should be most of what you need, you just need to learn about the tooling, like writing Benchmark test functions.

This go blog post has an overview and links to info about the cpu/memory/contention tooling.

Brad Fitzpatrick gave a good talk about using the profiling tools, with examples.

If you want to test the code you write in go you should build benchmark test. To achieve this result read the golang documentation about the package testing here. If you have any question feel free to write here

  1. Take a load testing tool, here is the list of 54 (as for now) free and open source load testing tools. If you want something short-listed check out Open Source Load Testing Tools: Which One Should You Use? article
  2. It's better to have another host to run your load test from to avoid mutual interference.
  3. Run load test (most tools have record and replay functionality, it should be enough for baseline testing)
  4. If you're unhappy with response times or get errors - investigate and fix the reason which could be:

    • lack of resources (CPU, RAM, Network or Disk IO) on your web application side
    • not optimal configuration of application or web server
    • something is wrong with your application code