Hello
I want to store a bigger amount of objects. Each object is rather small (in my test they contains one integer only).
For me it seems that db4o cannot handle more than 1000 objects or so. I made a simple test which stores 50000 objects, makes a commit and read them by randomized access. I can read more 1000 objects/sec if I store < 1000 objects. If I have stored 50000 the performance falls down to 50objects/second. I would like to get some helpful advice, maybe a better strategy.
This is the object
public class ContractKey {
final private int key;
public ContractKey(int key) { this.key = key; }
public int getKey() { return key; }
}
And this is the lookup:
private void executeReadKeys() {
int contractID = 1+Math.abs(random.nextInt()) % 50000; //random contractID
ContractKey c = getContractKeyFromDb(contractID); //get the value
}
And this is the database access code:
private ContractKey getContractKeyFromDb(final int id) {
List<ContractKey> ccl = database.query(new Predicate <ContractKey> () {
public boolean match(final ContractKey c){return c.getKey() == id; }
});
return ccl.listIterator().next();
}
This is the database configuration.
Db4o.configure().callConstructors(true);
Db4o.configure().lockDatabaseFile(true);
Db4o.configure().objectClass(ContractKey.class).objectField("key").indexed(true);
Db4o.configure().callbacks(false);
Db4o.configure().blockSize(8);
Db4o.configure().bTreeCacheHeight(100000);
Db4o.configure().bTreeNodeSize(100000);
I know that there are a couple of thinks I could do (like that weakreference thing) but they don't help that much.
Kindly Regards