To provide an answer and prevent users from searching by comment, dyno is like an entire computer. Using Procfile , you give each of your dynos one command to run, and it scrolls this command, runs it periodically to update it, to run it when it fails. As you can imagine, itβs rather wasteful to spend the whole computer on a single-threaded web server and whatβs there Gunicorn .
The main stream of Gunicorn does nothing but a proxy server, generates a certain number of copies of your application (workers), distributing HTTP requests among them. He uses the fact that there are several cores on each dynot. As already mentioned, the number of workers you have to choose depends on how much memory your application needs.
Contrary to what Bob Spring said in the last comment, there are other ways to use this feature for parallelism to run separate servers on the same dinodera. The easiest way is to create a separate sub-file and run the equivalent of all-Python Foreman , Honcho , from your main Procfile file, following these instructions . Essentially, in this case, your only dyno command is a program that manages several single commands. It is similar to the fact that he is given one desire from the genie and make it wish 4 more wishes.
The advantage of this is that you can fully utilize the capabilities of your dinosaurs. The disadvantage of this approach is that you lose the ability to scale individual parts of your application independently when they share the dynamic. When you scale a dynamometer, it will scale everything that you multiplexed on it, which may be undesirable. You may have to use diagnostics to decide when to put the service on your own dedicated dyno.
acjay source share