簡體   English   中英

使用ab命令,Linux中100個並發進程失敗,如何為Linux解決此問題?

[英]Using ab command, 100 concurent process fails in Linux, How to solve this issue for Linux?

我做了什么 :

  • 我已經使用了以下ab命令:

ab -n 1000 -c 100 http://192.168.101.143:8558/num?num=5

  • 在這里,我試圖生成1000個http請求,100個並發進程,端口是8558,並且我想從我自己的Web服務器獲取5階乘。

  • 另一面,我自己的Web服務器正在該IP地址端口:8558上等待請求,當我們執行ab命令時,我自己的服務器接受該請求,並且進程給出的響應階乘為5,但是每次10-20個請求都會失敗本機Linux系統

  • 但是,當我在本機Windows系統上運行自己的服務器時,它會按時給出100個並發進程的1000個正確響應,而不會失敗任何請求

問題:

  • 在Windows 100中,並發進程(線程)工作正常,但在Linux中,某些請求失敗,為什么?
  • 如何為Linux解決此問題?
  • 有插座相關的問題嗎?

在Windows平台上打開服務器時:

This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.101.143 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        
Server Hostname:        192.168.101.143
Server Port:            8558

Document Path:          /num?num=5
Document Length:        3 bytes

Concurrency Level:      100
Time taken for tests:   1.350 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      123000 bytes
HTML transferred:       3000 bytes
Requests per second:    652.93 [#/sec] (mean)
Time per request:       155.493 [ms] (mean)
Time per request:       1.550 [ms] (mean, across all concurrent requests)
Transfer rate:          75.20 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   1.6      1      12
Processing:     4   74 117.5     25    1803
Waiting:        2   56  74.4     16    1281
Total:          5   150 117.8     26    1810

Percentage of the requests served within a certain time (ms)
  50%     26
  66%     42
  75%     78
  80%     93
  90%    171
  95%    218
  98%    358
  99%    536
 100%   1810 (longest request)

當服務器在Linux平台上運行時:

This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.101.143 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        
Server Hostname:        192.168.101.143
Server Port:            8558

Document Path:          /num?num=5
Document Length:        3 bytes

Concurrency Level:      100
Time taken for tests:   9.899 seconds
Complete requests:      1000
Failed requests:        13
   (Connect: 0, Receive: 0, Length: 13, Exceptions: 0)
Total transferred:      119802 bytes
HTML transferred:       2922 bytes
Requests per second:    102.91 [#/sec] (mean)
Time per request:       120.934 [ms] (mean)
Time per request:       1.299 [ms] (mean, across all concurrent requests)
Transfer rate:          50.19 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4   3.0      3      21
Processing:     2  346 2206.7      7   18823
Waiting:        0   76 657.4      6    6371
Total:          3   90 2206.7     10   18827

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     12
  75%     15
  80%     17
  90%     26
  95%     39
  98%   6341
  99%  18820
 100%  18827 (longest request)
  • 在這種情況下,我正在使用虛擬Linux,並且正在運行Web服務器。 所以當我從另一個系統執行我的ab命令時。 在虛擬框(NAT,橋,僅主機)中進行端口轉發時會遇到什么問題。 因此,某些請求失敗。

  • 之后,當我嘗試在主機Linux上運行我的Web服務器並且在另一個系統中執行ab命令時,在100個並發進程中我得到了完美的輸出。

  • 因此,由此得出的結論是,當您從Virtual Box測試Web服務器時,我們還需要查看這種類型的負載測試,以了解硬件延遲以及端口轉發問題,但是在主機Linux系統中沒有問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM