Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 30843200BFE for ; Mon, 16 Jan 2017 11:24:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 2F005160B30; Mon, 16 Jan 2017 10:24:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 03EA6160B22 for ; Mon, 16 Jan 2017 11:24:49 +0100 (CET) Received: (qmail 28463 invoked by uid 500); 16 Jan 2017 10:24:48 -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 28451 invoked by uid 99); 16 Jan 2017 10:24:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2017 10:24:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id C2A1FC0D91 for ; Mon, 16 Jan 2017 10:24:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.8 X-Spam-Level: X-Spam-Status: No, score=0.8 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id k1-A0PNMJ_SJ for ; Mon, 16 Jan 2017 10:24:46 +0000 (UTC) Received: from thor.wissensbank.com (thor.wissensbank.com [81.169.250.120]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 89E205F576 for ; Mon, 16 Jan 2017 10:24:45 +0000 (UTC) Received: from thor.wissensbank.com (localhost [127.0.0.1]) by thor.wissensbank.com (Postfix) with ESMTP id 8B4AA15A60DF7 for ; Mon, 16 Jan 2017 11:24:44 +0100 (CET) Received: by thor.wissensbank.com (Postfix, from userid 500) id 6DDBD15A61058; Mon, 16 Jan 2017 11:24:44 +0100 (CET) Received: from [192.168.245.129] (pd956abfc.dip0.t-ipconnect.de [217.86.171.252]) (Authenticated sender: andre.warnier@ice-sa.com) by thor.wissensbank.com (Postfix) with ESMTPA id 45FDE15A60DF7 for ; Mon, 16 Jan 2017 11:24:43 +0100 (CET) Subject: Re: FW: tomcat 8080 thread not reduced To: users@tomcat.apache.org References: <07fc01d26b27$f2d07510$d8715f30$@zoom.us> <076901d26e2f$b7f487a0$27dd96e0$@zoom.us> <587BC717.9000506@ice-sa.com> <1484534494.63803009@f21.my.com> <587C853B.6010208@ice-sa.com> <081601d26fd5$a3d18460$eb748d20$@zoom.us> <587C9B65.3060701@ice-sa.com> <08a201d26fe0$c57803e0$50680ba0$@zoom.us> From: =?UTF-8?Q?Andr=c3=a9_Warnier_=28tomcat=29?= Message-ID: <587C9F6B.7090107@ice-sa.com> Date: Mon, 16 Jan 2017 11:24:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <08a201d26fe0$c57803e0$50680ba0$@zoom.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP archived-at: Mon, 16 Jan 2017 10:24:51 -0000 On 16.01.2017 11:10, smith wrote: > We has same problem on dev env that no any traffic to the serive, Ah. That is /new/ information, which may change the suggestions below. It looks like you should really find out what these threads are doing, probably by doing a few thread dumps. See here e.g. : http://stackoverflow.com/questions/18573411/tomcat-thread-dump Again : we do not know your application, so we can only make guesses based on the information that you provide. will try on dev first > > -----Original Message----- > From: André Warnier (tomcat) [mailto:aw@ice-sa.com] > Sent: Monday, January 16, 2017 10:08 AM > To: users@tomcat.apache.org > Subject: Re: FW: tomcat 8080 thread not reduced > > On 16.01.2017 09:50, smith wrote: >> Busy one is process customer request, do not know what non-busy one is >> doing, always keep 120 for many days. I don't think 20s timeout will >> not cause so long connection >> >> -smith > > And did you actually try it ? > > We do not know your website or your application, so we cannot tell how many clients there are, what these clients are really requesting, how many requests each client is sending before going away, etc. > > KeepAlive means that when a client has sent its /last/ request and received the response, one thread is going to remain "not free" (but doing nothing) for the duration of the KeepAlive timeout. This thread will keep waiting, for KeepAliveTimeout seconds, just in case the client would still send another request (which it may never do, depending on the application). > > Imagine that your application is so that the average client > - connects to your site > - sends a single HTTP request, which gets processed in 0.1 s > - receives the response > - and then goes away > and that the above sequence happens once every second, from different clients. > After one second, there will be one thread waiting for another 19 seconds before becoming free (and potentially destroyed or re-used). After 2 seconds, there will be 2 such threads. After 3 seconds, 3 threads. And so on. After 20 seconds, the first thread will be freed, but there will be 19 other threads still waiting, and one new thread just created. > If everything stays perfectly regular like that, your will have /permanently/ 20 threads in existence, even if the minimum is 10. > If you change the above so that there is a new client every 0.5 s, you will have permanently 40 threads (of which only 2 maximum are really doing something). > > The point is : KeepAlive is not "bad", and in some cases having a relatively long KeepAliveTimeout is the right thing to do. Also, having a high number of threads sitting idle is not necessarily a problem. > Your own scenario is probably not like the above perfectly regular and irrealistic one above. But there may be a perfectly logical reason why you have so many threads on average, and I am just trying to give you ideas for finding out the reason. > > >> >> -----Original Message----- >> From: André Warnier (tomcat) [mailto:aw@ice-sa.com] >> Sent: Monday, January 16, 2017 8:33 AM >> To: users@tomcat.apache.org >> Subject: Re: FW: tomcat 8080 thread not reduced >> >> On 16.01.2017 03:41, Smith Hua wrote: >>> >>> actually there is not much busy threads, less tahn 10,so i think this >>> parameter may has nothing to do with this >> >> It depends on what you call "busy". What are the busy ones doing ? and what are the non-busy ones doing ? >> >> >>> -- >>> 从myMail的Android专用app所发送 星期一, 16 一月 2017, 03:01上午 +08:00 发件人 André Warnier (tomcat) aw@ice-sa.com : >>> >>>> Hi. >>>> >>>> I can find nothing really wrong in your configuration below. >>>> But, what happens if in this section : >>>> >>>> > >>> > maxThreads="300" connectionTimeout="20000" >>>> > redirectPort="8443" /> >>>> >>>> you change the connectionTimeout to 3000 (= 3 seconds, instead of the above 20 seconds) ? >>>> >>>> Do you still see the number of threads remaining at the maximum ? >>>> >>>> See : >>>> http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Standard_Im >>>> plementation >>>> --> connectionTimeout >>>> and the fact that it is also the default for keepAliveTimeout >>>> >>>> >>>> On 14.01.2017 07:30, smith wrote: >>>>> The server.xml: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> type="org.apache.catalina.UserDatabase" >>>>> description="User database that can be updated and saved" >>>>> factory="org.apache.catalina.users.MemoryUserDatabaseFactory" >>>>> pathname="conf/tomcat-users.xml" /> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> maxThreads="300" connectionTimeout="20000" >>>>> redirectPort="8443" /> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> resourceName="UserDatabase"/> >>>>> >>>>> >>>>> >>>> unpackWARs="true" autoDeploy="true"> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> prefix="localhost_access_log" suffix=".txt" >>>>> pattern="%h,%t,%m,%U,%H,%s,%B,%D,%{User-Agent}i" /> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -----Original Message----- >>>>> From: André Warnier (tomcat) [mailto:aw@ice-sa.com] >>>>> Sent: Friday, January 13, 2017 10:42 AM >>>>> To: users@tomcat.apache.org >>>>> Subject: Re: FW: tomcat 8080 thread not reduced >>>>> >>>>> On 13.01.2017 09:38, smith wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> From: smith [mailto:smith.hua@zoom.us] >>>>>> Sent: Tuesday, January 10, 2017 9:57 AM >>>>>> To: 'users' >>>>>> Subject: tomcat 8080 thread not reduced >>>>>> >>>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> >>>>>> >>>>>> We have installed Apache Tomcat/8.0.14, and found that after one period of time, the thread count for 8080(our port published) goes to 120 and never reduced even the busy count is only 3-4. >>>>>> >>>>>> Why? Tomcat8 not reduced the thread pool even the thread is idle, and the minSpareThreads for tomcat8 default is only 10. >>>>>> >>>>>> When will the thread reduce? >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Best regards >>>>>> >>>>>> Smith >>>>>> >>>>>> >>>>> >>>>> Hi. >>>>> >>>>> Please copy/paste your complete server.xml configuration file (confidential things removed), so that we could have a useful look at it. >>>>> Please edit *only* the confidential things, not entire sections. Often, the issue is in the details. >>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>>> For additional commands, e-mail: users-help@tomcat.apache.org >>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>>> For additional commands, e-mail: users-help@tomcat.apache.org >>>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >>>> For additional commands, e-mail: users-help@tomcat.apache.org >>>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org