How do I sort a very large file containing some 10 million records (JSON records) with size around 6 GB based on keys.
The solution should be memory optimised. I mean, there are ways to put the data into Collection and sort, but that consumes lot of heap size causing time barriers.
Please suggest some generic memory optimised sorting technique wherein we can pass a JSON file and some key values and the sort type and it returns a sorted file.
For example
File input.json
{
"name":"rohit", "age":20, ....
}
{
"name":"sourav", age":32, ....
}
.
.
.
//some 10 million records
So, suppose key is age, it and type is desc, it should return a file in desc order sorted on age.