I am quite new to Spring batch framework.
I am currently writing a batch with a reader and a writer.
Reader reads from Db and writer writes to a flat file. The number of records are 1 million. Writing to file takes a lot of time and I want to improve on that.
What is the best way I can achieve multithreading in writer so that write() method runs in parallel?
Note: In @BeforeStep and @AfterStep callbacks, I am writing header and footer of the file. write() method writes the records to file.
EDIT:
I have found out that, writing to file isn't taking much time but one of our internal method which does some sort of decryption takes about 500ms for 1 record. And we have 1 million such records.
Can I improve the performance by doing decryption in multiple threads? I am not able to understand how to improve from here on.