mapdb icon indicating copy to clipboard operation
mapdb copied to clipboard

need help~~!

Open new1943 opened this issue 10 years ago • 7 comments

Hi, I need a solution. Environment is like this, I have about 40 million of the number of groups, example as 12345678:abc, I need to put into the memory of storage and query. Because there is a time limit, each query is not longer than 200ms. I use the htreemap MapDB off heap, load 1 Million number group every 10 seconds. But there are some problems, in the process, I need to update the number of these numbers, I have close DB operation. Then re create a new DB to load, this time the user has a query, it throws a OUTOFMEMORY exception. So I would like to ask, in this case, MapDB have any good solution? I have also tried, first not close db, such as loading the original DB to the original close. But the same throw OUTOFMEMORY.so i need help, let system can reload, and can successfully query.

new1943 avatar Jan 19 '16 07:01 new1943

How do you startup mapdb?

shabanovd avatar Jan 19 '16 09:01 shabanovd

use the example:

//first create store DB db = DBMaker .memoryDirectDB() // make it faster .transactionDisable() //some additional options for DB // .asyncWriteEnable() // .cacheSize(100000) .make();

    HTreeMap cache = db
            .hashMapCreate("cache")
            .expireStoreSize(4G)
            .keySerializer(Serializer.STRING)
            .valueSerializer(Serializer.STRING)
            .make();

new1943 avatar Jan 19 '16 09:01 new1943

Do you call commit?

shabanovd avatar Jan 19 '16 09:01 shabanovd

no~~i just new a db , and put the number gruop in htreemap

new1943 avatar Jan 19 '16 09:01 new1943

You need to call commit from time to time.

shabanovd avatar Jan 19 '16 10:01 shabanovd

oh~~i see. thx. but why i close this map , this off heap can't clear the memory ?

new1943 avatar Jan 19 '16 10:01 new1943

Try .cacheDisable().

jankotek avatar Jan 19 '16 10:01 jankotek