Hi, I have a module which requires a H2 database which finishes within 2-3 minutes when executed using Maven as a standalone module. The H2-related queries are all SELECT queries, no updates or DDL statements. H2 is first started in TCP server mode, and then the build process connects to it via TCP. The H2 server is embedded within the JVM Maven process.
Putting the same module into a multi-threaded build which incorporates many build processes and using H2 embedded results in the same module taking ~1 hour to finish. The same queries are executed, I traced the execution and noticed x30-x60 slowdowns on query performance. I monitored the build with JVisualVM, and made sure that there was enough JVM heap space and PermSize for the Java process which runs the build. I tried using H2 versions 1.4.186, 1.4.193, 1.4.194 & 1.4.195. Experimented with various flags: LOCK_MODE=0 LOG=0 UNDO_LOG=0 CACHE_SIZE=1048576 CACHE_TYPE=SOFT_LRU/TQ Here is the heap histogram output by jmap -histo num #instances #bytes class name ---------------------------------------------- 1: 25402817 1166684144 [C 2: 18099664 434391936 java.lang.String 3: 1491063 332812272 [B 4: 6071838 318787944 [Ljava.lang.Object; 5: 2419255 250363256 [Lorg.h2.value.Value; 6: 2445819 162806568 [Ljava.util.HashMap$Entry; 7: 3736585 149463400 java.util.LinkedHashMap$Entry 8: 3631817 116218144 java.util.HashMap$Entry 9: 2416807 116006736 java.util.StringTokenizer 10: 4545175 109084200 java.util.ArrayList 11: 643851 103113688 <constMethodKlass> 12: 1580888 98177376 [I 13: 2431688 89949640 [Ljava.lang.String; 14: 643851 87575944 <methodKlass> 15: 1480956 82933536 java.util.HashMap 16: 1951296 78051840 org.h2.result.RowImpl 17: 2405450 76974400 org.apache.maven.model.InputLocation 18: 64034 75171616 <constantPoolKlass> 19: 1553914 62156560 java.math.BigInteger 20: 962981 61630784 java.util.LinkedHashMap 21: 64034 50599056 <instanceKlassKlass> 22: 50653 43477952 <constantPoolCacheKlass> 23: 1736945 41686680 org.h2.mvstore.CursorPos 24: 917658 36706320 org.codehaus.plexus.util.xml.Xpp3Dom 25: 429144 34331520 org.apache.maven.artifact.DefaultArtifact 26: 864733 27671456 java.util.Hashtable$Entry 27: 488211 27339816 org.apache.maven.model.Dependency 28: 1120762 26898288 org.apache.maven.artifact.versioning.ComparableVersion$ListItem 29: 1549987 24799792 org.apache.maven.artifact.versioning.ComparableVersion$IntegerItem 30: 182202 21864240 org.apache.tools.zip.ZipFile$Entry 31: 33043 19143440 <methodDataKlass> 32: 767073 18409752 java.util.LinkedList$Node 33: 211597 16927760 java.lang.reflect.Method 34: 302199 16923144 org.h2.mvstore.Cursor 35: 420598 16823920 org.apache.maven.artifact.versioning.DefaultArtifactVersion 36: 378845 15153800 org.eclipse.aether.artifact.DefaultArtifact 37: 456113 14595616 org.h2.mvstore.db.TransactionStore$TransactionMap 38: 563697 13528728 org.h2.value.ValueLong 39: 382851 12251232 java.util.LinkedList 40: 378824 12122368 java.util.Collections$UnmodifiableMap 41: 302177 12087080 org.h2.mvstore.db.MVSecondaryIndex$MVStoreCursor 42: 377160 12069120 org.eclipse.aether.graph.Dependency Would appreciate help in optimizing H2 for embedded use in this case. -- 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.
