Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Multi-threading will improve your performance but there are a couple of things you need to know:</p> <ol> <li>Each thread needs its own JDBC connection. Connections can't be shared between threads because each connection is also a transaction.</li> <li>Upload the data in chunks and <code>commit</code> once in a while to avoid accumulating huge rollback/undo tables.</li> <li>Cut tasks into several work units where each unit does one job.</li> </ol> <p>To elaborate the last point: Currently, you have a task that reads a file, parses it, opens a JDBC connection, does some calculations, sends the data to the database, etc.</p> <p>What you should do:</p> <ol> <li>One (!) thread to read the file and create "jobs" out of it. Each job should contains a small, but not too small "unit of work". Push those into a queue</li> <li>The next thread(s) wait(s) for jobs in the queue and do the calculations. This can happen while the threads in step #1 wait for the slow hard disk to return the new lines of data. The result of this conversion step goes into the next queue</li> <li>One or more threads to upload the data via JDBC.</li> </ol> <p>The first and the last threads are pretty slow because they are I/O bound (hard disks are slow and network connections are even worse). Plus inserting data in a database is a very complex task (allocating space, updating indexes, checking foreign keys)</p> <p>Using different worker threads gives you lots of advantages:</p> <ol> <li>It's easy to test each thread separately. Since they don't share data, you need no synchronization. The queues will do that for you</li> <li>You can quickly change the number of threads for each step to tweak performance</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload