You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by almos <al...@ukr.net> on 2012/09/21 14:32:46 UTC

tomee.xml configuration for high load

Hello,

I have a question on tomee.xml configuration for highly loaded system.
In my application all business logic is implemented in stateless EJB
components. When load starts to grow, particular components stop responding
to client requests, however others do fine and container continues working -
for me it looks like pool of particular EJB components exceeded some max
size and requests are hanging waiting for free resources.

In logs there are no exceptions just this line each time I request "hanged"
EJB:
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for
autowiring

This happens on TomEE v1.0 and ob nightly builds of Sep 9-10.
The only way to restore operation is kill <tomee pid> because it's even
impossible to stop it.

Any comments/recommendations?

Thanks,
Alex



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by almos <al...@ukr.net>.
Thanks for the support.

I tried TomEE 1.5-SNAPSHOT with Tomcat pool and faced the same behavior.
It's remarkable that JDBC 3/4 drivers behave a bit differently. While JDBC4
was hanging after connection pool exceeded, with JDBC3 I received exceptions
on DBCP that connection can't be leased from pool.
Finally I've found the issue it wasn't related to TomEE infrastructure, but
it was in the code. At one place connection was taken in a way -
jdbcTemplate.getDatasource().getConnection() but wasn't released back
afterwards. So adding DataSourceUtils.releaseConnection(connection,
jdbcTemplate.getDatasource()); fixed this problem.

Thank you guys for your time and pointing to the possible issue origin.

Regards,
Alex



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657653.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by zeeman <ha...@fastmail.us>.
I have seen similar issues based on pooling library, commons pool and dbcp
have such issues. Switch to either Tomcat DB Pool or BoneCP. Both are
supported by Tomee. In Tomee I use Tomcat DB Pool with Postgresql and works
great.



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657649.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Maybe reduce maxsize
Le 21 sept. 2012 19:35, "almos" <al...@ukr.net> a écrit :

> Basically Postgres is not used much - we use Membase to cache everything in
> RAM but few operations are still DB dependant. Usually there are about
> 50-70
> connections active according to what Postgres says.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657593.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: tomee.xml configuration for high load

Posted by almos <al...@ukr.net>.
Basically Postgres is not used much - we use Membase to cache everything in
RAM but few operations are still DB dependant. Usually there are about 50-70
connections active according to what Postgres says.



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657593.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by Romain Manni-Bucau <rm...@gmail.com>.
How many ds connection (database side)? 200 sounds high (too much locks in
dbcp)

Did you try the snapshot to use tomcat-jdbc instead of commons-dbcp?
Le 21 sept. 2012 19:11, "almos" <al...@ukr.net> a écrit :

> Hm.
>
> Here is DataSource configuration in TomEE
>
> <Resource id="BMMDataSource" type="javax.sql.DataSource">
>   JdbcDriver = org.postgresql.Driver
>   JdbcUrl = jdbc:postgresql://localhost:5432/datasource
>   UserName = user
>   Password = password
>   InitialSize = 20
>   MaxActive = 200
>   ValidationQuery = SELECT 1
>   JtaManaged = true
> </Resource>
>
> Here is datasource retirieval in Spring
>
> <jee:jndi-lookup id="jdbcDataSource"
> jndi-name="openejb:Resource/BMMDataSource"/>
>
>
> This is how create jdbctemplate instance:
>
> public RdbmsDAOFactory(DataSource ds) {
>         jdbcTemplate = new JdbcTemplate(ds);
> }
>
> What I might be missing?
> I am planning to switch to CDI instead of Spring but anyways it's
> interesting to know where I am wrong.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657590.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: tomee.xml configuration for high load

Posted by almos <al...@ukr.net>.
Hm. 

Here is DataSource configuration in TomEE

<Resource id="BMMDataSource" type="javax.sql.DataSource">
  JdbcDriver = org.postgresql.Driver
  JdbcUrl = jdbc:postgresql://localhost:5432/datasource
  UserName = user
  Password = password
  InitialSize = 20
  MaxActive = 200
  ValidationQuery = SELECT 1
  JtaManaged = true
</Resource>

Here is datasource retirieval in Spring

<jee:jndi-lookup id="jdbcDataSource"
jndi-name="openejb:Resource/BMMDataSource"/>


This is how create jdbctemplate instance:

public RdbmsDAOFactory(DataSource ds) {
	jdbcTemplate = new JdbcTemplate(ds);
}

What I might be missing?
I am planning to switch to CDI instead of Spring but anyways it's
interesting to know where I am wrong.

Thanks.



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657590.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by Romain Manni-Bucau <rm...@gmail.com>.
seems your spring dbcp connection configure in you rspring jdbctemplate is
not well configured

that's it which seems to block, not ejbs

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*
*LinkedIn: http://www.linkedin.com/pub/romain-manni-bucau/43/544/956*




2012/9/21 almos <al...@ukr.net>

> Here is a jstack output that at the container hanged state http://
> sharetext.org /dB3Y (without spaces)
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657583.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: tomee.xml configuration for high load

Posted by almos <al...@ukr.net>.
Here is a jstack output that at the container hanged state http://
sharetext.org /dB3Y (without spaces)



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657583.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by almos <al...@ukr.net>.
Here is my stateless container configuration

<Container id="My Stateless Container" type="STATELESS">
  AccessTimeout = 5 seconds
  MaxSize = 100
  MinSize = 1
  StrictPooling = false
  MaxAge = 0 hours
  IdleTimeout = 0 minutes
</Container>



--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577p4657580.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: tomee.xml configuration for high load

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Forgot to ask for you stateless container config (here with two important
parameters for high load):


<Container id="My Stateless Container" type="STATELESS">

  # Specifies the size of the bean pools for this stateless
  # SessionBean container.  If StrictPooling is not used, instances
  # will still be created beyond this number if there is demand, but
  # they will not be returned to the pool and instead will be
  # immediately destroyed.

  MaxSize = 10

  # StrictPooling tells the container what to do when the pool
  # reaches it's maximum size and there are incoming requests that
  # need instances.
  #
  # With strict pooling, requests will have to wait for instances to
  # become available. The pool size will never grow beyond the the
  # set MaxSize value.  The maximum amount of time a request should
  # wait is specified via the AccessTimeout setting.
  #
  # Without strict pooling, the container will create temporary
  # instances to meet demand. The instances will last for just one
  # method invocation and then are removed.
  #
  # Setting StrictPooling to false and MaxSize to 0 will result in
  # no pooling. Instead instances will be created on demand and live
  # for exactly one method call before being removed.

  StrictPooling = true
</Container>

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*
*LinkedIn: http://www.linkedin.com/pub/romain-manni-bucau/43/544/956*




2012/9/21 Romain Manni-Bucau <rm...@gmail.com>

> Hi,
>
> you log message is related to spring not tomee.
>
> Can you share a stack trace when it hangs?
>
> I think you can monitor stateless pool through JMX (at least on the
> snapshot - here is the repo
> https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.5.1-SNAPSHOT/
> )
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau*
> *Blog: http://rmannibucau.wordpress.com*
> *LinkedIn: http://www.linkedin.com/pub/romain-manni-bucau/43/544/956*
>
>
>
>
> 2012/9/21 almos <al...@ukr.net>
>
>> Hello,
>>
>> I have a question on tomee.xml configuration for highly loaded system.
>> In my application all business logic is implemented in stateless EJB
>> components. When load starts to grow, particular components stop
>> responding
>> to client requests, however others do fine and container continues
>> working -
>> for me it looks like pool of particular EJB components exceeded some max
>> size and requests are hanging waiting for free resources.
>>
>> In logs there are no exceptions just this line each time I request
>> "hanged"
>> EJB:
>> INFO: JSR-330 'javax.inject.Inject' annotation found and supported for
>> autowiring
>>
>> This happens on TomEE v1.0 and ob nightly builds of Sep 9-10.
>> The only way to restore operation is kill <tomee pid> because it's even
>> impossible to stop it.
>>
>> Any comments/recommendations?
>>
>> Thanks,
>> Alex
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>
>

Re: tomee.xml configuration for high load

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

you log message is related to spring not tomee.

Can you share a stack trace when it hangs?

I think you can monitor stateless pool through JMX (at least on the
snapshot - here is the repo
https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.5.1-SNAPSHOT/
)

*Romain Manni-Bucau*
*Twitter: @rmannibucau*
*Blog: http://rmannibucau.wordpress.com*
*LinkedIn: http://www.linkedin.com/pub/romain-manni-bucau/43/544/956*




2012/9/21 almos <al...@ukr.net>

> Hello,
>
> I have a question on tomee.xml configuration for highly loaded system.
> In my application all business logic is implemented in stateless EJB
> components. When load starts to grow, particular components stop responding
> to client requests, however others do fine and container continues working
> -
> for me it looks like pool of particular EJB components exceeded some max
> size and requests are hanging waiting for free resources.
>
> In logs there are no exceptions just this line each time I request "hanged"
> EJB:
> INFO: JSR-330 'javax.inject.Inject' annotation found and supported for
> autowiring
>
> This happens on TomEE v1.0 and ob nightly builds of Sep 9-10.
> The only way to restore operation is kill <tomee pid> because it's even
> impossible to stop it.
>
> Any comments/recommendations?
>
> Thanks,
> Alex
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-xml-configuration-for-high-load-tp4657577.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>