Is there anyway to know if my db connections are not returning to the pool?


2014-02-13 10:46 GMT-06:00 José Luis Cetina <[email protected]>:

> I run my tomee with this parameters
>
> export JAVA_OPTS="-Dorg.apache.el.parser.COERCE_TO_ZERO=false -server
> -Xms3072M -Xmx6144M -XX:PermSize=1024M -XX:MaxPermSize=2048M
> -Djava.awt.headless=true
>
> export CATALINA_OPTS="-Xms3072m -Xmx6144m"
>
> Is that what you mean?
>
>
> 2014-02-13 10:42 GMT-06:00 José Luis Cetina <[email protected]>:
>
> Sorry for my ignorance but how do i check the thread stack?
>>
>>
>> 2014-02-13 10:40 GMT-06:00 Romain Manni-Bucau <[email protected]>:
>>
>> check your thread stack. Note a wrong config can make connections not
>>> returning to pool IIRC
>>> Romain Manni-Bucau
>>> Twitter: @rmannibucau
>>> Blog: http://rmannibucau.wordpress.com/
>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> Github: https://github.com/rmannibucau
>>>
>>>
>>>
>>> 2014-02-13 17:39 GMT+01:00 José Luis Cetina <[email protected]>:
>>> > Ok.
>>> >
>>> > At this moment my webapp in production is loggin me:
>>> >
>>> > SEVERE: EjbTransactionUtil.handleSystemException:
>>> [ajp-bio-8009-exec-1458]
>>> > Timeout: Pool empty. Unable to fetch a connection in 90 seconds, none
>>> > available[size:250; busy:250; idle:0; lastwait:90000].
>>> >
>>> > Pool empty, it means my 250 of 250 are using it?
>>> >
>>> > Any advice?
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > 2014-02-13 10:35 GMT-06:00 Romain Manni-Bucau <[email protected]>:
>>> >
>>> >> No it is fine.
>>> >> Romain Manni-Bucau
>>> >> Twitter: @rmannibucau
>>> >> Blog: http://rmannibucau.wordpress.com/
>>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> >> Github: https://github.com/rmannibucau
>>> >>
>>> >>
>>> >>
>>> >> 2014-02-13 17:18 GMT+01:00 José Luis Cetina <[email protected]>:
>>> >> > Thanks i already readed. Maybe what is happen is that my webapps
>>> are not
>>> >> > returning to the pool the database connection.
>>> >> >
>>> >> > I have a question:
>>> >> >
>>> >> > If i have a stateles bean using an entitymanager and doing any kind
>>> of
>>> >> > operation in the database, when my method returns the connections
>>> is the
>>> >> > connections is closed and returned to the pool?? do i missing
>>> something?
>>> >> >
>>> >> >
>>> >> > //All my ejbs are like this
>>> >> > @Stateless
>>> >> > @TransactionManagement(TransactionManagementType.CONTAINER)
>>> >> > public class ConektaComprasOnlineGeneradasFacade{
>>> >> >
>>> >> >     @PersistenceContext(unitName = "anyName")
>>> >> >     private EntityManager em;
>>> >> >
>>> >> >    @TransactionAttribute(TransactionAttributeType.REQUIRED)
>>> >> >     public void doSomeStuff(){
>>> >> >        MyObject x = new MyObject();
>>> >> >        em.persist(x);
>>> >> >        //when this method is finished and the commit its done the
>>> >> database
>>> >> > connection is returned to the pool? do i have to close it?
>>> >> >     }
>>> >> >
>>> >> > }
>>> >> >
>>> >> >
>>> >> > Thanks
>>> >> >
>>> >> >
>>> >> >
>>> >> > 2014-02-13 9:51 GMT-06:00 Howard W. Smith, Jr. <
>>> [email protected]>:
>>> >> >
>>> >> >> also, this one, and you can reach out to tomcat user list, too...
>>> >> >>
>>> >> >>
>>> >> >>
>>> >>
>>> http://blog.christopherschultz.net/index.php/2009/03/16/properly-handling-pooled-jdbc-connections/
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> On Thu, Feb 13, 2014 at 10:34 AM, José Luis Cetina <
>>> >> [email protected]
>>> >> >> >wrote:
>>> >> >>
>>> >> >> > Then if tomee use tomcat-pool is this where the info really is?
>>> >> >> >
>>> >> >> > https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html not here
>>> >> >> > http://commons.apache.org/proper/commons-dbcp/configuration.html
>>> >> >> >
>>> >> >> >
>>> >> >> > 2014-02-13 9:32 GMT-06:00 José Luis Cetina <[email protected]
>>> >:
>>> >> >> >
>>> >> >> > > What about this info in tomee web page
>>> >> >> > >
>>> >> >> > > "Internally, from TomEE 1.5.0, JDBC pools are managed via
>>> >> Tomcat-pool.
>>> >> >> > You
>>> >> >> > > can still switch back to Apache Commons DBCP by adding the
>>> following
>>> >> >> > > property: DataSourceCreator dbcp. To get the full list of
>>> available
>>> >> >> > > configuration properties, have a look to Apache Commons DBCP
>>> >> >> > configuration<http://commons.apache.org/dbcp/configuration.html>
>>> >> >> > > ."
>>> >> >> > >
>>> >> >> > > What is the difference between tomcat pool and dbcp, they
>>> share the
>>> >> >> same
>>> >> >> > > properties?
>>> >> >> > >
>>> >> >> > >
>>> >> >> > > 2014-02-13 9:23 GMT-06:00 Romain Manni-Bucau <
>>> [email protected]
>>> >> >:
>>> >> >> > >
>>> >> >> > > Hi,
>>> >> >> > >>
>>> >> >> > >> some read
>>> >> >> > >>
>>> http://commons.apache.org/proper/commons-dbcp/configuration.html;)
>>> >> >> > >> Romain Manni-Bucau
>>> >> >> > >> Twitter: @rmannibucau
>>> >> >> > >> Blog: http://rmannibucau.wordpress.com/
>>> >> >> > >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> >> >> > >> Github: https://github.com/rmannibucau
>>> >> >> > >>
>>> >> >> > >>
>>> >> >> > >>
>>> >> >> > >> 2014-02-13 16:21 GMT+01:00 José Luis Cetina <
>>> [email protected]
>>> >> >:
>>> >> >> > >> > Hi, im having about 180 users at the same time connected to
>>> my
>>> >> >> webapp,
>>> >> >> > >> > yesterday i got an mysql exception saying "Ton many
>>> connections"
>>> >> >> then
>>> >> >> > i
>>> >> >> > >> > read in blogs and update the property max_connections in
>>> my.cnf
>>> >> to
>>> >> >> 500
>>> >> >> > >> > connections (i have a stand alone server for database only
>>> that
>>> >> has
>>> >> >> > >> 16gb of
>>> >> >> > >> > ram just for the OS and the DB) then in that post recommend
>>> to
>>> >> >> adjust
>>> >> >> > >> that
>>> >> >> > >> > value (max_connections) accord to my pool connection. I use
>>> a
>>> >> >> > datasource
>>> >> >> > >> > resource configured in tomee.xml and i have this
>>> >> >> > >> >
>>> >> >> > >> > <Resource id="any" type="DataSource">
>>> >> >> > >> >   JdbcDriver com.mysql.jdbc.Driver
>>> >> >> > >> >   JdbcUrl ...
>>> >> >> > >> >   UserName xxx
>>> >> >> > >> >   Password xxx
>>> >> >> > >> >   jtaManaged true
>>> >> >> > >> >   initialSize=30
>>> >> >> > >> >   MaxActive=500 (my old value was 250)
>>> >> >> > >> >   MaxIdle=50
>>> >> >> > >> >   MaxWait=90000
>>> >> >> > >> >   MaxWaitTime=90000
>>> >> >> > >> >   validationQuery=SELECT 1
>>> >> >> > >> >   testOnBorrow=true
>>> >> >> > >> > </Resource>
>>> >> >> > >> >
>>> >> >> > >> > Then i have this questions:
>>> >> >> > >> >
>>> >> >> > >> > 1.What advice can you give me for handle around 180 users
>>> that
>>> >> use
>>> >> >> my
>>> >> >> > >> app
>>> >> >> > >> > an hit the database with each action.
>>> >> >> > >> > I use JSF (@NamedBeans) + EJB (All my EJBS are statless) + 1
>>> >> >> > SessionBean
>>> >> >> > >> > (@Named) for each users.
>>> >> >> > >> >
>>> >> >> > >> > 2. Which is the difference between MaxIdle and MaxActive?
>>> >> >> > >> >
>>> >> >> > >> > 3. Which is the default timeout for close inactive
>>> connections
>>> >> and
>>> >> >> > what
>>> >> >> > >> is
>>> >> >> > >> > the name of the property?
>>> >> >> > >> >
>>> >> >> > >> >
>>> >> >> > >> >
>>> >> >> > >> > I will be happy with any kind of advice.
>>> >> >> > >> >
>>> >> >> > >> > I use 2 servers with this configuration and tomee and both
>>> of
>>> >> them
>>> >> >> > read
>>> >> >> > >> to
>>> >> >> > >> > other server where the database is (2 webapp server + 1 db
>>> >> server).
>>> >> >> > >> >
>>> >> >> > >> >
>>> >> >> > >> >
>>> >> >> > >> >
>>> >> >> > >> >
>>> >> -------------------------------------------------------------------
>>> >> >> > >> > *José Luis Cetina*
>>> >> >> > >> >
>>> >> -------------------------------------------------------------------
>>> >> >> > >>
>>> >> >> > >
>>> >> >> > >
>>> >> >> > >
>>> >> >> > > --
>>> >> >> > >
>>> -------------------------------------------------------------------
>>> >> >> > > *José Luis Cetina*
>>> >> >> > >
>>> -------------------------------------------------------------------
>>> >> >> > >
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >> > --
>>> >> >> >
>>> -------------------------------------------------------------------
>>> >> >> > *José Luis Cetina*
>>> >> >> >
>>> -------------------------------------------------------------------
>>> >> >> >
>>> >> >>
>>> >> >
>>> >> >
>>> >> >
>>> >> > --
>>> >> > -------------------------------------------------------------------
>>> >> > *José Luis Cetina*
>>> >> > -------------------------------------------------------------------
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > -------------------------------------------------------------------
>>> > *José Luis Cetina*
>>> > -------------------------------------------------------------------
>>>
>>
>>
>>
>> --
>> -------------------------------------------------------------------
>> *José Luis Cetina*
>> -------------------------------------------------------------------
>>
>
>
>
> --
> -------------------------------------------------------------------
> *José Luis Cetina*
> -------------------------------------------------------------------
>



-- 
-------------------------------------------------------------------
*José Luis Cetina*
-------------------------------------------------------------------

Reply via email to