« Return to Thread: "Multiple BTM with multiple jdbc datastores" + "jdbc prepareStatements"
I am using Postgres. Please note that I am using two datastores (2 postgres servers) and two BTMs. I ran the following experiment:Ludovic Orban-2 wrote:Nothing in JTA or BTM prevents you from using the serializable isolation level. Maybe your database has such limitation though.
Ludovic Orban-2 wrote:One last thing: you can definitely run multiple transaction managers against
a single DB but you have to make sure every single BTM instance has a
different serverId.
2011/10/20 Ludovic Orban <lorban@bitronix.be>
> Hi,
>
> Nothing in JTA or BTM prevents you from using the serializable isolation
> level. Maybe your database has such limitation though.
>
> If you want to use prepared statements, just make sure you always call
> Connection.prepareStatement() with the exact same SQL queries and enable the
> prepared statement cache and the BTM connection pool will do the rest for
> you.
>
> Just keep in mind that not all databases benefit from preparing statements.
> Depending on the DB / JDBC driver implementations you may not get any
> performance benefit.
>
> Ludovic
>
>
>
> 2011/10/19 Fazool <fazoolmein@gmail.com>
>
>>
>> Hi,
>>
>> I am using BTM for prototyping a shared nothing database; where a
>> transaction can touch multiple databases so I need two-phase commit. I
>> will
>> appreciate if you can answer the following:
>>
>> 1) As per documentation, I can use multiple BTM with a single datastore. I
>> want to use multiple BTMs (running on different machines) for multiple
>> jdbc
>> datastores, where a transaction can update rows on different datastores.
>> According to my experiments, we cannot have 'Seriablizable' isolation
>> level
>> in this context. Is this correct?
>>
>> 2) I am using prepareStatements in jdbc. As I see, I have to 'prepare' a
>> prepareStatement everytime I want to run a query. For example:
>>
>> btm.begin()
>> PrepareStatement p = con.prepareStatement("...");
>> p.setInt(1,1);
>> ...
>> p.executeUpdate();
>> btm.commit();
>>
>> Creating a statement everytime I want to run a transaction has performance
>> penalties. I am unable to do something like:
>>
>> PrepareStatement p = con.prepareStatement("...");
>>
>> btm.begin()
>> p.setInt(1,1);
>> p.executeUpdate();
>> btm.commit();
>>
>> btm.begin()
>> p.setInt(1,2);
>> p.executeUpdate();
>> btm.commit();
>>
>> i.e. use the same prepare statement multiple times. Is setting a high
>> value
>> of PreparedStatementCacheSize going to improve efficiency of
>> "con.prepareStatement("...");" within a btm.begin()/end()? I ran some
>> basic
>> experiments, and PreparedStatementCacheSize didnt help much. Can you
>> kindly
>> comment on how to make this efficient?
>>
>> Thank you very much!
>>
>> --
>> View this message in context:
>> http://old.nabble.com/%22Multiple-BTM-with-multiple-jdbc-datastores%22-%2B-%22jdbc-prepareStatements%22-tp32685902p32685902.html
>> Sent from the Bitronix Transaction Manager mailing list archive at
>> Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
« Return to Thread: "Multiple BTM with multiple jdbc datastores" + "jdbc prepareStatements"
| Free embeddable forum powered by Nabble | Forum Help |