• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

One Thread per request ?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have a question about how tomcat handle requests.
I read that tomcat run a new thread for each new request, but after some tests I'm a bit confused.
Here is what I have tried.



Then When I do two calls at the same time I can see that the second call wait for the first one to finish before start.


So it doesn't seem to match with the "one thread per request".

Does someone can tell me what's happening here ?

If it can help:
java version "1.8.0_161"
apache-tomcat-9.0.4

Thanks
 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Walle, welcome to the Ranch!

If those two requests came from the same client, then what you are seeing shows that the client waits for the response from the first request before sending the second request.

But you didn't show us how you produced the two requests, so by all means show us how you did that if you'd like to discuss it.
 
Walle Tanner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul, and thanks!

I just call the same URL(localhost:8080/testapp/hello) from two tabs in chrome, but after reading your

If those two requests came from the same client


I did the two calls with two different browsers and then the two calls from IE and it works fine
So I guess it is a chrome issue and I'm not sure anymore if it's the right place to discuss about that, but I'm still curious about this behaviour.
 
Paul Clapham
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The part about Chrome is sort of strange, but at least you have got your original question answered. At any rate, whatever Chrome is doing is unrelated to the servlet specs.
 
Walle Tanner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, first question on coderanch solved in less than 2 hours, happy to signed-up
Thanks a lot.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic