How do i write a benchmark script in Go to measure ops/sec
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am practicing my Golang by writing a simple Redis clone. How do i write a benchmark script that would establish X connections per second at C concurrency level to deal with my server's protocol and measure how many ops/sec? I can simply write a script that would actually do this: for i := range(1000) { // Open connection // Perform command // Close connection } But i want to know the concept behind distributing the number of connections per concurrency level per second. 回答1: This is best handled by the built-in testing.Benchmark system.