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
Joao2y ago
I'm not sure what exactly are you asking, but you can only bind one port to one process.
ErickO
ErickO2y 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
Jochem2y 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
ErickO2y ago
that adds overhead no
Jochem
Jochem2y 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
ErickO2y ago
sounds like cloud functions minus the benefits PepeLaugh
Jochem
Jochem2y ago
at the same time, it completely eliminates any possibility for slow memory leaks
ErickO
ErickO2y ago
true
Electronic
ElectronicOP2y ago
This is what I was confused about Thanks
ErickO
ErickO2y ago
👍
Want results from more Discord servers?
Add your server