apache > db
Apache DB Project
Font size:      

Multi-thread programming tips

Multi-thread programming tips

Some programmers might share a Connection among multiple threads because they have experienced poor concurrency using separate transactions. Here are some tips for increasing concurrency:

  • Use row-level locking.
  • Use the TRANSACTION_READ_COMMITTED isolation level.
  • Avoid queries that cannot use indexes; they require locking of all the rows in the table (if only very briefly) and might block an update.

In addition, some programmers might share a statement among multiple threads to avoid the overhead of each thread's having its own. Using the single statement cache, threads can share the same statement from different connections. For more information, see "Tuning Databases and Applications" in Tuning Derby.

Previous Page
Next Page
Table of Contents