Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 2704 invoked from network); 3 Mar 2010 17:46:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Mar 2010 17:46:21 -0000 Received: (qmail 94977 invoked by uid 500); 3 Mar 2010 17:46:10 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 94934 invoked by uid 500); 3 Mar 2010 17:46:10 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 94925 invoked by uid 99); 3 Mar 2010 17:46:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 17:46:09 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.61.61.109] (HELO usea-naimss4.unisys.com) (192.61.61.109) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 17:46:00 +0000 Received: from usea-nagw2.na.uis.unisys.com ([129.224.72.18]) by usea-naimss4 with InterScan Message Security Suite; Wed, 03 Mar 2010 11:45:38 -0600 Received: from usea-nagw2.na.uis.unisys.com ([129.224.72.53]) by usea-nagw2.na.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Mar 2010 11:45:38 -0600 Received: from usea-nahubcas2.na.uis.unisys.com ([129.224.76.115]) by usea-nagw2.na.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Mar 2010 11:45:38 -0600 Received: from USEA-EXCH8.na.uis.unisys.com ([129.224.76.42]) by usea-nahubcas2.na.uis.unisys.com ([129.224.76.115]) with mapi; Wed, 3 Mar 2010 11:45:37 -0600 From: "Caldarale, Charles R" To: Tomcat Users List Date: Wed, 3 Mar 2010 11:45:34 -0600 Subject: RE: Tomcat threads Thread-Topic: Tomcat threads Thread-Index: Acq69gWoXZplSZO1S1qNTW/Yr/Hn5AAAC3WA Message-ID: <99C8B2929B39C24493377AC7A121E21F96CB8758AE@USEA-EXCH8.na.uis.unisys.com> References: <6c81069d1003021547x297e5ee7r1ad66f67bf46dd@mail.gmail.com> <99C8B2929B39C24493377AC7A121E21F96CB817BB2@USEA-EXCH8.na.uis.unisys.com> <6c81069d1003021625n18601bffq52d9b920e28d4d20@mail.gmail.com> <99C8B2929B39C24493377AC7A121E21F96CB817BE5@USEA-EXCH8.na.uis.unisys.com> <6c81069d1003021642j3fd995d4s4d99c4cab86572df@mail.gmail.com> <99C8B2929B39C24493377AC7A121E21F96CB817CA7@USEA-EXCH8.na.uis.unisys.com> <6c81069d1003030921l5c686987jb1bed5c2d2dbda3e@mail.gmail.com> In-Reply-To: <6c81069d1003030921l5c686987jb1bed5c2d2dbda3e@mail.gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 03 Mar 2010 17:45:38.0371 (UTC) FILETIME=[55DDE930:01CABAF9] > From: Bharath Vasudevan [mailto:bharath.cng@gmail.com] > Subject: Re: Tomcat threads >=20 > When tomcat gets a request, it does a socket send to some=20 > other process to handle the request and then respond. Tomcat doesn't do that - your webapp does. You have now introduced a previously unmentioned dependency - that the resp= onse depends on the behavior of an external resource, unrelated to Tomcat. = That changes the picture considerably. The neat thing the servlet 3.0 Asy= ncContext does is handle this case by letting you decouple the original Req= uest and Response objects from the original processing thread. > But assuming 20k client requests come in at the same time, > the server would try to allocate 20k threads and handle it. No, the server will allocate maxThreads request handlers; the other request= s would sit in the TCP stack's queue (not in the JVM), up to the configured= acceptCount value - which you can set as high as your OS allows. > Mostly the system would trash and go down. Which is my point about why you don't want to set maxThreads to arbitrarily= large (or small) values. > But if it was to be handled gracefully, we can have the=20 > threads pick up the request throw it in a queue and let > the worker threads work and respond. Which you can do in your webapp by sending an interim response to the clien= t and having the client poll for the final one. You'd have to disable keep= -alives as well. The 3.0 spec allows the container to perform this task, r= ather than requiring the webapp to do so. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MA= TERIAL 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 atta= chments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org