You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Aleksey Shipilev (JIRA)" <ji...@apache.org> on 2008/03/23 22:01:24 UTC

[jira] Created: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

[classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
------------------------------------------------------------------------------------

                 Key: HARMONY-5636
                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
             Project: Harmony
          Issue Type: Improvement
            Reporter: Aleksey Shipilev
            Priority: Minor


For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582869#action_12582869 ] 

Nathan Beyer commented on HARMONY-5636:
---------------------------------------

If it's POC, then you should have stated that in the subject and comments initially.

In any case, what's the concept trying to be proven?

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Improvement
>            Reporter: Aleksey Shipilev
>            Priority: Minor
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Shipilev closed HARMONY-5636.
-------------------------------------

    Resolution: Later

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Sub-task
>          Components: Classlib
>            Reporter: Aleksey Shipilev
>            Priority: Trivial
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582680#action_12582680 ] 

Aleksey Shipilev commented on HARMONY-5636:
-------------------------------------------

Sure, the patch is not safe, it's just POC. According to my measurements, up to 15% of _contended_ synchronization on SerialBench running on 8-core  server originates from this location. The reason for this is OOS.writeClassDesc call during the serialization.

I changed WeakHashMap to HashMap to avoid internal WeakHashMap's synchronization. This change is POC too.

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Improvement
>            Reporter: Aleksey Shipilev
>            Priority: Minor
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Shipilev updated HARMONY-5636:
--------------------------------------

    Attachment: 0004-serial-isProxyClass.patch

0004-serial-isProxyClass.patch
Trying to make fastpath unsynchronized.

However, it works if most of the classes are proxied, while can introduce double lookup for non-proxied class. Need something more elegant here.

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Improvement
>            Reporter: Aleksey Shipilev
>            Priority: Minor
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Shipilev updated HARMONY-5636:
--------------------------------------

    Issue Type: Sub-task  (was: Improvement)
        Parent: HARMONY-5632

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Sub-task
>            Reporter: Aleksey Shipilev
>            Priority: Minor
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581428#action_12581428 ] 

Nathan Beyer commented on HARMONY-5636:
---------------------------------------

This patch isn't safe. If applied, it would expose the possibility of the 'containsKey' being invoked while a 'put' is being invoked and there's no guarantee that the internal state of the Map would be safe for execution (spurious NPEs, etc).

The patch also removes the WeakHashMap, but that's not mentioned at all.

Additionally, the synchronized blocks in this bit of code are already very small, so I'm skeptical of real value of such a change. 

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Improvement
>            Reporter: Aleksey Shipilev
>            Priority: Minor
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nathan Beyer updated HARMONY-5636:
----------------------------------

    Priority: Trivial  (was: Minor)

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Sub-task
>            Reporter: Aleksey Shipilev
>            Priority: Trivial
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5636) [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582935#action_12582935 ] 

Aleksey Shipilev commented on HARMONY-5636:
-------------------------------------------

Nathan, sorry for the confusion.

The concept I'm trying to prove is: this problem affects scalability of serialization workloads, since isProxyClass infers the synchronization while accessing the static storage. Something should be thinked about this situation and probably slight redesign of the implementation should be done to overwhelm this problem. 

I'm not saying it should be fixed right now (that's why this issue has minor priority), but it should be remembered for the future.

> [classlib][luni][performance] java.lang.reflect.Proxy cache should be unsynchronized
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5636
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5636
>             Project: Harmony
>          Issue Type: Improvement
>            Reporter: Aleksey Shipilev
>            Priority: Minor
>         Attachments: 0004-serial-isProxyClass.patch
>
>
> For now, the proxyCache in Proxy is synchronized, which lead to performance problems with accessing Proxy.isProxyClass() from multiple threads at once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.