Announcement Announcement Module
Collapse
No announcement yet.
Spring Batch - Best Practices Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Batch - Best Practices

    Hello Gurus/Senior Members,

    We have decided to go with Spring-batch for all our batch processes. Since this is our first implementation using Spring-batch, I thought it would be appropriate to get the best practices/lessons learnt from the people who have implemented Spring-batch in their projects.

    Please share with me best practices/lessons learnt on following:
    1. Spring-batch Core components
    2. Spring-batch Infrastructure components
    3. Steps to be followed while implementing the batch applications
    4. Sharing data between steps. Is it possible to share data between Jobs?
    5. Integration with Quartz
    6. Deployment of multi-threaded batch jobs in Servlet container or JEE App server

    etc.

    Best regards,
    Saravan.

  • #2
    It sounds like a good idea, it might take a huge investment of time and one person cannot answer all the questions here. One thing that I learned today which I can share is:

    => When you are reading from a file/database and doing some processing and writing to a file/database, define the step as a multithreaded it improve the performance by 33%. Other preconditions include: 1) saveState = false (you are not worried about the state where it is or failed. 2) job's restartable = false (you are not worried about job maintaining the unique instance).

    In my case it worked out very well as I just need to dump the data to a file. 33% improved performance on a 30 minutes process is a good performance booster.

    If someone can collect all the details and share it in the website that would be GREAT!!

    Comment


    • #3
      Much Thanks. It is a good starting point.

      Could you give the job configuration on how to set as multi threaded? Is it something similar to what is defined in parallelJob configuration in Spring Batch Sample? Please clarify.

      Thanks,
      Saravan.

      Comment


      • #4
        Yeah... it is pretty straight-forward. Here is the code:

        Code:
        <step id="generateFile" next="mergeRecords">
          <tasklet>
             <chunk reader="fileReader" writer="fileWriter"
        	commit-interval="100" task-executor="taskExecutor">
        	<streams>
        	  <stream ref="fileReader" />
        	  <stream ref="fileWriter" />
        	</streams>				
             </chunk>
           <listeners>
             <listener ref="stepListener" />
           </listeners>
         </tasklet>
        </step>
        And the task executor is defined as:

        Code:
        <beans:bean id="taskExecutor"
        		class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
        Can you share the doc once you have it completed? :-)

        Comment


        • #5
          Hi Saravan,

          Did you get any document that can be shared with members?

          Thanks

          Comment

          Working...
          X