Hi !
Could you please clarify some mvstore file sizing ?
I'm comparing different store engines, and found some strange behavior of
MVStore.
I need to store about 10k maps with small values (i.e. long[3]) and long
(timestamp actualy) as a key.
When i save same amount of data (5000000 entries) a) into one map and b)
distributed into many maps, file sizes are very different:
1 : 107Mb
10 : 111Mb
100 : 149Mb
1000 : 857Mb
10000 : 2535Mb
Is it ok ? What is the best practice to store 10k maps ? Should i
distribute data into many stores or append mapId to key and use one map ?
Thank you !
I use <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>
This is my test code:
package mvstoretest;
import org.h2.mvstore.MVMap;
import org.h2.mvstore.MVStore;
import java.io.File;
public class SizeTest {
public static void main(String[] args) {
for (String mapsCount : args) {
new SizeTest().run(Integer.valueOf(mapsCount));
}
}
private void run(int mapsCount) {
long total = 5000000;
String fileName = getFilename(mapsCount);
MVStore store = createStore(fileName);
for (long i=0; i<total; i++) {
long mapNo = i % mapsCount;
MVMap<Object, Object> map = store.openMap(String.valueOf(mapNo));
map.put(i, new Long[]{i+1,i+2,i+3});
}
store.close();
System.out.println(mapsCount + " : " + new
File(fileName).length()/1024/1024 + "Mb");
}
private MVStore createStore(String fileName) {
return new MVStore.Builder().
fileName(fileName).open();
}
private String getFilename(int mapsCount) {
String fileName = System.getProperty("user.home") + File.separator +
this.getClass().getSimpleName();
new File(fileName).mkdirs();
fileName += File.separator + mapsCount+".mv";
return fileName;
}
}
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.