tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riaan Oberholzer <riaanoberhol...@yahoo.com>
Subject RE: config help
Date Wed, 23 Jul 2003 13:56:51 GMT
Another tip: use PrepareStatements instead of normal
Statements, as they get precompiled and cached and
improve performance.

> If a connection is opened in the init() method, and
> closed in the destroy method, would that not mean
> that the "concurrency" only applies to the amount of
> time needed to instantiate, create, use to get data
> and then destroy? 

I assume you refer to the init/destroy methods within
your servlet? You then create the DB connection as a
member variable of the servlet or what? If so: bad
idea, that means ONE connection for ALL your users, so
a major bottleneck here.

> So if I am assuming 2000 - 3000 users accessing the
> information over the same time frame (3 - 4 hours),
> what would be the estimate of required concurrent
> users? Does that mean "simultaneous" HTTP / JDBC
> requests??

I does mean 3000-4000 db connect calls (if you have
one per session), while a pool (in a datasource) being
set to e.g. 128, would only create 128 connections,
but re-use them. 

I suggest something like this in your servlets (if
your datasource is setup), ignoring exceptions and
error handling:

doRequest(){
  Connection c = datasource.getConnection();
  // do your thing here
  c.close();
}

Closing this connection returns it to the pool, it
does not physically break the connection with the DB
server.


> Thanks......
> 
> Geoff
> 
> -----Original Message-----
> From: Riaan Oberholzer
> [mailto:riaanoberholzer@yahoo.com]
> Sent: Wednesday, July 23, 2003 9:01 AM
> To: Tomcat Users List
> Subject: RE: config help
> 
> 
> It sounds as if you are indeed opening/closing
> connections as you need them.
> 
> You need to configure a datasource for your db
> connections:
> 
>
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
> 
> Its fairly easy to set up and the gain is
> significant.
> I would say it is probably a good practice to use
> this
> anyway, even if you do not expect heavy traffic.
> 
> 
> --- Geoff Peters <Geoff@logic.bm> wrote:
> > Andoni - thanks for the advice - someone else just
> > mentioned the same thing in a reply (Riaan) -
> > setting the datasource connection pool parameter -
> > where would this parameter go? Is it a parameter
> at
> > the server level config or application level?  We
> > have a MySQL person in house, I will ask her about
> > the maximum concurrent MySQL connections....
> > 
> > Thanks, Geoff
> > 
> > -----Original Message-----
> > From: Andoni [mailto:andoni@indigo.ie]
> > Sent: Wednesday, July 23, 2003 8:54 AM
> > To: Tomcat Users List
> > Subject: Re: config help
> > 
> > 
> > I would recommend you write a tiny java program
> that
> > keeps opening
> > connections to your database and counting the
> number
> > of open connections.
> > Then when it starts getting errors you can shut
> the
> > connections but record
> > the maximum number of open connections.
> > 
> > Then since your period is so intense you should
> put
> > your initial pool of
> > open connections to very close to this number. 
> e.g.
> > if your max number of
> > connections is, 170 (like mine) then set your
> > initial pool size to 140-150
> > so that there is practically no connection
> > opening/closing done by your
> > program while it's running.
> > 
> > Andoni.
> > 
> > 
> > ----- Original Message -----
> > From: "Geoff Peters" <Geoff@logic.bm>
> > To: <tomcat-user@jakarta.apache.org>
> > Sent: Wednesday, July 23, 2003 12:38 PM
> > Subject: config help
> > 
> > 
> > Hi - I am currently in the process of deploying a
> > web app using Tomcat
> > 4.1.18, MySQL 3.23 on a Win2K Server. The app will
> > be used heavily for a
> > period of 3 - 4 hours, (probably a couple of
> > thousand hits per minute), then
> > never used again.
> > 
> > I am wondering what exactly I should do to enhance
> > performace - other than
> > some changes recommended to the server.xml file
> > (i.e. setting debug to
> > zero), I am not 100% sure what some of the other
> > changes will do,
> > specifically min and max processors, and other
> > settings. Can someone please
> > give me some pointers as to what I can so to
> > maximize performance over this
> > 3-4 hour period??
> > 
> > Application is a series of MySQL based reports
> (all
> > servlets), containing
> > several select statements and using the MySQL JDBC
> > driver.
> > 
> > Thanks for any advice!
> > 
> > Geoff
> > 
> > Geoff Peters, SCJP            Phone  : (441)
> > 296-9640
> > Applications Developer        Fax    : (441)
> > 292-1509
> > Logic Communications          E-mail :
> > geoff@logic.bm
> > 12 Par-La-Ville Road          WWW    :
> > http://www.logic.bm
> > Hamilton, Bermuda  HM JX
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message