0

When we hit app server(apache tomcat) on ,it creates a thread to process our request and connect with tomcat ,build connection and tomcat creates another thread to process request and deliver it to the connection and connection thread delivers it to client.

But we nodejs has event loop(on task at a time till completion).When request comes to nodejs server ,event loop picks request from listener queue and delegates the task to worker threads that runs on background. now event loop is free to pick other requests,when worker thread has completed the processing it send the data to call back and event loop picks call back from callback queue if there is nothing to else to do in main stack.

I want to clear my doubt regarding app server and node server

App server : thread created by server to connect tomcat is responsible for delivering data to client for that particular request ? Am i right?

But how nodejs knows to which request it needs to deliver response?How it is maintaining the connection for every request? Im my understanding of request processing is right for both kind of servers?

2
  • possible duplicate : stackoverflow.com/questions/36636790/… Commented Mar 13, 2019 at 12:28
  • no,my question is related to the connection processing by nodejs.Ho wit maintain connections when it has single thread to run callback Commented Mar 13, 2019 at 12:31

1 Answer 1

1

node.js server is where your node program runs where as apache/nginx is just a reverse proxy server. a reverse proxy server is often used with node.js server.

Sign up to request clarification or add additional context in comments.

1 Comment

my question is regarding the maintainence of connection.How event loop thread maintain socket connection for concurrent requests ie when call back is executed ,how it knows which request response it is?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.