Re: splitting thread pool
You can create a filter or run on separate Tomcat instances. NB: You are not solving the cause, but the effect. You don't have enough threads or cpu-power to handle the total load. Ronald. Op maandag, 29 juni 2009 07:12 schreef prashant sharma : Hi, I have the following attributes in the server.xml file: Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true / The web application that I am working on exposes many webservices, which are invoked from other applications. The problem I am facing is that when my application gets a lot of webservice requests, it reaches the limit of maxThreads. After this limit is reached I am not able to open the webpage for my web application. Is there any way to configure my web application such that I have a separate quota of threads for webpage access and a separate quota for other types of accesses like webservice requests? Thanks! Prashant
Re: splitting thread pool
Thanks for your response Ronald! Won't a filter be a part of the thread pool? I mean every incoming request would create a new thread and filter would be invoked on this new thread ...right? The solution that I am looking for is to partition the thread pool into 2 parts One that serves the webpage requests and the other that is allocated to the internal processing of the web application. Thanks! Prashant From: Ronald Klop ronald-mailingl...@base.nl To: Tomcat Users List users@tomcat.apache.org Cc: prashant sharma psharma_...@yahoo.com Sent: Monday, June 29, 2009 4:57:53 AM Subject: Re: splitting thread pool You can create a filter or run on separate Tomcat instances. NB: You are not solving the cause, but the effect. You don't have enough threads or cpu-power to handle the total load. Ronald. Op maandag, 29 juni 2009 07:12 schreef prashant sharma : Hi, I have the following attributes in the server.xml file: Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true / The web application that I am working on exposes many webservices, which are invoked from other applications. The problem I am facing is that when my application gets a lot of webservice requests, it reaches the limit of maxThreads. After this limit is reached I am not able to open the webpage for my web application. Is there any way to configure my web application such that I have a separate quota of threads for webpage access and a separate quota for other types of accesses like webservice requests? Thanks! Prashant
Re: splitting thread pool
If you have maxThreads=100 and you create a filter which blocks A if threadRunningA=10 and blocks B if threadsRunningB=90 than you can tune it the way you want it to be without seeing TooManyThreads errors from Tomcat. Or make it 9 vs. 89 to be safe. Still it doesn't solve you real problem about not being able to deliver enough performance to handle the total load. Which is probably solvable by profiling your application or running a cluster or splitting the services over more machines. Ronald. Op maandag, 29 juni 2009 15:44 schreef prashant sharma : Thanks for your response Ronald! Won't a filter be a part of the thread pool? I mean every incoming request would create a new thread and filter would be invoked on this new thread ...right? The solution that I am looking for is to partition the thread pool into 2 parts One that serves the webpage requests and the other that is allocated to the internal processing of the web application. Thanks! Prashant From: Ronald Klop ronald-mailingl...@base.nl To: Tomcat Users List users@tomcat.apache.org Cc: prashant sharma psharma_...@yahoo.com Sent: Monday, June 29, 2009 4:57:53 AM Subject: Re: splitting thread pool You can create a filter or run on separate Tomcat instances. NB: You are not solving the cause, but the effect. You don't have enough threads or cpu-power to handle the total load. Ronald. Op maandag, 29 juni 2009 07:12 schreef prashant sharma : Hi, I have the following attributes in the server.xml file: Connector port=80 maxThreads=150 minSpareThreads=25 maxSpareThreads=75 enableLookups=false redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 disableUploadTimeout=true / The web application that I am working on exposes many webservices, which are invoked from other applications. The problem I am facing is that when my application gets a lot of webservice requests, it reaches the limit of maxThreads. After this limit is reached I am not able to open the webpage for my web application. Is there any way to configure my web application such that I have a separate quota of threads for webpage access and a separate quota for other types of accesses like webservice requests? Thanks! Prashant
Re: splitting thread pool
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Prashant, On 6/29/2009 1:12 AM, prashant sharma wrote: Is there any way to configure my web application such that I have a separate quota of threads for webpage access and a separate quota for other types of accesses like webservice requests? The only way I know of to do this is with separate connectors: you would configure them separately so that the webapp one (that is, the one that handles traditional human clients reading web pages) is separate from the web service one (that is, the one that services only web service clients). Two have two connectors, you either need a second port number to use (not terribly convenient, since ports other than 80 and 443 are often blocked by firewalls, etc.) or a second IP address to use (also not terribly convenient since your web service calls need to be coded to hit a different host). Another option is to use a front-controller like Apache httpd to direct traffic: 1. Install httpd and configure it to work with your existing webapp, configured to handle everything just as it works today. Use your choice of mod_jk or mod_proxy_http/ajp. Make sure you have httpd configured to accept enough requests for your expected (or observed) peak load. 2. Add a second Connector on a different port. Don't worry about firewall issues as this port doesn't need to be available to the outside world. 3. Change your httpd proxy configuration (ProxyPass or JkMount) so that the URIs for web services are directed to the /second/ connector you created in #2 above. This will allow httpd to act as a traffic cop to direct web service requests to that second connector, which can (of course!) be configured separately and/or differently than the one for web clients. Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpI1GIACgkQ9CaO5/Lv0PBLXQCgroWHtSNDkvwhJP6WPbnCt3b7 BmEAoMJm80XQaCNgWMWDE29pFYAmbq8O =rhVV -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: splitting thread pool
Thanks for a detailed response Chris! I am quite new to tomcat...It would be really helpful if you could give some reference links to the things you are talking about in 1 and 3 below? Thanks! Prashant From: Christopher Schultz ch...@christopherschultz.net To: Tomcat Users List users@tomcat.apache.org Sent: Monday, June 29, 2009 10:49:06 AM Subject: Re: splitting thread pool -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Prashant, On 6/29/2009 1:12 AM, prashant sharma wrote: Is there any way to configure my web application such that I have a separate quota of threads for webpage access and a separate quota for other types of accesses like webservice requests? The only way I know of to do this is with separate connectors: you would configure them separately so that the webapp one (that is, the one that handles traditional human clients reading web pages) is separate from the web service one (that is, the one that services only web service clients). Two have two connectors, you either need a second port number to use (not terribly convenient, since ports other than 80 and 443 are often blocked by firewalls, etc.) or a second IP address to use (also not terribly convenient since your web service calls need to be coded to hit a different host). Another option is to use a front-controller like Apache httpd to direct traffic: 1. Install httpd and configure it to work with your existing webapp, configured to handle everything just as it works today. Use your choice of mod_jk or mod_proxy_http/ajp. Make sure you have httpd configured to accept enough requests for your expected (or observed) peak load. 2. Add a second Connector on a different port. Don't worry about firewall issues as this port doesn't need to be available to the outside world. 3. Change your httpd proxy configuration (ProxyPass or JkMount) so that the URIs for web services are directed to the /second/ connector you created in #2 above. This will allow httpd to act as a traffic cop to direct web service requests to that second connector, which can (of course!) be configured separately and/or differently than the one for web clients. Hope that helps, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpI1GIACgkQ9CaO5/Lv0PBLXQCgroWHtSNDkvwhJP6WPbnCt3b7 BmEAoMJm80XQaCNgWMWDE29pFYAmbq8O =rhVV -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: splitting thread pool
From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: splitting thread pool The only way I know of to do this is with separate connectors: One thing that hasn't been discussed is whether HTTP keep-alives are involved. If so, then using the NIO connector would free up threads that are otherwise doing nothing but waiting for more requests on the same connection to show up. (Disabling keep-alives would also do this, with an associated performance cost.) An alternative to using a filter, multiple connectors, or impacting performance with a front-end traffic cop is to use a set of ServletRequestListener classes that would keep track of the number of concurrent requests for the webapps of interest, and throttle accordingly. Since that would run in-process, it should give better performance and be less overhead than any kind of front-end director. - 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.