Hi chuck,

We have not set the "keep alive" explicitly in tomcat's server.xml. Howeverm 
when I print the thread id for all requests from same browser, it prints the 
same thread it. It gives me a feeling that all HTTP requests are holding worker 
thread of tomcat if they originate from same browser.

My tomcat configuration is as follows:

<Server port="${tomcat.internalserver.port}" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

    <Service name="Catalina" >

        <Executor     name="hybrisExecutor"
                                namePrefix="hybrisHTTP"
                                maxThreads="${tomcat.maxthreads}"
                                minSpareThreads="${tomcat.minsparethreads}"
                                maxIdleTime="${tomcat.maxidletime}"/>
                                
                                <Connector port="${tomcat.ajp.port}" 
                                                        maxHttpHeaderSize="8192"
                                                       maxThreads="200" 
                                                       
protocol="org.apache.coyote.ajp.AjpProtocol"
                                                       executor="hybrisExecutor"
                                                       enableLookups="false" 
                                                       acceptCount="100"
                                                       
connectionTimeout="20000" 
                                                       URIEncoding="UTF-8"
                                disableUploadTimeout="true" />

    <Connector port="${tomcat.http.port}" 
                                maxHttpHeaderSize="8192"
               maxThreads="${tomcat.maxthreads}" 
               protocol="org.apache.coyote.http11.Http11Protocol"
               executor="hybrisExecutor"
               enableLookups="false" 
               acceptCount="100"
               connectionTimeout="20000" 
               URIEncoding="UTF-8"
               disableUploadTimeout="true" />

    <Engine name="Catalina" defaultHost="localhost" 
jvmRoute="${tomcat.ajp.worker}">
        
                        <Valve  
className="org.apache.catalina.valves.FastCommonAccessLogValve"
                        directory="${HYBRIS_LOG_DIR}/tomcat"
                                prefix="access."
                                suffix=".log"
                                pattern="%{X-Forwarded-For}i %l %u %t %T %r %s 
%b %{User-Agent}i %{Referer}i %{JSESSIONID}c"
          />             

        
      <Host     name="localhost" 
                        appBase="webapps"
                        unpackWARs="true" 
                        autoDeploy="false"   
                        xmlValidation="false" 
                        xmlNamespaceAware="false">

                ${tomcat.webapps.60}
      </Host>
    </Engine>
  </Service>
</Server>

Regards,
Saurabh Agrawal
Manager Technology | Sapient


-----Original Message-----
From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] 
Sent: Wednesday, March 20, 2013 1:37 AM
To: Tomcat Users List
Subject: RE: Tomcat Behavior on Multiple HTTP requests from same browser

> From: Saurabh Agrawal [mailto:sagra...@sapient.com] 
> Subject: Tomcat Behavior on Multiple HTTP requests from same browser

> Let's say I hit http://localhost:9001/homepage.html. Upon hitting the URL, 
> tomcat will assign one of the worker threads (say Thread 1) from the pool
> to the HTTP request which will be processed and then response will be sent
> to the client. Now if I hit a link on homepage which is for login, a separate
> HTTP request will be initiated from the same browser.

> What I want to understand is if the Tomcat will keep Thread 1 as persistent 
> thread to server the second request (for login) from the same browser or will
> it assign a separate thread from the pool ?

Normally, the first available thread from the pool is used for each request.  
However, if you are using the BIO <Connector> with keep-alives enable *and* the 
browser is using keep-alives, the same thread as long as the HTTP connection is 
active.

See the HTTP <Connector> doc, especially the Connector Comparison at the end.

http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to