On Tue, Jun 18, 2019 at 11:34 PM César Hernández Mendoza < [email protected]> wrote:
> Thanks for the PR's and context provided. > > I provided feedback on the PR #488 > <https://github.com/apache/tomee/pull/488> and I'm also proposing an > alternative to declare the Derby XA data source as part of the comments. > Thanks for the PR feedback. The warnings are a pain, as is the two different styles we have for configuring XA datasources, where you can either have an additional "wrapper" resource, or you mix that with the main datasource definition. We lack clear documentation with examples, which is one of the things I hope we can resolve. That said, I don't think there's anything "blocking" the merge of these that we can't solve in another PR, so I propose we merge them, and continue the changes in another PR. That way we'll avoid having long-running PRs in our own forks. > > What I currently understand: > > - examples/xa-datasource is currently serving a couple of purposes: > - 1) Example of how to inject entity manager, configure the > EntityManager via a persistence.xm and Injection via @PersistenceContext > - 2) org.superbiz.injection.jpa.MoviesTest.java is a Junit class that > shows how to declare a Datasource programmatically and using > the embeddable.EJBContainer for lookup. > - 3) org.superbiz.injection.jpa.MoviesXATest.java is a Junit test using > org.apache.openejb.junit.ApplicationComposer (not arquillian) to define > a > XA data source programmatically and make some operations by the help > of org.superbiz.injection.jpa.MoviesXA (the runner) how is ultimately > the > one implementing the logic of the XA workflow. > - The above test scenarios are triggered when one execute mvn clean > test. > - In parallel the module is configured to also: > - 4) Donwload via maven the jars need it to have a local instance of the > Grinder http://grinder.sourceforge.net/ > - 5) Have a http rest endpoint configured > by org.superbiz.rest.MovieService.java that is deployed when running mvn > tomee:run > - 6) The module contains grinder wrapper script that set grinder > configurations and point to the tests class: > org.superbiz.perf.DBTestPerf.java. this class > - 7) Once the MovieService is depldoyed via tomee:run and the Grinder UI > is triggered, then one can trigger a stress test. > That's right. Effectively, you'd do `mvn clean install tomee:run` and `./grinder.sh` to run the performance test. > > > What I'm trying to understand: > > - How to simplify the stress part of the test to test against different > databases. > I'd suggest that folks can also do `mvn clean install tomee:build`, and unzip the resulting TomEE zip, add the necessary jdbc JAR, and override the datasource config with system properties. We could provide template properties that can be copy/pasted in. > - I'm thinking to skip how to boot a docker Oracle database but I would > like to hear feedback if the community think that needs it. > I don't think lots of detail is needed, but I'm sure a pointer with a link to this: https://technology.amis.nl/2019/04/14/extremely-convenient-way-to-run-free-oracle-database-18c-on-your-laptop-or-anywhere-else-using-vagrant-virtual-box/ > - So far the Readme file explains how to switch from derby into Oracle. > - I'm going to start adding resources.xml for each Database. > > > During this PR review, I realized that we also need more XA examples for. > I'm planning to open JIRAS also for: > a) Using two databases (can be either the same DB or two different RDMS) > within a global transaction. For example > > https://www.byteslounge.com/tutorials/ejb-multiple-datasource-transaction-example > . > Still, the debate on how to booth the Databases will be addressed. > Aquillian Persistence extension could be also another alternative but > still, the RDBMS should be up and running. > b) Using one database and another resource like JMS within a global > transaction. > I agree with both. I pictured a test with JMS in my head - we can use the QueueBrowser to peek at queues to ensure things are rolling back correctly. > > > > > El mar., 18 jun. 2019 a las 7:45, Jonathan Gallimore (< > [email protected]>) escribió: > > > Cesar > > > > I backported this to 1.7.x: https://github.com/apache/tomee/pull/489 > > I think this and https://github.com/apache/tomee/pull/488 should be > ready > > for merge now. > > > > Can you review? If you're happy, I'll merge. > > > > We should start collecting some configs for different databases: > > > > Oracle > > SQL Server > > Postgres > > MySQL > > > > and compare timings both with and without openejb.datasource.pool enabled > > with both master and 1.7.x. > > > > If we see some "quality" issues along the way, I think we should call > them > > out. > > > > So, currently, with TomEE 8 (master) I have found that you *have* to > > specify a JdbcUrl for the XA datasource otherwise TomEE follows the wrong > > path and you end up with a HSQLDB connection. > > > > I also get warnings like this: > > > > 18-Jun-2019 14:41:41.583 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'JdbcUrl' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.583 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'UserName' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.584 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'Password' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.584 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'PasswordCipher' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.584 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'ValidationQuery' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.585 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'InitialSize' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.585 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'MaxActive' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.585 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'MaxIdle' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.585 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'MinIdle' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.585 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'TestWhileIdle' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.586 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'TestOnBorrow' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.586 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'TestOnReturn' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.586 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'AccessToUnderlyingConnectionAllowed' for resource > > 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.586 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'PoolPreparedStatements' for resource 'dbtest/movieDatabase' > > 18-Jun-2019 14:41:41.586 WARNING [main] > > org.apache.openejb.assembler.classic.Assembler.unusedProperty unused > > property 'MaxOpenPreparedStatements' for resource 'dbtest/movieDatabase' > > > > which may be accurate, but I'd like to pin down where they are coming > from > > and try and provide something more helpful. > > > > Finally, configuring XA datasources generally feels a bit painful. It > would > > be nice have a tool that can help build the config for you. > > > > Jon > > > > On Tue, Jun 18, 2019 at 11:14 AM Jonathan Gallimore < > > [email protected]> wrote: > > > > > Hi Cesar > > > > > > I had a go with your XA sample PR. I've picked it up and expanded on > it: > > > https://github.com/apache/tomee/pull/488 > > > > > > Can you take a look and see what you think? I've removed any references > > to > > > ojdbc jar, and tweaked so the jars for the Grinder framework aren't > > > committed to the repository. Out of the box, it runs with Derby, but I > > > think providing instructions for Oracle, SQL Server, etc would be > > > worthwhile so people can run their own tests against different > databases. > > > > > > Thanks > > > > > > Jon > > > > > > > > -- > Atentamente: > César Hernández. >
