You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by zeeman <ha...@fastmail.us> on 2012/07/20 22:47:18 UTC

DB pool resource Tomee production

I have this in META-INF in my war:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<Resource id="sportivityDS" type="javax.sql.DataSource">
	  JdbcDriver org.postgresql.Driver
	  JdbcUrl jdbc:postgresql://127.0.0.1:5432/sport
	  JtaManaged true
	  UserName zzz
	  Password xxxx
	  MaxActive                     100
	  InitialSize					2
	  MaxIdle                       25
	  MinIdle                       2
	  suspectTimeout				60
	  maxWait 						10000
	  TimeBetweenEvictionRunsMillis    60000
	  minEvictableIdleTimeMillis	   60000
	  testOnBorrow 					true
	  validationInterval			30000
	  removeAbandoned				true
	  removeAbandonedTimeout		60
	  logAbandoned					true
	  abandonWhenPercentageFull		60
	  NumTestsPerEvictionRun        2
	  ValidationQuery               SELECT 1
     </Resource>
</resources>

I added few more attributes for production to the resource. When I start
Tomee I see:

WARNING: Property "suspectTimeout" not supported by sportDS
WARNING: Property "abandonWhenPercentageFull" not supported by sportDS
WARNING: Property "suspectTimeout" not supported by
WARNING: Property "validationInterval" not supported by 
WARNING: Property "abandonWhenPercentageFull" not supported by

Why are not these resource attributes getting picked up? Regular Tomcat pool
picks them up fine.



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by David Blevins <da...@gmail.com>.
On Jul 20, 2012, at 5:18 PM, zeeman wrote:

> Why is Tomee still using DBCP? See this
> http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

Interesting.  Wonder why these contributions weren't welcome in DBCP.

Going to have to spend some time and digest that doc.  Might be time to switch.

> What do I need to do to use Tomcat pool in Tomee?

Simply declaring the Resource the Tomcat way should do the trick.  TomEE should see it and use it just fine.  You should see "Imported" lines in the log output stating that everything is synch'ed and visible to the various "EE" parts of deployment such as matching datasources with the persistence.xml.

If you haven't explicitly set the <jta-data-source> and <non-jta-data-source> elements in your persistence.xml you should do that using the "Imported" names.


-David


Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
looked a bit more,

using tomcat pool you maybe gain some small features but you lost some
others and in particular the transaction stuff which would be a pain.

Another JEE6 feature you loose is the @DataSourceDefinition management too
i think.

So i think i prefer to keep tomcat pools next to tomee pools but not as a
replacement.

If you could precise which features "afraid" you we could have a look more
precisely.

- Romain


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

> All is not true, was true at a moment. Typically dbcp is ready for prod
> and largely used (all spring apps for instance use it too).
>
> Please find an issue before saying that's not ready. I think we could use
> tomcat pool but i didnt tested it (while i know dbcp very well). Feel free
> to open a jira, the hack shouldnt be hard.
> Le 21 juil. 2012 02:18, "zeeman" <ha...@fastmail.us> a écrit :
>
> Why is Tomee still using DBCP? See this
>> http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html
>>
>> I don't see why cannot Tomee delegate to Tomcat DB pool. After reading
>> limitations of DBCP that I was not aware of I cannot go with it in prod. I
>> thought Tomee had a tweaked DB pool like one in jBoss especially for
>> concurrency and newer JDKs.
>>
>> So the next question is that if we Tomee cannot delegate to Tomcat DB
>> pool.
>> What do I need to do to use Tomcat pool in Tomee?
>>
>> Is it hard for Tomee to switch to use Tomcat DB pool?
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656442.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
All is not true, was true at a moment. Typically dbcp is ready for prod and
largely used (all spring apps for instance use it too).

Please find an issue before saying that's not ready. I think we could use
tomcat pool but i didnt tested it (while i know dbcp very well). Feel free
to open a jira, the hack shouldnt be hard.
Le 21 juil. 2012 02:18, "zeeman" <ha...@fastmail.us> a écrit :

> Why is Tomee still using DBCP? See this
> http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html
>
> I don't see why cannot Tomee delegate to Tomcat DB pool. After reading
> limitations of DBCP that I was not aware of I cannot go with it in prod. I
> thought Tomee had a tweaked DB pool like one in jBoss especially for
> concurrency and newer JDKs.
>
> So the next question is that if we Tomee cannot delegate to Tomcat DB pool.
> What do I need to do to use Tomcat pool in Tomee?
>
> Is it hard for Tomee to switch to use Tomcat DB pool?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656442.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
Why is Tomee still using DBCP? See this
http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html

I don't see why cannot Tomee delegate to Tomcat DB pool. After reading
limitations of DBCP that I was not aware of I cannot go with it in prod. I
thought Tomee had a tweaked DB pool like one in jBoss especially for
concurrency and newer JDKs. 

So the next question is that if we Tomee cannot delegate to Tomcat DB pool.
What do I need to do to use Tomcat pool in Tomee?

Is it hard for Tomee to switch to use Tomcat DB pool?



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656442.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i dont see them on the page...

- Romain


2012/7/21 zeeman <ha...@fastmail.us>

> Well actually attributes names I'm using are the same as in the link you
> provided. So why is Tomee (org.apache.openejb.assembler.classic.Assembler)
> warning they're not supported by the Datasource?
>
> Is the format correct of my datasource resource? Am I missing something?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656438.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
Well actually attributes names I'm using are the same as in the link you
provided. So why is Tomee (org.apache.openejb.assembler.classic.Assembler)
warning they're not supported by the Datasource?

Is the format correct of my datasource resource? Am I missing something?



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656438.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

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

http://commons.apache.org/dbcp/configuration.html

maybe this part is undocumented, but now apache cms can be edited
anonymously so let's give it a try ;)

well at the beginning it was easier this way because tomcat was no pooling
datasources. now they forked and pool them.

- Romain


2012/7/21 zeeman <ha...@fastmail.us>

> So do I need to check documentation of dbcp and see what equivalent
> attributes names are? I wish you guys had a schema for config files so we
> know what are allowed config elements. It's hard to do this without any
> guides. It's like having unprotected sex with a hot prostitute and
> expecting
> not to get an STDs :)
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656435.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
So do I need to check documentation of dbcp and see what equivalent
attributes names are? I wish you guys had a schema for config files so we
know what are allowed config elements. It's hard to do this without any
guides. It's like having unprotected sex with a hot prostitute and expecting
not to get an STDs :)



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656435.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
no, that's wrong tomcat foked comons dbcp and commons pool and changed some
stuff so now the conf is not 1:1

- Romain


2012/7/21 zeeman <ha...@fastmail.us>

> I thought Tomee delegates to DB pool in Tomcat. Those attributes I got from
> Tomcat 7 DB pool optimization guide on Tomcatexpert.com  Tomcat also uses
> DBCP and commons pool. Why Tomee does not pick up those attributes?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656433.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
I thought Tomee delegates to DB pool in Tomcat. Those attributes I got from
Tomcat 7 DB pool optimization guide on Tomcatexpert.com  Tomcat also uses
DBCP and commons pool. Why Tomee does not pick up those attributes?



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656433.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
we (tomee.xml, META-INF/resources.xml) use commons pool and commons dbcp
and btw support only their conf.

you should be able to use a tomcat datasource in tomee too if these
parameter are rally important and can't be replace by dbcp conf.

- Romain


2012/7/20 zeeman <ha...@fastmail.us>

> I have this in META-INF in my war:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <resources>
>         <Resource id="sportivityDS" type="javax.sql.DataSource">
>           JdbcDriver org.postgresql.Driver
>           JdbcUrl jdbc:postgresql://127.0.0.1:5432/sport
>           JtaManaged true
>           UserName zzz
>           Password xxxx
>           MaxActive                     100
>           InitialSize                                   2
>           MaxIdle                       25
>           MinIdle                       2
>           suspectTimeout                                60
>           maxWait                                               10000
>           TimeBetweenEvictionRunsMillis    60000
>           minEvictableIdleTimeMillis       60000
>           testOnBorrow                                  true
>           validationInterval                    30000
>           removeAbandoned                               true
>           removeAbandonedTimeout                60
>           logAbandoned                                  true
>           abandonWhenPercentageFull             60
>           NumTestsPerEvictionRun        2
>           ValidationQuery               SELECT 1
>      </Resource>
> </resources>
>
> I added few more attributes for production to the resource. When I start
> Tomee I see:
>
> WARNING: Property "suspectTimeout" not supported by sportDS
> WARNING: Property "abandonWhenPercentageFull" not supported by sportDS
> WARNING: Property "suspectTimeout" not supported by
> WARNING: Property "validationInterval" not supported by
> WARNING: Property "abandonWhenPercentageFull" not supported by
>
> Why are not these resource attributes getting picked up? Regular Tomcat
> pool
> picks them up fine.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
It is the discuss. Personally i'd like to get rid of dbcp for managed stuff
and be able to use a kind of poolfactory.

- Romain
Le 22 juil. 2012 18:28, "zeeman" <ha...@fastmail.us> a écrit :

> That would be awesome if it gets done by next week. I plan to give QA a
> build
> by the end of July, if you guys have it I could have QA give it a good
> test.
> So you plan to refactor DBCP and make it use concurrent package and remove
> limitation it currently has as stated in Tomcat pool link?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656488.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
That would be awesome if it gets done by next week. I plan to give QA a build
by the end of July, if you guys have it I could have QA give it a good test.
So you plan to refactor DBCP and make it use concurrent package and remove
limitation it currently has as stated in Tomcat pool link?



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656488.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I would like it and hope some mews next week.
Le 22 juil. 2012 16:38, "zeeman" <ha...@fastmail.us> a écrit :

> Thanks Romain for looking into this. That would be great if you guys
> refactor
> it. Please keep this thread updated and Tomee documentation so I know the
> status of this. Do you think pool refactoring will make it in Tomee 1.1
> release?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656481.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
Thanks Romain for looking into this. That would be great if you guys refactor
it. Please keep this thread updated and Tomee documentation so I know the
status of this. Do you think pool refactoring will make it in Tomee 1.1
release?



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656481.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
FYI:  http://openejb.979440.n4.nabble.com/Dbcp-and-tomee-td4656450.html

currently we rely a lot on dbcp for the managed stuff, hacking at
tomcat/tomee level is too bad regarding the design and will be too
"copy/paste" style

so we'll refactor it.

- Romain


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

> Ok if it is jt compliant, tomcat jdbc is not. Im trying to hack it
> Le 21 juil. 2012 20:05, "zeeman" <ha...@fastmail.us> a écrit :
>
> I still don't get it. Why not use a different pool and keep using
>> transaction
>> managers. We'll still be with JTA but a better pool. No?
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656456.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ok if it is jt compliant, tomcat jdbc is not. Im trying to hack it
Le 21 juil. 2012 20:05, "zeeman" <ha...@fastmail.us> a écrit :

> I still don't get it. Why not use a different pool and keep using
> transaction
> managers. We'll still be with JTA but a better pool. No?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656456.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
I still don't get it. Why not use a different pool and keep using transaction
managers. We'll still be with JTA but a better pool. No?



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656456.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
The txmgr manages tx..but you need to register against it to be managed.
That's exactly the part tomcat removed so your are not fully jta.

- Romain
Le 21 juil. 2012 14:52, "zeeman" <ha...@fastmail.us> a écrit :

> Romain, can you elaborate more? Tx is managed by a transaction manager,
> what
> does it have to do with the pool implementation? What does DBCP has that
> Tomcat pool does not have? The spin lock (locking) design alone is big
> enough to keep DBCP away from highly concurrent web apps. Tomcat pool or
> BoneCP is the way to go in Tomee IMO.
>
> Once you finish your testing, let me know I can test my project with your
> changes. Please be sure that it'll work with META-INF/resources.xml
> packaged
> with a project. Thanks!
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656454.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
Romain, can you elaborate more? Tx is managed by a transaction manager, what
does it have to do with the pool implementation? What does DBCP has that
Tomcat pool does not have? The spin lock (locking) design alone is big
enough to keep DBCP away from highly concurrent web apps. Tomcat pool or
BoneCP is the way to go in Tomee IMO.

Once you finish your testing, let me know I can test my project with your
changes. Please be sure that it'll work with META-INF/resources.xml packaged
with a project. Thanks!



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656454.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: DB pool resource Tomee production

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Dont think dbcp and tomcat jdbc are comparable that's truly false regarding
tx.

I hacked a bit on it, i need to test (probably the harder part here)
Le 21 juil. 2012 13:55, "zeeman" <ha...@fastmail.us> a écrit :

> Beside that Tomcat pool is much smaller and simpler in design. The features
> that I would like to have:
>
> Async handling, there are any background jobs in my project that could make
> use of it.
>
> Abandoned connection detection and handling.
>
> Validation interval, not ever everytime a connection is returned.
>
> Suspect timeout. A timeout for suspected bad connections.
>
> If there is a way to have those with DBCP that would be fine, I don't have
> to change my config. But if not, and it's not a hack :) it'll be great to
> use same pool as Tomcat. As far Spring, it recommends using BoneCP pool.
> Actually, I know many projects that stays away from DBCP.
>
> BoneCP or Tomcat pool seem to offer a comparable pool to what's in
> glassfisha and jboss. I just think Tomee should be on the same pool as
> Tomcat, you get to remove few more dependencies :)
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656452.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: DB pool resource Tomee production

Posted by zeeman <ha...@fastmail.us>.
Beside that Tomcat pool is much smaller and simpler in design. The features
that I would like to have:

Async handling, there are any background jobs in my project that could make
use of it.

Abandoned connection detection and handling.

Validation interval, not ever everytime a connection is returned.

Suspect timeout. A timeout for suspected bad connections.

If there is a way to have those with DBCP that would be fine, I don't have
to change my config. But if not, and it's not a hack :) it'll be great to
use same pool as Tomcat. As far Spring, it recommends using BoneCP pool.
Actually, I know many projects that stays away from DBCP.

BoneCP or Tomcat pool seem to offer a comparable pool to what's in
glassfisha and jboss. I just think Tomee should be on the same pool as
Tomcat, you get to remove few more dependencies :)



--
View this message in context: http://openejb.979440.n4.nabble.com/DB-pool-resource-Tomee-production-tp4656425p4656452.html
Sent from the OpenEJB User mailing list archive at Nabble.com.