Announcement Announcement Module
Collapse
No announcement yet.
Using multithreading pattern for DB read write operations Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using multithreading pattern for DB read write operations

    Hi,

    Here's my scenario:
    I have data in one temporary table, i get them and then insert these data in destinations tables.
    I have one reader and one writer in my xml file but i wonder how can i use multiple threads to improve performance, execution time and use the processing power resources available on the server ?

    What is the purpose of the throttle-limit parameter ? Is it linked to multithreading ?

    Are by default Spring batch reader and writer operations executed in the same thread ?


    If there are several threads picking data from the same source table what's the best solution in order to ensure they will not read the same data ?
    Same question for the writer.

    Thanks a lot.

  • #2
    Originally posted by jef_1 View Post
    What is the purpose of the throttle-limit parameter ? Is it linked to multithreading ?
    Are by default Spring batch reader and writer operations executed in the same thread ?
    Yes to both. See http://static.springsource.org/sprin...tithreadedStep.

    If there are several threads picking data from the same source table what's the best solution in order to ensure they will not read the same data ?
    Make sure the reader is thread safe. Most of the JDBC ones are out of the box in recent releases. If it's not then you can wrap the read() method in a synchronized block.

    Same question for the writer.
    The writer gets its input from the stack, so it will never be called twice with the same data in a single step execution.

    Comment

    Working...
    X