0

I am trying to understand exactly how requests to a rails application get processed with Phusion Passenger. I have read through the Passenger docs (found here: http://www.modrails.com/documentation/Architectural%20overview.html#_phusion_passenger_architecture) and I understand how they maintain copies of the rails framework and your application code in memory so that every request to the application doesn't get bogged down by spinning up another instance of your application. What I don't understand is how these separate application instances share the native ruby process on my linux machine. I have been doing some research and here is what I think is happening:

One request hits the web server which dispatches Passenger to fulfill the request on one of Passenger's idle worker processes. Another request comes in almost simultaneously and is handled by yet another idle Passenger worker process.

At this point there are two requests being executed which are being managed by two different Passenger worker processes. Passenger creates a green thread on Linux's native Ruby thread for each worker process. Each green thread is executed using context-switching so that blocking operations on one Passenger worker process do not prevent that other worker process from being executed.

Am I on the right track?

Thanks for your help!

4

1 回答 1

2

应用程序实例不“共享本机 Ruby 进程”。应用程序实例Ruby 进程(或 Node.js 进程或 Python 进程,具体取决于您的应用程序是用什么语言编写的),也与“Passenger worker 进程”相同。它也与线程无关。

于 2013-11-12T09:38:46.040 回答