3 Replies Latest reply on Sep 24, 2009 11:09 AM by Peter Johnson

    maxThreads/ThreadPool configuration

    Janardan N Newbie

      I'm little confused with the following 2 parameters
      1. <Connector port="8443" maxThreads="500" in server\default\deploy\jboss-web.deployer\server.xml

      2.
      JBoss System Threads
      10
      in \server\default\conf\jboss-service.xml

      First one is referring to the max no. of HTTP threads that the server handle
      How the MaximumPoolSize is related to this one?

      My application has to handle 500 concurrent requests.
      My application is running on a server with 2GB RAM. My JBoss version is 4.2.3.
      I've used the below configuration:
      1. maxThreads="500" in HTTPConnector
      2. MaximumPoolSize is 10 in jboss-service.xml
      3. max-pool-size = 60 in mssql-ds.xml

      Is there any issue in my configuration?

      When I'm running load test
      With <200 users, application is running fine
      Beyond 200 users, I'm getting the errors "Peer shut down incorrectly" and
      "500 Internal Server error"

        • 1. Re: maxThreads/ThreadPool configuration
          Peter Johnson Master

          First, there should be stack traces in the console log or in server.log that correspond to the errors you mentioned. Post one of thos stack traces.

          The max-pool-size seems very low. How likely is it that an HTTP request will need a database connection? If every request needs a connection, then max-pool-size should be closer to maxThreads. Most likely what happened for the 500 error is that too many HTTP requests were waiting for a database connection and thus were turned away.

          • 2. Re: maxThreads/ThreadPool configuration
            Janardan N Newbie

            Thanks Peter for valuable inputs.

            1. Below is the exception stack trace I'm seeing in during load test beyond the 200 users

            2009-09-26 14:33:28,453 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/MedNetPortal].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
            java.lang.IllegalStateException: setAttribute: Session already invalidated
             at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1289)
             at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1254)
             at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:130)
             at com.sun.faces.taglib.jsf_core.ViewTag.doEndTag(ViewTag.java:283)
             at org.apache.jsp.jsp.common.login.Login_jsp._jspx_meth_f_005fview_005f0(Login_jsp.java:202)
             at org.apache.jsp.jsp.common.login.Login_jsp._jspService(Login_jsp.java:100)
             at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
             at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
             at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
             at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:97)
             at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
             at com.hospira.mednet.portal.view.common.controller.PortalExTranFilter.doFilter(PortalExTranFilter.java:46)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:198)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
             at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
             at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
             at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
             at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
             at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
             at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:473)
             at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:141)
             at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
             at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
             at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
             at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
             at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
             at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
             at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
             at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
             at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
             at com.hospira.mednet.portal.view.common.controller.PortalExTranFilter.doFilter(PortalExTranFilter.java:46)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
             at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
             at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
             at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
             at java.lang.Thread.run(Thread.java:595)
            


            2. In my application, almost 90% http requests will require a DB Connection.
            I configured maxThreads="500", max-pool-size = 500

            Still I could see the errors

            I am running JBoss 4.2.3 on Intel Xeon CPU, E5405 @2.00 G.Hz,3.99 GB RAM

            any pointers for my solution please...!

            • 3. Re: maxThreads/ThreadPool configuration
              Peter Johnson Master

              1) That is a JSF-related error. I'll leave it to someone more familiar with Faces to help you with that one.

              2) Make sure that your database will alllow 500 connection.