nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.37k stars 323 forks source link

python simultaneously worker launch #832

Open TheFatal opened 1 year ago

TheFatal commented 1 year ago

Is it possible to launch python workers simultaneously like uwsgi or gunicorn does ? In current state when i set for example: processes: 60 unit starts workers one after another after another etc, so it takes more than 10 minutes for my app

tippexs commented 1 year ago

Hi @TheFatal atm this is the way it is / was implemented but we are sure there is some space for improvement. I will flag this as an enhancement and chat with our engineering team about it and update this issue as we go.

Are you available for testing any patches we will come along with?

TheFatal commented 1 year ago

thanks tou for the reply, for sure i can test some patchs on my app

micaelmalta commented 1 year ago

Same issue on our end.

It also cause some issues for some benchmark testing: https://github.com/TechEmpower/FrameworkBenchmarks/issues/8059

joanhey commented 1 year ago

Possibly related to #794.

micaelmalta commented 1 year ago

@tippexs any news on this issue?

tippexs commented 10 months ago

Hi @micaelmalta sorry for the late response! Some things have changed on our end but I am happy to be back on things :)

So what you are saying is basically that IF the Unit configuriation is like "processes": 60 it will take minutes to start / restart Unit and the application processes? We will investigate this and I will also check the TechPower Bench. Sorry for letting this falling of my radar. Will keep you posted

ac000 commented 10 months ago

The way it works is that for each application we start a prototype process, this is then used to fork(2) off however many application processes are required. fork(2) (on Linux at least) is a pretty quick operation, say single digit ms, see for example my comment here where I started up 84 PHP application process in short order.

Here I start 60 (albeit minimal) Python application processes.

2023/12/06 19:53:42 [info] 4325#4325 router started
2023/12/06 19:53:42 [info] 4326#4326 "python" prototype started
2023/12/06 19:53:42 [info] 4327#4327 "python" application started
...
2023/12/06 19:53:43 [info] 4386#4386 "python" application started

@TheFatal (or anyone else) Could you confirm what OS you are using?

Could you also provide a clean unit.log (make sure debugging is OFF) from when starting your application.