V
V
Viktor Yakovenko2020-08-03 12:23:14
Ruby on Rails
Viktor Yakovenko, 2020-08-03 12:23:14

How many instances of a single rails application are running at the same time?

What happens when more than one request arrives - does it wait for rails to finish processing the previous one, or does it fork a new process for each new request?
If there is more than one process, then "who" "spawns" them - maybe rack ? (thumbs up :-) )
If there are a lot of processes, then how does the class caching mechanism work, etc.? of things ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zaporozhchenko Oleg, 2020-08-05
@c3gdlk

Rails is a thread-safe application, but does not by itself decide how it will work. Maybe so and so.
Rails is a rack compatible web framework that will work with any rack compatible web server. And the server decides how it will scale. Unicorn only forks, but it forks immediately, not on demand. Puma also forks, but there are several more streams in each fork.
Therefore, nginx is put in front of Rails in the production, which is able to hold any number of requests and wait until ruby ​​is free

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question