1

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?

necroface
  • 3,365
  • 10
  • 46
  • 70

3 Answers3

2

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.

matt.s
  • 1,698
  • 1
  • 20
  • 29
2

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

Bestbug
  • 475
  • 4
  • 13
  • Because I'm testing a web application that includes logging in, doing stuffs, handling requests, managing session, and logging out, I wonder if `testing` could help me test? It concerns with user session, so I'm worried about it – necroface Apr 08 '16 at 02:25
  • 1
    The package `testing` is massive used for unit test, if you are interested benchmark how much time your function take for loggin - loggin out etc there is not a problem, for the session you can esy create a fake session and use it for testing. You can check [this](http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go) usefull post. – Bestbug Apr 08 '16 at 10:30
  • How can I create a fake session. Each session is created by logging in with Google OAuth – necroface Apr 11 '16 at 06:28
  • You can invoke the api in the test function – Bestbug Apr 11 '16 at 07:06
  • I've still been learning. Where is it? Can you guide me? Thank you – necroface Apr 11 '16 at 07:46
  • 1
    You can invoke the session creation in the function of the benchmark you will create after thath you can make all the test you want. Check also [this link](https://www.golang-book.com/books/intro/12) to understand how you should make test (benchmark is a "child" of test) – Bestbug Apr 12 '16 at 15:53
1
  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
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I've been struggling with getting certificate in Gatling. Could you help me please? http://stackoverflow.com/questions/36545399/error-self-signed-certificate-getting-chain – necroface Apr 12 '16 at 03:02