For this smaller-size database, it takes upto 7 minutes to open it, although we are running our application on low-powered hardware with a JVM that doesn't do JIT.
I think we now have a better understanding of what's behind these slow startups. When we first connect to the database a lot of time is spent rebuilding all the indexes. We found this strange because we were using LOG=2 option in our connection url. However, after a more thorough examination of our code we found that actually our first connection to the database did not have the LOG=2. The connections that we make later did have this option enabled, but we suspect it was not being treated quite correctly. Specifically, when when we connect with a LOG=2 option after having made a connection first without it, we end up in the Database.setLog(int level) method. It correctly updates the 'logLevel' member variable as well as 'fileIndex.logChanges'. However, the value of 'Database.logIndexChanges' remains unchanged and equal to 'false'. This, we believe, is not the intended behavior and is causing problems in the index recovery on startup. Could you please tell us what you think? Thank you, - Gene On Oct 10, 3:25 pm, "Thomas Mueller" <[EMAIL PROTECTED]> wrote: > Hi, > > > It takes very long time to make an initial connection to the database > > after our application gets improperly shutdown (e.g. power > > disconnected). We use H2 in embedded mode, and the database size is > > about 40 MB. > > How long is "very long"? > > Usually small databases like that start quickly, even when not shut > down correctly. For larger databases it helps to use SET LOG 2, see > alsohttp://www.h2database.com/html/grammar.html#setlog > > But in your case (40 MB) this shouldn't be required. What database > URL, operating system, virtual machine (brand and version), and file > system do you use? How much memory do you have and how much do you > allocate to the JVM (the default should be fine... just to make sure)? > > Could you send the list of files (file name and file sizes)? > > Regards, > Thomas > > > > > > > [1] java/io/RandomAccessFile.read([BII)I (pc 4), pc = 4 > > [2] java/io/RandomAccessFile.readFully([BII)V (pc 35), pc = 35 > > [3] org/h2/store/FileStore.readFully([BII)V (FileStore:280), pc = 97 > > [4] org/h2/store/DiskFile.getRecord(Lorg/h2/engine/Session;ILorg/h2/ > > store/RecordReader;I)Lorg/h2/store/Record; (DiskFile:577), pc = 91 > > [5] org/h2/store/Storage.getRecord(Lorg/h2/engine/Session;I)Lorg/h2/ > > store/Record; (Storage:94), pc = 17 > > [6] org/h2/index/ScanIndex.getNextRow(Lorg/h2/engine/Session;Lorg/h2/ > > result/Row;)Lorg/h2/result/Row; (ScanIndex:258), pc = 82 > > [7] org/h2/index/ScanCursor.next()Z (ScanCursor:71), pc = 170 > > [8] org/h2/table/TableData.addIndex(Lorg/h2/engine/Session;Ljava/lang/ > > String;I[Lorg/h2/table/IndexColumn;Lorg/h2/index/IndexType;ILjava/lang/ > > String;)Lorg/h2/index/Index; (TableData:189), pc = 240 > > [9] org/h2/command/ddl/CreateIndex.update()I (CreateIndex:90), pc = > > 250 > > [10] org/h2/engine/MetaRecord.execute(Lorg/h2/engine/Database;Lorg/h2/ > > engine/Session;Lorg/h2/api/DatabaseEventListener;)V (MetaRecord:85), > > pc = 33 > > [11] org/h2/engine/Database.open(II)V (Database:600), pc = 1071 > > [12] org/h2/engine/Database.<init>(Ljava/lang/String;Lorg/h2/engine/ > > ConnectionInfo;Ljava/lang/String;)V (Database:213), pc = 589 > > [13] org/h2/engine/Engine.openSession(Lorg/h2/engine/ > > ConnectionInfo;ZLjava/lang/String;)Lorg/h2/engine/Session; (Engine: > > 56), pc = 75 > > [14] org/h2/engine/Engine.openSession(Lorg/h2/engine/ > > ConnectionInfo;)Lorg/h2/engine/Session; (Engine:125), pc = 33 > > [15] org/h2/engine/Engine.getSession(Lorg/h2/engine/ > > ConnectionInfo;)Lorg/h2/engine/Session; (Engine:108), pc = 5 > > [16] org/h2/engine/Session.createSession(Lorg/h2/engine/ > > ConnectionInfo;)Lorg/h2/engine/SessionInterface; (Session:242), pc = 7 > > > Is there anything that we can do to speed up the inital connect? Will > > it help if we perform frequent checkpoints? > > > Any help is most appreciated. Thank you, > > - G- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
