简体   繁体   English

Nginx +为静态页面提供4个请求/秒的乘客

[英]Nginx + passenger serving 4 requests/s for a static page

I deployed my app to Digitalocean with Passenger and Nginx. 我将我的应用程序与Passenger和Nginx一起部署到了Digitalocean。 I used apache bench to see how many requests per second I can get on a static page (simple hello world rails view), but I am only getting 4 requests/s. 我使用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

It should be literally thousands per second as I am using Nginx. 当我使用Nginx时,它应该每秒几千个。 I have been researching this for the entire day without results, can someone please direct me to the right path to solve this? 我整天都在研究此问题,但没有结果,有人可以指导我解决问题的正确方法吗?

This would be the nginx config directive that will cause it to bypass the app server and serve the static files directly: 这将是nginx config指令,它将导致它绕过应用服务器并直接提供静态文件:

root /var/www/my_app/public; 

Are you sure that is right? 你确定对吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM