使用Raspberry Pi作为Web服务器,我可以期待什么样的性能?


39

有没有人在Raspi上做过一些Web服务器基准测试?我还没有Raspi,但是我打算将其用作Web服务器,我很想查看以下数据的统计信息:

  • 每秒请求数
  • 请求之间的延迟响应时间
  • 吞吐量(即每秒字节数)

如果这些对于不同的Web服务器软件和OS组合而言是不同的,我也希望看到一个比较。


4
投票结束可以解释为什么吗?这是一个客观的问题,带有客观的,可衡量的答案。
AntonChanning 2012年

1
我不能权威地回答,但我认为一般来说最快的Web服务器将是RPi上最快的。我的偏好是Nginx。
Alex Chamberlain 2012年

@AlexChamberlain谢谢,有用的是要知道,但是我仍然想知道我可以从设备中获得什么样的性能,所以我不打算将它用于超出其功能的项目中……
AntonChanning 2012年

Answers:


28

我希望,正如Alex所说的那样,基准测试将显示出最快的Linux Web服务器仍然是最快的,而不管其架构如何。

如果有人想运行基准测试,那么以下教程对我很有用:

如何在网络服务器上执行基准测试


服务静态页面

我已经使用提供简单静态页面的Apache测试了RPi:

<h1>It works!</h1>

作为对照组,我使用了主要的Web服务器,它携带以下规格:

Intel(R) Xeon(R) CPU           X3323  @ 2.50GHz
384MB RAM

结果如下:

控制

ab -n 1000 -c 5 http://www.ivings.org.uk/~james/index.html

Server Software:        Apache/2.2.14
Server Hostname:        www.ivings.org.uk
Server Port:            80

Document Path:          /~james/index.html
Document Length:        19 bytes

Concurrency Level:      5
Time taken for tests:   17.767 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      294000 bytes
HTML transferred:       19000 bytes
Requests per second:    56.29 [#/sec] (mean)
Time per request:       88.833 [ms] (mean)
Time per request:       17.767 [ms] (mean, across all concurrent requests)
Transfer rate:          16.16 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       42   44   0.8     44      50
Processing:    44   45   0.9     45      59
Waiting:       44   45   0.9     45      59
Total:         86   89   1.3     88     108

Percentage of the requests served within a certain time (ms)
  50%     88
  66%     89
  75%     89
  80%     89
  90%     90
  95%     91
  98%     91
  99%     94
 100%    108 (longest request)

树莓派

ab -n 1000 -c 5 http://86.137.189.68/index.html

Server Software:        Apache/2.2.22
Server Hostname:        86.137.189.68
Server Port:            80

Document Path:          /index.html
Document Length:        19 bytes

Concurrency Level:      5
Time taken for tests:   23.186 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      304000 bytes
HTML transferred:       19000 bytes
Requests per second:    43.13 [#/sec] (mean)
Time per request:       115.930 [ms] (mean)
Time per request:       23.186 [ms] (mean, across all concurrent requests)
Transfer rate:          12.80 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       40   44   5.6     43     116
Processing:    49   71 156.1     57    2157
Waiting:       47   53   6.7     55     104
Total:         91  116 156.1     99    2198

Percentage of the requests served within a certain time (ms)
  50%     99
  66%    100
  75%    100
  80%    100
  90%    102
  95%    126
  98%    150
  99%    667
 100%   2198 (longest request)

结论

注意:最好将其作为估计值。

结果表明,Raspberry Pi实际上表现不错。它的响应速度仅比我的主要Web服务器稍差。

处理相当大量的请求应该很好。


可能是这样,但是最快的速度可以产生什么样的性能?我认为你们俩都误解了我想问的问题...
AntonChanning 2012年

1
我将在apache上执行一些基准测试并与您联系。
Jivings 2012年

谢谢。如果我的问题不清楚,我深表歉意。也许当我真正关心的是标准LAMP堆栈的实际统计数据时,我就糊涂了,要求比较。
AntonChanning 2012年

1
LAMP中的“ A”代表Apache HTTP服务器...
Roger Dahl 2012年

1
@Jivings:这是给OP的评论。在对您的帖子的最初评论中,他表示他有兴趣寻找最快的http服务器的性能,并且对基于Apache的基准测试感到不满意。然后,他继续隐式要求Apache基准测试(LAMP中的“ A”)。
罗杰·达尔

5

在提供静态内容时,Apache不是最佳选择,nginx更适合于此。我使用http://lekensteyn.nl/index.html作为测试文档进行了基准测试。它比Jiving的示例大,因为19字节对于实际页面而言是不现实的。结果非常惊人,RPi甚至胜过我的笔记本电脑(也许是因为我启用了各种内核调试开关)。

这是在Arch Linux(RPi access_log off,有线以太网)上运行的nginx 1.4.1 :

$ ab -n 1000 -c 5 http://192.168.2.10/index.html

Server Software:        nginx/1.4.1
Server Hostname:        192.168.2.10
Server Port:            80

Document Path:          /index.html
Document Length:        2159 bytes

Concurrency Level:      5
Time taken for tests:   2.341 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      2392000 bytes
HTML transferred:       2159000 bytes
Requests per second:    427.18 [#/sec] (mean)
Time per request:       11.705 [ms] (mean)
Time per request:       2.341 [ms] (mean, across all concurrent requests)
Transfer rate:          997.86 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.1      1       1
Processing:     4   11   1.0     11      20
Waiting:        3   11   1.0     10      19
Total:          4   12   1.0     12      21

Percentage of the requests served within a certain time (ms)
  50%     12
  66%     12
  75%     12
  80%     12
  90%     12
  95%     12
  98%     17
  99%     18
 100%     21 (longest request)

这是我的笔记本电脑(access_log off,有线以太网):

Server Software:        nginx/1.4.1
Server Hostname:        192.168.2.12
Server Port:            80

Document Path:          /index.html
Document Length:        2159 bytes

Concurrency Level:      5
Time taken for tests:   2.593 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      2392000 bytes
HTML transferred:       2159000 bytes
Requests per second:    385.62 [#/sec] (mean)
Time per request:       12.966 [ms] (mean)
Time per request:       2.593 [ms] (mean, across all concurrent requests)
Transfer rate:          900.79 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        2    6   3.4      5      82
Processing:     3    7   5.6      6      86
Waiting:        3    7   5.5      5      82
Total:          6   13   6.8     12      94

Percentage of the requests served within a certain time (ms)
  50%     12
  66%     13
  75%     14
  80%     15
  90%     17
  95%     19
  98%     24
  99%     34
 100%     94 (longest request)

为了完整起见,我的远程服务器。WAN连接可能会成为瓶颈,但速度较慢(access_log也没有关闭):

Server Software:        nginx/1.2.8
Server Hostname:        lekensteyn.nl
Server Port:            80

Document Path:          /index.html
Document Length:        2159 bytes

Concurrency Level:      5
Time taken for tests:   11.074 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      2370000 bytes
HTML transferred:       2159000 bytes
Requests per second:    90.30 [#/sec] (mean)
Time per request:       55.371 [ms] (mean)
Time per request:       11.074 [ms] (mean, across all concurrent requests)
Transfer rate:          209.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       25   27   2.3     26      59
Processing:    28   29   2.3     28      59
Waiting:       26   27   2.4     27      59
Total:         53   55   3.8     55     102

Percentage of the requests served within a certain time (ms)
  50%     55
  66%     55
  75%     55
  80%     55
  90%     56
  95%     57
  98%     59
  99%     86
 100%    102 (longest request)

随着更多的并发和更高的请求数,这些数字应该更可靠,因为可以包含更多的样本(当我ab以有线/无线模式与笔记本电脑碰碰时,其数字波动很大)。请注意,在使用访问日志进行测试时,当日志目录位于SD卡上时,该文件系统缓冲区会导致不可预测的写入延迟。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.