Skip to Content
0
Former Member
Sep 20, 2005 at 02:57 PM

XA performance

147 Views

I tried running simple test -

Simple EJB method is performing single XA DataSource Access.

On NetWeaver it performs about 5-9 times slower comparing to equal test using single Non-XA DataSource Access.

But exactly the same 2 tests on Weblogic have almost the same perfomance.

Are there any ways to optimize the situation when using single XA resource in transaction, to avoid two-phase commit?

This is my test: 2 EJB methods with Required transaction attribute, each of them is called 1000 times.

public void runXAOnly() throws RemoteException, NamingException, SQLException {

doStatement("java:comp/env/jdbc/jts/testXA", "insert into test values ('text', 10)");

doStatement("java:comp/env/jdbc/jts/testXA", "select * from test");

}

public void runNonXAOnly() throws RemoteException, NamingException, SQLException {

doStatement("java:comp/env/jdbc/jts/testNonXA", "insert into test values ('text', 10)");

doStatement("java:comp/env/jdbc/jts/testNonXA", "select * from test");

}

private void doStatement(String poolPath, String statement) throws NamingException, SQLException {

String stmtVal = statement;

InitialContext ic = new InitialContext();

DataSource _dataSource = (DataSource) ic.lookup(poolPath);

java.sql.Connection conn = _dataSource.getConnection();

PreparedStatement stmt = null;

try {

stmt = conn.prepareStatement(stmtVal);

stmt.execute();

} finally {

if(stmt != null) stmt.close();

conn.close();

}

}