HA-JDBC offers serial or parallel transaction mode. From what I can tell from source, this maps to an ExecutorService in TransactionMode, and code such as DatabaseWriteInvocationStrategy.invokeAll() submits requests to that service in database order.
I tried parallel but I could not use it. My legacy application experienced deadlock and lacked application-level retries for transactions. HA-JDBC also does not support retrying a transaction. So I am stuck using serial. This is OK for 2 servers with Tomcat and MySQL, for example, if they have low latency (ex: on the same LAN). However, if latency is high then serial execution is painfully slow. For example, I tested latency in AWS between servers in Virgina and Japan and sometimes see latency reach 300msec, versus 1msec in a LAN environment.
An enhancement I would like to see in HA-JDBC is mixed transaction mode. Transaction control operations like START, PREPARECOMMIT, COMMIT, and ROLLBACK would execute serially in this mode. However, operations like connection establishment, connection isAlive test, and SELECT operations could probably execute safely in parallel. Even some other operations like INSERT/UPDATE/DELETE/TRUNCATE might be OK to operate in parallel.
I am not sure if it makes sense to have two levels of mixed mode, say conservative and aggressive. Conservative mixed mode would do connections, isAlive test, and read-only SELECTs in parallel (no SELECT FOR UPDATE). Aggressive mixed mode would do everything in parallel except transaction control operations.
Anything to improve serial execution performance without compromising serial safety would be most welcome.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HA-JDBC offers serial or parallel transaction mode. From what I can tell from source, this maps to an ExecutorService in TransactionMode, and code such as DatabaseWriteInvocationStrategy.invokeAll() submits requests to that service in database order.
I tried parallel but I could not use it. My legacy application experienced deadlock and lacked application-level retries for transactions. HA-JDBC also does not support retrying a transaction. So I am stuck using serial. This is OK for 2 servers with Tomcat and MySQL, for example, if they have low latency (ex: on the same LAN). However, if latency is high then serial execution is painfully slow. For example, I tested latency in AWS between servers in Virgina and Japan and sometimes see latency reach 300msec, versus 1msec in a LAN environment.
An enhancement I would like to see in HA-JDBC is mixed transaction mode. Transaction control operations like START, PREPARECOMMIT, COMMIT, and ROLLBACK would execute serially in this mode. However, operations like connection establishment, connection isAlive test, and SELECT operations could probably execute safely in parallel. Even some other operations like INSERT/UPDATE/DELETE/TRUNCATE might be OK to operate in parallel.
I am not sure if it makes sense to have two levels of mixed mode, say conservative and aggressive. Conservative mixed mode would do connections, isAlive test, and read-only SELECTs in parallel (no SELECT FOR UPDATE). Aggressive mixed mode would do everything in parallel except transaction control operations.
Anything to improve serial execution performance without compromising serial safety would be most welcome.