Hi again, The "support files over 2 GB" is not required: you can use FileSystemSplit (the prefix split:, database URL jdbc:h2:split:nio:~/test). If required, I can make this the default when using NIO, but let's first see what are the performance characteristics.
As a workaround for the NIO problem http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 , the 'cleaner hack' can be made to work like this: boolean useSystemGc = Boolean.valueOf(System.getProperty("h2.nioUseGc")).booleanValue(); try { Method cleanerMethod = mapped.getClass().getMethod("cleaner"); cleanerMethod.setAccessible(true); Object cleaner = cleanerMethod.invoke(mapped); Method clearMethod = cleaner.getClass().getMethod("clear", new Class[0]); clearMethod.invoke(cleaner, new Object[0]); } catch (Throwable e) { useSystemGc = true; } if (useSystemGc) { WeakReference bufferWeakRef = new WeakReference(mapped); mapped = null; long start = System.currentTimeMillis(); while (bufferWeakRef.get() != null) { if (System.currentTimeMillis() - start > GC_TIMEOUT_MS) { throw new RuntimeException("Timeout (" + GC_TIMEOUT_MS + " ms) reached while trying to GC mapped buffer"); } System.gc(); Thread.yield(); } } Regards, Thomas On Sun, Mar 8, 2009 at 6:23 PM, Thomas Mueller <[email protected]> wrote: > Hi, > > Thanks a lot for the patch! I will try to integrate it, however I will > have to change a few things. > > First, are you OK with the H2 license? I will add you as the 'initial > developer'. > > Then I will change the formatting (spaces instead of tabs, always use > {}). I will create a new class FileSystemDiskNio that extends > FileSystemDisk, and create a new prefix "nio:". Then you have used > generics, I will remove them (at the moment I like to support Java > 1.4). > > I did run a benchmark, but only a very simple one (using the H2 Console): > > DROP TABLE IF EXISTS TEST; > CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255)); > @LOOP 100000 INSERT INTO TEST VALUES(?, 'Hello'); > @LOOP 100000 SELECT * FROM TEST WHERE ID=?; > @LOOP 100000 UPDATE TEST SET NAME='Hi' WHERE ID=?; > drop all objects delete files; > > Result: > > NIO: (jdbc:h2:nio:~/test) > 3177 ms > 1387 ms > 3766 ms > > Regular: (jdbc:h2:~/test) > 1496 ms > 2809 ms > 4268 ms > > Regards, > Thomas > > > > On Fri, Mar 6, 2009 at 10:21 AM, Mikkel Kamstrup Erlandsen > <[email protected]> wrote: >> 2009/3/6 Jan Kotek <[email protected]> >>> >>> 1) My patch adds two more classes and does not change others. It is >>> completely __OPTIONAL__ >>> 2) 1.3 is __still supported__, but can use only classical file >>> storage. Multiple version of jars for each VM are __not needed__. >>> 3) NIO does not depend on 1.5 collections, minimal JRE version is 1.4 >>> >>> It would be nice to get comments on my code or NIO perfomance. Should >>> I provide compiled JARs? Is someone interested on testing? >> >> Hi Jan, >> >> Just noting that I am eagerly wanting to try your patches as we are running >> a performance critical H2 DB here on State and University Library of >> Denmark, and we have seen significant performance gains porting some other >> systems to NIO. >> >> However my time is pretty much consumed by some looming deadlines so my NIO >> adventures are put on hold for now. I'll hopefully get a little time for >> this some time next week... Unless someone else beats me to it (here's for >> hoping :-)) >> >> -- >> Cheers, >> Mikkel >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
