1PC Transactions over JTA

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

1PC Transactions over JTA

Amin Abbaspour
Dear Members,

I have two questions. The first one is about JTA in general and the other one focuses on BTM.

1. How can I have one phase commit and yet run in JTA mode? In other words, I want to have some facilities of JTA (like separation of transaction and connection (which lets me suspend/resume the transaction)) and yet prevent the performance lose of using 2PC. I have just one datasource and don't need to run in fully 2PC mode, but I don't see any solution to let me have suspendable transaction in 1PC mode. I either have 2PC or simple transaction over connection. The first on is slow and more than what I need and later has less features to meet my needs.

2. The second question which depends on the first one, is how can I force BTM to run in 1PC mode. May be if I can have this feature then the first problem is solved. I had seen that for example in Weblogic JTA I can define XA resources but let the container know that I want to run in 1PC mode. Do we have such a feature in BTM? Is this a feature of datasource or TM? If BTM does not provide this feature, is there any plan to have this in future?

Thanks in advance.
Amin Abbaspour
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1PC Transactions over JTA

Ludovic Orban
Administrator
Hi,

1PC optimization is automatically detected and used by BTM when you only use one resource in a transaction. There is absolutely nothing to configure as the TM has everything it needs to figure out by itself if it can be applied or not.

When you execute JTA transactions over a single database you can expect the same performance as with using direct JDBC transaction facilities (eventually with a very slight overhead). If not, it's a bug.

I wonder what you're referring to in the weblogic case. Do you have any pointer to their documentation ?

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1PC Transactions over JTA

Amin Abbaspour
Hi,

If it's like that (I mean automatic detection of 1PC when using one resource), then why do we still need to (for example in Oracle) grant global transaction privileges for this user?

Regards,
Amin

Ludovic Orban wrote
Hi,

1PC optimization is automatically detected and used by BTM when you only use one resource in a transaction. There is absolutely nothing to configure as the TM has everything it needs to figure out by itself if it can be applied or not.

When you execute JTA transactions over a single database you can expect the same performance as with using direct JDBC transaction facilities (eventually with a very slight overhead). If not, it's a bug.

I wonder what you're referring to in the weblogic case. Do you have any pointer to their documentation ?

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1PC Transactions over JTA

Wim Goossens
Hi Amin,

I noticed the same thing. I know at least one reason for this. When BTM starts, it will start looking if there is any recovery to be done. For this reason you have to give the user rights to the xa views etc in Oracle 8,9,10

Regards
Wim


Amin Abbaspour wrote
Hi,

If it's like that (I mean automatic detection of 1PC when using one resource), then why do we still need to (for example in Oracle) grant global transaction privileges for this user?

Regards,
Amin

Ludovic Orban wrote
Hi,

1PC optimization is automatically detected and used by BTM when you only use one resource in a transaction. There is absolutely nothing to configure as the TM has everything it needs to figure out by itself if it can be applied or not.

When you execute JTA transactions over a single database you can expect the same performance as with using direct JDBC transaction facilities (eventually with a very slight overhead). If not, it's a bug.

I wonder what you're referring to in the weblogic case. Do you have any pointer to their documentation ?

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1PC Transactions over JTA

Ludovic Orban
Administrator
In reply to this post by Amin Abbaspour
Amin,

The reason for that is even if the TM uses 1PC optimization, it will still use the XA API to do so: you get 1PC performance but the TM uses 2PC calls with some special parameters.

Using the XA API on Oracle requires the privileges that you refer to as 'global transaction privileges'.


If you want to use Oracle without having to grant those privileges and can guarantee only one resource will be part of the transactions, you should have a look at the Last Resource Commit optimization (http://docs.codehaus.org/display/BTM/LastResourceCommit). This basically emulates 2PC on top of 1PC with some caveats.

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1PC Transactions over JTA

Ludovic Orban
Administrator
In reply to this post by Wim Goossens
Wim,

This is somewhat correct, at least in this situation.

It is true that during startup, BTM will perform recovery on all configured resources.

But we are in a special case here as Amin is speaking about transactions involving only one database. When that happens, 1PC optimization is used and in-doubt transactions can never happen thus recovery becomes useless.

Ludovic
Loading...