First try using jdbm2 as a disc-based hashmap. Seems to work well.