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

我有一个使用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.

(强调我自己)

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...