You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Vijay (JIRA)" <ji...@apache.org> on 2011/04/04 05:35:05 UTC

[jira] [Issue Comment Edited] (CASSANDRA-1969) Use BB for row cache - To Improve GC performance.

    [ https://issues.apache.org/jira/browse/CASSANDRA-1969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015264#comment-13015264 ] 

Vijay edited comment on CASSANDRA-1969 at 4/4/11 3:34 AM:
----------------------------------------------------------

used reflection to change the map into a synchronized WeakHashMap in SerializingCache

{code}
    static 
    {
    	hackJNA();
    }

    /**
     * this is a hack to make the WeakHashMap thread-safe. 
     * Bug ID: JNA-179 {@link http://java.net/jira/browse/JNA-179}
     */
    private static void hackJNA()
    {
        try
        {
            Field h = Memory.class.getDeclaredField("buffers");
            h.setAccessible(true);
            Map map = Collections.synchronizedMap(new WeakHashMap());
            h.set(null, map);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
{code}

      was (Author: vijay2win@yahoo.com):
    used reflection to change the map into a synchronized WeakHashMap in SerializingCache

    static 
    {
    	hackJNA();
    }

    /**
     * this is a hack to make the WeakHashMap thread-safe. 
     * Bug ID: JNA-179 {@link http://java.net/jira/browse/JNA-179}
     */
    private static void hackJNA()
    {
        try
        {
            Field h = Memory.class.getDeclaredField("buffers");
            h.setAccessible(true);
            Map map = Collections.synchronizedMap(new WeakHashMap());
            h.set(null, map);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
  
> Use BB for row cache - To Improve GC performance.
> -------------------------------------------------
>
>                 Key: CASSANDRA-1969
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1969
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>         Environment: Linux and Mac
>            Reporter: Vijay
>            Assignee: Vijay
>            Priority: Minor
>         Attachments: 0001-Config-1969.txt, 0001-introduce-ICache-InstrumentingCache-IRowCacheProvider.txt, 0002-Update_existing-1965.txt, 0002-implement-SerializingCache.txt, 0002-implement-SerializingCacheV2.txt, 0003-New_Cache_Providers-1969.txt, 0003-add-ICache.isCopying-method.txt, 0004-Null-Check-and-duplicate-bb.txt, 0004-TestCase-1969.txt, 1969-rollup-and-config.txt, 1969_Cache_SVN_Patch.diff, BB_Cache-1945.png, JMX-Cache-1945.png, Old_Cahce-1945.png, POC-0001-Config-1945.txt, POC-0002-Update_existing-1945.txt, POC-0003-New_Cache_Providers-1945.txt
>
>
> Java BB.allocateDirect() will allocate native memory out of the JVM and will help reducing the GC pressure in the JVM with a large Cache.
> From some of the basic tests it shows around 50% improvement than doing a normal Object cache.
> In addition this patch provide the users an option to choose BB.allocateDirect or store everything in the heap.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira