How to split a CSV file into multiple chunks and read those chunks in parallel in Java code -


i have big csv file (1gb+), has 100,000 line.

i need write java program parse each line csv file create body http request send out.

in other words, need send out 100,000 http requests corresponding lines in csv file. long if these in single thread.

i'd create 1,000 threads i) read line csv file, ii) create http request body contains read line's content, , iii) send http request out , receive response.

in way, need split csv file 1,000 chunks, , chunks should have no overlapped lines in each other.

what's best way such splitting procedure?

reading single file @ multiple positions concurrently wouldn't let go faster (but slow down considerably).

instead of reading file multiple threads, read file single thread, , parallelize processing of these lines. singe thread should read csv line-by-line, , put each line in queue. multiple working threads should take next line queue, parse it, convert request, , process request concurrently needed. splitting of work done single thread, ensuring there no missing lines or overlaps.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -