微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

(强调我自己)

原文地址:https://www.jb51.cc/ruby/265062.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐