title: Issue with Hash Map Space
body: <p>In my Java code, I am using Guava's Multimap (<a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Multimap.html" rel="nofollow noreferrer">com.google.common.collect.Multimap</a>) by using this:</p>
  
  <pre><code> Multimap&lt;Integer, Integer&gt; Index = HashMultimap.create()
  </code></pre>
  
  <p>Here, Multimap key is some portion of a URL and value is another portion of the URL (converted into an integer). Now, I assign my JVM 2560 Mb (2.5 GB) heap space (by using Xmx and Xms). However, it can only store 9 millions of such (key,value) pairs of integers (approx 10 million). Now, issue is, I can provide JVM only limited amount of memory (say 2 GB).</p>
  
  <p>So, can anybody help me,</p>
  
  <p>1) Is there another way or home-baked solution to solve this memory issue? Means, Is Disk/DB Based Multi-Map can be a nice solution ? I read from some web articles that there is some DB/Disk based solution to solve this issue ex. <a href="http://www.oracle.com/technetwork/products/berkeleydb/overview/index.html?origref=https://stackoverflow.com/questions/2654709/disk-based-hashmap" rel="nofollow noreferrer">Berkley DB</a> or <a href="http://ehcache.org/" rel="nofollow noreferrer">Ehcache</a>. Can anybody inform me whether (or which one) is faster ? </p>
  
  <p>2) Is those Disk/DB Based Multi-Map has performance issue (I am asking for both storing and searching) ?</p>
  
  <p>3) Any idea or information how to use those in brief.</p>
  
  <p>4) Any other idea will be nice for me.</p>
  
  <p>NB: I want Multimap (key can have multiple values)solutions for the above issue. And I have to consider performance of storing and searching also.</p>