Hi,

Thanks a lot! Unfortunately, I did not yet have time to analyze the
patch. I think the SOFT type is not usefull (as you found out). I'm
not sure if using a second parameter makes sense, I think it would
simplify things if there is only one type. What about

CACHE_TYPE=LRU, TQ, WEAK_LRU, WEAK_TQ

Regards,
Thomas

On Sun, Apr 26, 2009 at 2:47 PM, Jan Kotek <[email protected]> wrote:
> Hi Thomas,
> here is final version of cache. I changed design. Now it is
> implemented as 2nd level cache which wraps original cache (proxy
> pattern). So it does not interfier with existing caching mechanism. It
> adds new connection parameter CACHE2_TYPE with possible values WEAK,
> SOFT and HARD. It is not used by default, maybe in future you can make
> SOFT default.
>
> I also modified documentation:
> H2 also supports 2nd level cache. It uses WEAK, SOFT or HARD
> references. With WEAK reference
> page is stored in cache until it is Garbage Collected (GCed). With
> SOFT reference pages are
> GCed only when system is low on memory. With HARD reference pages are
> never GCed, so you need
> to make sure you have enought memory to fit entire DB into it.By
> default H2 does not use 2nd
> level cache, in future SOFT may became default option. 2nd level cache
> can be enabled by parameter
> in database connection URL: (jdbc:h2:~/test;CACHE2_TYPE=SOFT)
>
> I ran your unit test with SOFT as default, only TestMemoryUsage' was
> failing (propably because of cache). It should be compatibile with JRE
> 1.3. For my usages it increases performance significantly (JRE 1.6)
> with -Xmx512m
>
> This is final version of my patch. I will not modify unless bug
> reports are reported. It also updates documentation and change log.
>
> Thomas: feel free to modify licence as you need.
>
> Best regards,
> Jan
>
>
> On Sun, Apr 19, 2009 at 5:42 PM, Thomas Mueller
> <[email protected]> wrote:
>>
>> Hi,
>>
>> Thanks for the patch! What about using a new cache type? The easiest
>> solution is to replace the the 2Q algorithm with the soft reference
>> cache; better would be to use a new type (for example SOFT).
>>
>>> So I implemented cache using SoftReference. My prototype is attached.
>>> It should be fine for read-only usage.
>>
>> What about combining it with LRU? So that written pages are kept in
>> the LRU, and the read part is kept in the soft reference map?
>>
>>> Please try it with lot of memory free memory and read only scenario.
>>> If it will be better then current cache I will continue and finish
>>> implementation.
>>
>> I'm sorry, but I don't have much time to test it currently... But I'm
>> sure it will be better than the current cache algorithm, because it
>> doesn't require any settings and still will use all available memory.
>>
>>> I  need motivation :-)
>>
>> If you like, we could call it the "Jan Kotek" cache :-)
>> jdbc:h2:~/test;CACHE=JAN_KOTEK
>>
>> If you want to make integrating the patch simpler for me, I suggest
>> you follow the patch guidelines described at
>> http://www.h2database.com/html/build.html#providing_patches
>>
>> Regards,
>> Thomas
>>
>> >
>>
>
> <div><br></div>
>
> >
>

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