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
I'm not sure what exactly are you asking, but you can only bind one port to one process.
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
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
that adds overhead no
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
sounds like cloud functions minus the benefits
at the same time, it completely eliminates any possibility for slow memory leaks
true
This is what I was confused about
Thanks
👍