GoLang development HTTP server and concurrent test

  Go language flagship high concurrency, write a simple HTTP server here, and then use ab test without Golang concurrency of Nginx.

Compile the Linux Firmware: CGO_ENABLED = 0; GOOS = linux; GOENV to set in, set GOENV = C: \ Users \ gaochaowei \ AppData \ Roaming \ go \ env;

Aliyun local server, ab -n 10000 -c 1000 http: // localhost: 6500 /

15 Server Software:        
16 Server Hostname:        localhost
17 Server Port:            6500
18 
19 Document Path:          /
20 Document Length:        14 bytes
21 
22 Concurrency Level:      1000
23 Time taken for tests:   0.416 seconds
24 Complete requests:      10000
25 Failed requests:        0
26 Total transferred:      1310000 bytes
27 HTML transferred:       140000 bytes
28 Requests per second:    24033.44 [#/sec] (mean)
29 Time per request:       41.609 [ms] (mean)
30 Time per request:       0.042 [ms] (mean, across all concurrent requests)
31 Transfer rate:          3074.59 [Kbytes/sec] received
32 
33 Connection Times (ms)
34               min  mean[+/-sd] median   max
35 Connect:        0    2   2.5      1      15
36 Processing:     0    6   4.1      5      27
37 Waiting:        0    5   3.5      4      25
38 Total:          0    8   5.4      6      34
39 
40 Percentage of the requests served within a certain time (ms)
41   50%      6
42   66%      8
43   75%      9
44   80%     10
45   90%     13
46   95%     19
47   98%     28
48   99%     29
49  100%     34 (longest request)

When setting the concurrent 5000, there is a problem: socket: Too many open files (24)

Tip file descriptor open too. So would engage him with ulimit -a look:

 

 Indeed default maximum number of open files is 1024, ulimit -n 102400 can be changed a bit, but this can only be a temporary modification, specific permanent modification method is not described here, the file is /etc/security/limits.conf.

Concurrent performance really good, free detailed analysis of it.

 

Guess you like

Origin www.cnblogs.com/gaochaoweino/p/12531705.html