I am developing a piece of code for massive import of items into database. The total records in the Excel file are 24103. And the total time of 40 minutes it was taking initially to import 700 lines of record because of massive validations. Now after reducing the strategical steps the time has reduced to 24 minutes for all records. Now there are 4 activities which could execute parallely independent of each other. Those activities i tried executing parallely by async.parallel process. But when i saw the console for debugging, i came to know that it still execute those all in one record at a time way. Just the difference is in shuffling of records which are getting inserted. And after all the execution, it took the same time that it took before when the activities executing sequentially. What could be another possible way to make execution(Insert) in parallel way.
My steps include
flowController.on('START', function () {
// Uploading and storing the binary data as excel file
});
flowController.on('1', function () {
// Validation to check if file contain required sheet with name and all and convert the file into JSON format
});
flowController.on('2', function () {
// Replacing the keys from the JSON to match the required keys
});
flowController.on('3', function () {
// Massive validation of records & seperating the records as per the activity
});
// Activity 1
flowController.on('4', function () {
// Insert records of Activity 1
});
// Activity 2
flowController.on('5', function () {
// Insert records of Activity 2
});
// Activity 3
flowController.on('6', function () {
// Insert records of Activity 3
});
// Activity 3
flowController.on('END', function () {
// End
});