How to store HashMap values ​​separately in scala?

I have a scala hashmap that is generated by one application and used by another. The hashmap is large, for example 100 MB or more.

var actMap = new collection.mutable.HashMap[String, Seq[Object]];

      

Currently, the entire map is loaded into memory by the second application at startup. I am trying to just load the keys into memory and then when it looks for a key on the map, it should indicate the value that is stored in disk. Anyway, for this? Storing each value individually and accessing them on the fly is time consuming if standard serialization is used. What are the alternatives?

+3


source to share


1 answer


You might want to consider using memory mapped files for this. You can roll yourself.

Assuming you can change your interface a bit and use third party libraries you can look at



http://software.clapper.org/javautil/api/org/clapper/util/misc/FileHashMap.html

https://github.com/bmc/javautil/blob/master/src/main/java/org/clapper/util/misc/FileHashMap.java

+3


source







All Articles