Java to save big hashmap object in file instead of database


I have encountered an issue mostly related to the MongoDB io.

I need to read a large number of records out of MongoDB whenever there is a new record coming in and this new records will cause every records to change in the DB.

So I am thinking of a solution that I read all the records once, convert them into an HashMap object, modify the object with the new record, and then save the hashmap object to hard drive.

I wonder if the solution is feasible or functionally doable.

Who is Participating?
for_yanConnect With a Mentor Commented:
If your process is the only one which uses this data that may well be more effective
why not ? Serilaize and store HashMap to drive, and then read it and modify when necessary. and strore again.
The question is how fast it would be in comparison with database. Very well may be faster, but that is always a matter of experimenting.
Why not write the new stuff with Mongo?
wsyyAuthor Commented:
Mongo IO has been an issue so it is not feasible.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.