Answer the question
In order to leave comments, you need to log in
How can you measure the performance of an http server?
I read an article there, almost any server can process 3-4 thousand requests per second or more.
I decided to do a little load testing on such a server. But the test results surprised me. Only 10 rps shown. Moreover, the server on asio (c ++) showed the same results. And I've come to the conclusion that I'm most likely testing incorrectly. Therefore, I ask you to help me explain how you can correctly check what load the server can withstand.
Tested like this
siege -t10S -v 127.0.0.1:8080
results
Response time: 2.26 secs
Transaction rate: 10.63 trans/sec
Throughput: 0.06 MB/sec
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
w.Write([]byte("Hello"))
})
log.Fatal(http.ListenAndServe(":8080", nil))
}
Answer the question
In order to leave comments, you need to log in
For such a test code, you can use ab (Apache HTTP server benchmarking tool)
For example,
ab -n 10000 -c 1000 http://localhost:8080/
where:
-n is the number of requests to be made
-c is the number of simultaneous requests
Launched on one of the servers, the result is like this
Server Software:
Server Hostname: localhost
Server Port: 8080
Document Path: /
Document Length: 5 bytes
Concurrency Level: 1000
Time taken for tests: 0.509 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1210000 bytes
HTML transferred: 50000 bytes
Requests per second: 19627.39 [#/sec] (mean)
Time per request: 50.949 [ms] (mean)
Time per request: 0.051 [ms] (mean, across all concurrent requests)
Transfer rate: 2319.25 [Kbytes/sec] received
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question