unit icon indicating copy to clipboard operation
unit copied to clipboard

python simultaneously worker launch

Open TheFatal opened this issue 3 years ago • 7 comments

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

TheFatal avatar Jan 26 '23 10:01 TheFatal

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?

tippexs avatar Jan 27 '23 13:01 tippexs

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

TheFatal avatar Jan 27 '23 13:01 TheFatal

Same issue on our end.

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

micaelmalta avatar Mar 22 '23 21:03 micaelmalta

Possibly related to #794.

joanhey avatar Mar 24 '23 17:03 joanhey

@tippexs any news on this issue?

micaelmalta avatar Sep 13 '23 22:09 micaelmalta

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

tippexs avatar Dec 06 '23 15:12 tippexs

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.

ac000 avatar Dec 06 '23 20:12 ac000