Http Requests

Is the number of threads used to listen to http requests controlled by the developer I've been using node and I know that's single threaded, is that always the case where a single threads listens for requests or do some languages allow different threads listen to requests before handing over to handlers
10 Replies
Joao
Joao17mo ago
I'm not sure what exactly are you asking, but you can only bind one port to one process.
ErickO
ErickO17mo ago
there's one entry point for http requests but the controller can and usually does spawn additional thread in multi-threaded languages so the handling of the request is multi-threaded the listening isn't
Jochem
Jochem17mo ago
Lots of backend languages don't have a persistent running process, they leave the listening to Apache or nginx and are started to process the request then end. Coming from PHP, having a continuously running server process where you can store data seems... off to me. A PHP script does all its setup right at the start of the request, then discards everything at the end
ErickO
ErickO17mo ago
that adds overhead no
Jochem
Jochem17mo ago
it's a thing to keep in the back of your head it is extra overhead, yes, but usually all you're doing on the backend as setup in PHP is connecting to the database
ErickO
ErickO17mo ago
sounds like cloud functions minus the benefits PepeLaugh
Jochem
Jochem17mo ago
at the same time, it completely eliminates any possibility for slow memory leaks
ErickO
ErickO17mo ago
true
Electronic
Electronic17mo ago
This is what I was confused about Thanks
ErickO
ErickO17mo ago
👍
Want results from more Discord servers?
Add your server