Tomcat behavior when two simultaneous requests come from the same ip

When I try to run 2 wget commands at the same time on my server (http: // myserver), it looks like tomcat allocates two threads to process them. But I believe that when tomcat receives two at the same time from the same ip address, it will not create a new thread to process the second request, since it believes that both requests come from the same session.

If I want to check if both threads are the same or different, does thread.getId () use the only way? I think this identifier can be reused for new threads. Is there any unique property of an existing thread to verify its identity other than threadid?

+3
source share
3

, . , NIO. .

+2

- ( ) , , .

IO (nio), .

, Thread.getId() - .

- , .

IP- , IP-, NAT.

+1

, Tomcat , , IP-. , , IP-, , Tomcat [ ].

in your case, you need to configure wget to store session-id [the Tomcat web application can send it via a cookie or as a URL parameter - jsessionid]. wget will then have to send it back with subsequent requests [url rewrite and enable the option jsessionidor exchange cookies]. in this way, Tomcat will be able to process every request coming from a unique client instance and bind state to it.

0
source

Source: https://habr.com/ru/post/1792441/


All Articles