• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One Thread per request ?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, first question on coderanch solved in less than 2 hours, happy to signed-up
Thanks a lot.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic