【问题标题】:Nginx + passenger serving 4 requests/s for a static pageNginx + 乘客为静态页面提供 4 个请求/秒
【发布时间】:2015-08-29 03:13:46
【问题描述】:

我使用Passenger 和Nginx 将我的应用程序部署到Digitalocean。我使用 apache bench 来查看每秒可以在静态页面上获得多少个请求(简单的 hello world rails 视图),但我只收到 4 个请求/秒。

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

Benchmarking 107.170.100.242 (be patient).....done


Server Software:        nginx/1.8.0
Server Hostname:        107.170.100.242
Server Port:            80

Document Path:          /fo
Document Length:        5506 bytes

Concurrency Level:      1
Time taken for tests:   22.662 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      632600 bytes
HTML transferred:       550600 bytes
Requests per second:    4.41 [#/sec] (mean)
Time per request:       226.617 [ms] (mean)
Time per request:       226.617 [ms] (mean, across all concurrent requests)
Transfer rate:          27.26 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   181  226  65.4    204     445
Waiting:      181  226  65.4    204     445
Total:        181  227  65.4    204     446

当我使用 Nginx 时,它应该是每秒数千。我一直在研究这个问题一整天都没有结果,有人可以指导我找到正确的路径来解决这个问题吗?

【问题讨论】:

  • 您确定使用 nginx 而不是您的应用服务器提供静态页面吗?即使对乘客来说也很慢。
  • @errata 我关注了这个digitalocean.com/community/tutorials/…
  • 根 /var/www/my_app/public;
  • 你和服务器之间有很多延迟吗?

标签: ruby-on-rails nginx passenger digital-ocean


【解决方案1】:

这将是 nginx 配置指令,将导致它绕过应用服务器并直接提供静态文件:

root /var/www/my_app/public; 

你确定这是对的吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 2012-09-06
    • 1970-01-01
    相关资源
    最近更新 更多