【问题标题】:Ruby concurrent tweak for passenger in standalone mode独立模式下乘客的 Ruby 并发调整
【发布时间】:2020-08-12 10:42:31
【问题描述】:

我有一个使用 nginx 作为反向代理和独立乘客的 Rails 5.2.3 应用程序。我遇到了 websockets 的性能问题,并且看到我们需要在使用 web sockets 时调整乘客,如此处所示https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_force_max_concurrent_requests_per_process

我看到在使用 nginx 时,我们需要对特定端点进行以下更改以接受无限并发连接

server {
   listen 80;
   server_name www.example.com;
   root /webapps/my_app/public;
   passenger_enabled on;

   # Use default concurrency for the app. But for the endpoint
   # /special_websocket_endpoint, force a different concurrency.
   location /special_websocket_endpoint {
       passenger_app_group_name foo_websocket;
       passenger_force_max_concurrent_requests_per_process 0;
   }
}

我如何在使用独立乘客时指定这样的配置。对此的任何帮助都会非常有帮助。谢谢。

【问题讨论】:

    标签: websocket ruby-on-rails-5 passenger


    【解决方案1】:

    查看文档后发现我们可以在项目根目录下的Passengerconfig.json文件中放入配置细节。

    我想要的并发调整可以通过将它放在配置文件中来实现

    {
      "environment": "production",
      "unlimited_concurrency_paths": [
        "/cable"
      ]
    }
    

    更多关于独立模式下的配置变量可以在这里找到

    https://www.phusionpassenger.com/docs/references/config_reference/standalone/#--disable-anonymous-telemetry-disable_anonymous_telemetry

    【讨论】:

      猜你喜欢
      • 2013-11-30
      • 2012-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-28
      • 1970-01-01
      • 2011-12-11
      • 1970-01-01
      相关资源
      最近更新 更多