Hi Thomas,

Load position is right.

FileChannel is safe, but I would strongly discurage to put
MappedByteBuffer as default implementation in next 10 years :-)

I run your complete benchmarks  and can confirm that both NIO
implementations are slower. Maybe on other OS (I have winXP) it will
be faster.

I have patch which is replacing byte[] by ByteBuffer in all layers up
to the StoragePage, but it is failing in one test case. I dont have
energy to finish this patch, but I would be happy to send it.

I wrote this patch with intention to rewrite H2 SQL to Kilim Java
microthreads. (something like Actors in Scala or Erlang). H2 in this
case would use async IO and would be able to fetch more pages at same
time.
If you want take look at Kilim and sample http server.

http://www.malhar.net/sriram/kilim/
http://www.kotek.net/asynchttpd

Jan



On Wed, Mar 11, 2009 at 7:45 AM, Thomas Mueller
<[email protected]> wrote:
>
> Hi,
>
>> feel free to change licence and modify code
>
> Thanks!
>
> I ran the benchmark 'TestPerformance' against the regular and the NIO
> version. The result is:
>
> Statements per second: 68628 (regular)
> Statements per second: 76598 (NIO mapped, with mapped.load())
> Statements per second: 83756 (NIO mapped, without mapped.load())
> Statements per second: 83031 (NIO channel)
>
>> what are your plans with FileChannel?
>
> I will make two prefixes:
> jdbc:h2:nio:... (FileChannel)
> jdbc:h2:nioMapped:... (memory mapped files)
>
> I might make nio the default later on (not now yet).
>
>> I tried 'cleaner hack'
>
> Your version didn't work for me at first. Then I added
> cleanerMethod.setAccessible(true), and now it works. See my code in
> the previous mail. If it fails (for whatever reason, for example when
> using an JDK where the method doesn't exist) it will fall back to
> using System.gc(). I will also add an option to disable it.
>
>> There is one modification to my patch: Try to use
>> MappedByteBuffer.load() right after buffer is initialized (at remap()
>> method). This should improve performance.
>
> For my benchmark () it actually decreases performance. Did I add it at
> the right place?
>
>        // maps new MappedByteBuffer, old one is disposed during GC
>        mapped = file.getChannel().map(mode, 0, file.length());
>        if (SysProperties.NIO_LOAD_MAPPED) {
>            mapped.load();
>        }
>        mapped.position(oldPos);
>
> In any case, I will add a system property (h2.nioLoadMapped, default false).
>
> Regards,
> Thomas
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to