Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
474 views
in Technique[技术] by (71.8m points)

nginx - How to generate 1Gbps in Apache Bench?

  1. I have a i7 processor (8 core) with 16GB RAM
  2. I have installed Windows Docker
  3. I have created a Ubuntu docker instance
  4. In the Ubuntu instance I have installed Nginx (8 workers)
  5. In the Ubuntu instance I have installed Apache Bench (ab)
  6. In the Ubuntu instance I have set high ulimit values as shown below

# ulimit values

root@c8c1c6a106c2:/# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 24682
max locked memory       (kbytes, -l) 82000
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1048576
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
root@c8c1c6a106c2:/#

Now when I run the following ab command In the Ubuntu instance I get only 137.73 KBytes/sec (1.1MBits/sec). While my network card can support 10Gbps, why the through put is very less and how can I improve it ?

root@c8c1c6a106c2:/# ab -c 20000 -n 200000 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 20000 requests
Completed 40000 requests
Completed 60000 requests
Completed 80000 requests
Completed 100000 requests
Completed 120000 requests
Completed 140000 requests
Completed 160000 requests
Completed 180000 requests
Completed 200000 requests
Finished 200000 requests


Server Software:        nginx/1.18.0
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        612 bytes

Concurrency Level:      20000
Time taken for tests:   79.265 seconds
Complete requests:      200000
Failed requests:        383419
   (Connect: 0, Receive: 0, Length: 196509, Exceptions: 186910)
Total transferred:      11178860 bytes
HTML transferred:       8011080 bytes
Requests per second:    2523.17 [#/sec] (mean)
Time per request:       7926.525 [ms] (mean)
Time per request:       0.396 [ms] (mean, across all concurrent requests)
Transfer rate:          137.73 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0 5617 2756.1   6147   13044
Processing:    77 1725 2069.8    461   13055
Waiting:        0  122 792.8      0    8190
Total:       4238 7342 2197.9   6903   20681

Percentage of the requests served within a certain time (ms)
  50%   6903
  66%   7217
  75%   8236
  80%   8263
  90%  10447
  95%  12159
  98%  13138
  99%  14928
 100%  20681 (longest request)
root@c8c1c6a106c2:/#

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...