If I understand correctly your processing of one task from reading to loading in the database. You can break this task down into another character-based task (the central point of the database, the central central or central point). For example, you may have different tasks as follows
The current task, which selects a file from the directory and passes it to the next task.
IO Centric - a new task is to read the file and save it in memory, and then move on to the next taks.
DB centric is a new task for loading data from memory into a database and then clearing the memory.
IO centric - move the file to another location.
To further improve performance, you can implement task 2, 3, 4 using a thread pool. This will allow you to process many files in parallel. Based on the complexity of the task, you can add or remove any task from the list according to your requirements.
source share