Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 955A3C971 for ; Tue, 1 Oct 2013 09:13:04 +0000 (UTC) Received: (qmail 66454 invoked by uid 500); 1 Oct 2013 09:11:05 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 66222 invoked by uid 500); 1 Oct 2013 09:10:41 -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 65990 invoked by uid 99); 1 Oct 2013 09:10:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Oct 2013 09:10:33 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of anuprab2@gmail.com designates 209.85.220.178 as permitted sender) Received: from [209.85.220.178] (HELO mail-vc0-f178.google.com) (209.85.220.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Oct 2013 09:10:26 +0000 Received: by mail-vc0-f178.google.com with SMTP id lh4so2022251vcb.23 for ; Tue, 01 Oct 2013 02:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ah24IgTlt8pr+y6wUfG41zAvRnBylrUFCWyPW/nCBDc=; b=WJQjX0JP3L0heuF5ezcSfIahCXdDojXzpOnmbx7fqJZk1cyGkZUfmuMuZt8r2TXUof SJJDO9/jpo5iyPYb7yY+HR8RtBXk1Zmnk3yDOGvv2Ws5+gSl6RRYH4wL6RwiSre6BfK3 Eh3v5SFRpxTXE98KliILEfbKu/DhnIbpSmYM4JHcPN3WsBzykRXqIJKJq624Jf4O8Ktc IHsUh61c2MCw1WLsrfUUgDMAfBul6TF2Y8w9+NWEi+DM9AYWpfIjPD00sgSUiVFQytgn OBBAx4ixK38h2WqFaSDirsNCcSPB+zwEBYzDyOnbsTLqjmhm4rbP2lhodvoySBLOY1ay Itcw== MIME-Version: 1.0 X-Received: by 10.220.88.13 with SMTP id y13mr11507984vcl.20.1380618605479; Tue, 01 Oct 2013 02:10:05 -0700 (PDT) Received: by 10.221.20.72 with HTTP; Tue, 1 Oct 2013 02:10:05 -0700 (PDT) Date: Tue, 1 Oct 2013 14:40:05 +0530 Message-ID: Subject: Re: Reg: Connection pool From: Anu Prab To: Tomcat Users List Content-Type: multipart/alternative; boundary=047d7b3a8a8e8cce0704e7aa51e0 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b3a8a8e8cce0704e7aa51e0 Content-Type: text/plain; charset=ISO-8859-1 On Sep 27, 2013, at 12:21 AM, Anu Prab wrote: > On Sep 26, 2013, at 6:02 PM, Christopher Schultz < > chris@christopherschultz.net> wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- > >> Hash: SHA256 > >> > >> Daniel, > >> > >> On 9/26/13 9:18 AM, Daniel Mikusa wrote: > >>> On Sep 26, 2013, at 2:22 AM, Anu Prab wrote: > >>> > >>>> I am using Tomcat version 7. > >>> > >>> For future reference, please include the exact version of Tomcat you > >>> are running. There are 40+ different versions. > >>> > >>>> Is it possible to update connection pool properties without > >>>> restarting the Tomcat server? > >>> > >>> Please also include specific details like which connection pool are > >>> you using. There are two included with Tomcat, DBCP and tomcat-jdbc. > >>> > >>> To give a general answer to your question, you can update some of >>> the > >>> properties through JMX. It'll depend on the version of Tomcat and > >>> which pool you are using as to which properties you can update. > >>> Try connecting with jconsole or jvisualvm w/MBeans plugin and see if > >>> the properties you need are exposed and editable. > >> > >> While most properties are not immutable (e.g. you can change their > >> values via JMX), changing them usually has no effect because the > >> connection pool is not re-initialized when those values change. > > > > Good point. It's important to be realistic about what you can do at > runtime. > > > >> Perhaps Anu can give us a use case for when this kind of thing would > >> be appropriate... what would you want to change during runtime in a > >> stable system? > > > > +1 definitely need more info here. > > Dan > > > > Hi, > > Sorry, please ignore my previous mail. My bad. > > The Tomcat version I am using is 7.0.40 and the connection pool is > tomcat-jdbc. > > Well, one case would be to increase the maxActive property so that if > I want to increase this threshold limit, how do I do it?. Connect with jconsole or jvisualvm. Navigate to tomcat.jdbc -> ConnectionPool -> "" -> org.apache.tomcat.jdbc.pool.DataSource. Edit the "maxActive" attribute. For the most part this works OK. There were a couple quirks that I noticed in my quick test. - When decreasing maxActive, if you set it lower than the number of connections already it has no effect until the number of connects drops below maxActive. - If I tried to grab a connection from the pool and the pool has already hit maxActive, my request would fail. However subsequent requests would succeed. There could be others, so I'd suggest you test your specific use case in a controlled environment before trying it in production. Having said all this, I would agree that it's better to properly size your connection pool from the start. If that's not possible, this should work for you though. Dan >Thank you Dan for your inputs. One more information please: I have a datasource created through a Servlet and no configuration information is provided in the context.xml. If some other class within the same web app wants to do a lookup for this datasource, how to go about doing this? - Anu --047d7b3a8a8e8cce0704e7aa51e0--