We have a Rails app inside a Unicorn app server. Unicron works with processes(unlike Puma for example that works with threads).

I understand the general architecture, where there's one master process which somehow pass each request to a worker. I'm not sure how though.

If we have 5 workers, it means we have 5 process that run all the time? or the master forks a new process for each request, and when a worker finish handling a request it dies?

How does the request pass to the worker?

Also, if there's an elaborated article about unicorn architecture as a reference it would be amazing!

1

There are 1 best solutions below

0
Tibic4 On

The master process forks a new worker for each request, and when the worker finish handling the request it dies. The master process pass the request to the worker by using a socket. To pass the request the master process writes the request to the socket and the worker reads it.