加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – Phusion乘客中的多个请求是否在他们自己的线程中运行?

发布时间:2020-12-16 23:09:08 所属栏目:百科 来源:网络整理
导读:我有一个使用Phusion客户Apache Web服务器部署的 Ruby on Rails应用程序.每个请求是否都在由Phusion Passenger产生的自己的线程中运行? 解决方法 Passenger(以及大多数其他应用程序服务器)每个线程运行的请求不超过一个.通常,每个进程也只有一个线程.从 Phu
我有一个使用Phusion客户Apache Web服务器部署的 Ruby on Rails应用程序.每个请求是否都在由Phusion Passenger产生的自己的线程中运行?

解决方法

Passenger(以及大多数其他应用程序服务器)每个线程运行的请求不超过一个.通常,每个进程也只有一个线程.从 Phusion Passenger docs:

Phusion Passenger supports two concurrency models:

  • process: single-threaded,multi-processed I/O concurrency. Each application process only has a single thread and can only handle 1 request at a time. This is the concurrency model that Ruby applications traditionally used. It has excellent compatibility (can work with applications that are not designed to be thread-safe) but is unsuitable workloads in which the application has to wait for a lot of external I/O (e.g. HTTP API calls),and uses more memory because each process has a large memory overhead.

  • thread: multi-threaded,multi-processed I/O concurrency. Each application process has multiple threads (customizable via PassengerThreadCount). This model provides much better I/O concurrency and uses less memory because threads share memory with each other within the same process. However,using this model may cause compatibility problems if the application is not designed to be thread-safe.

(强调我自己)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读