You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Egor Pasko (JIRA)" <ji...@apache.org> on 2006/12/20 13:02:23 UTC

[jira] Created: (HARMONY-2815) [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames

[classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames
------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2815
                 URL: http://issues.apache.org/jira/browse/HARMONY-2815
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: any/ia32
            Reporter: Egor Pasko
            Priority: Minor


consider the following test:
-----------------------------------------------------------------------
import java.security.Security;

public class SecurityPerfTest {
    public static void main(String[] args) {
        System.setSecurityManager(new SecurityManager());
        for (int i = 0; i < args.length; i++ ) {
            long start_time = System.currentTimeMillis();
            int amount = Integer.parseInt(args[i]);
            run(amount);
            long total_time = System.currentTimeMillis() - start_time;
            System.out.println(amount + " " + total_time);
        }
   }

   public static void run(int count) {
       if ( count < 0 ) {
           return;
       }

       //System.out.println("Runner: " +  count);
       System.getProperty("os.name");
       run(count - 1);
   }
}
-----------------------------------------------------------------------

where each recursive call of run() checks for security permissions

to run it, issue the recursion depth list via command-line parameters like this:
java SecurityPerfTest 50 100 150 300 350 400 450 500 

on Jrockit/ia32 the time spent for each step depends linearly on the number of
iterations:
50 107 // this line should be ignored
100 1
150 1
300 3
350 5
400 6
450 7
500 9

on Harmony (DRLVM) the dependency looks like quadratic:
50 114
100 647
150 1931
300 13798
350 21171
400 31116
450 43786
500 59547

I suspect too many stack unwindings performed on this microbenchmark


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (HARMONY-2815) [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames

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

Alexey Varlamov reassigned HARMONY-2815:
----------------------------------------

    Assignee: Alexey Varlamov

> [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2815
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2815
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: any/ia32
>            Reporter: Egor Pasko
>         Assigned To: Alexey Varlamov
>            Priority: Minor
>
> consider the following test:
> -----------------------------------------------------------------------
> import java.security.Security;
> public class SecurityPerfTest {
>     public static void main(String[] args) {
>         System.setSecurityManager(new SecurityManager());
>         for (int i = 0; i < args.length; i++ ) {
>             long start_time = System.currentTimeMillis();
>             int amount = Integer.parseInt(args[i]);
>             run(amount);
>             long total_time = System.currentTimeMillis() - start_time;
>             System.out.println(amount + " " + total_time);
>         }
>    }
>    public static void run(int count) {
>        if ( count < 0 ) {
>            return;
>        }
>        //System.out.println("Runner: " +  count);
>        System.getProperty("os.name");
>        run(count - 1);
>    }
> }
> -----------------------------------------------------------------------
> where each recursive call of run() checks for security permissions
> to run it, issue the recursion depth list via command-line parameters like this:
> java SecurityPerfTest 50 100 150 300 350 400 450 500 
> on Jrockit/ia32 the time spent for each step depends linearly on the number of
> iterations:
> 50 107 // this line should be ignored
> 100 1
> 150 1
> 300 3
> 350 5
> 400 6
> 450 7
> 500 9
> on Harmony (DRLVM) the dependency looks like quadratic:
> 50 114
> 100 647
> 150 1931
> 300 13798
> 350 21171
> 400 31116
> 450 43786
> 500 59547
> I suspect too many stack unwindings performed on this microbenchmark

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2815) [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2815?page=comments#action_12459918 ] 
            
Alexey Varlamov commented on HARMONY-2815:
------------------------------------------

Yes, j.s.AccessController.checkPermission() in DRLVM obtains a list of Classes on stack and for each non-system frame requests Class.getProtectionDomain() via public API (from provileged block), which requires performing extra access check,  leading to N^2 growth.
Should be fixed by adding dedicated kernel-native API, instead of (or in addition to) o.a.h.vm.VMStack.getClasses(), which would return a list of ProtectionDomains directly.

> [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2815
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2815
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: any/ia32
>            Reporter: Egor Pasko
>            Priority: Minor
>
> consider the following test:
> -----------------------------------------------------------------------
> import java.security.Security;
> public class SecurityPerfTest {
>     public static void main(String[] args) {
>         System.setSecurityManager(new SecurityManager());
>         for (int i = 0; i < args.length; i++ ) {
>             long start_time = System.currentTimeMillis();
>             int amount = Integer.parseInt(args[i]);
>             run(amount);
>             long total_time = System.currentTimeMillis() - start_time;
>             System.out.println(amount + " " + total_time);
>         }
>    }
>    public static void run(int count) {
>        if ( count < 0 ) {
>            return;
>        }
>        //System.out.println("Runner: " +  count);
>        System.getProperty("os.name");
>        run(count - 1);
>    }
> }
> -----------------------------------------------------------------------
> where each recursive call of run() checks for security permissions
> to run it, issue the recursion depth list via command-line parameters like this:
> java SecurityPerfTest 50 100 150 300 350 400 450 500 
> on Jrockit/ia32 the time spent for each step depends linearly on the number of
> iterations:
> 50 107 // this line should be ignored
> 100 1
> 150 1
> 300 3
> 350 5
> 400 6
> 450 7
> 500 9
> on Harmony (DRLVM) the dependency looks like quadratic:
> 50 114
> 100 647
> 150 1931
> 300 13798
> 350 21171
> 400 31116
> 450 43786
> 500 59547
> I suspect too many stack unwindings performed on this microbenchmark

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2815) [drlvm][performance] very slow security checks with quadratical dependence on number of stack frames

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

Alexey Varlamov updated HARMONY-2815:
-------------------------------------

    Component/s:     (was: Classlib)
                 DRLVM
     Issue Type: Improvement  (was: Bug)
        Summary: [drlvm][performance] very slow security checks with quadratical dependence on number of stack frames  (was: [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames)

I believe the issue is basically fixed in DRLVM, dependency is nearly linear now.

> [drlvm][performance] very slow security checks with quadratical dependence on number of stack frames
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2815
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2815
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>         Environment: any/ia32
>            Reporter: Egor Pasko
>         Assigned To: Alexey Varlamov
>            Priority: Minor
>
> consider the following test:
> -----------------------------------------------------------------------
> import java.security.Security;
> public class SecurityPerfTest {
>     public static void main(String[] args) {
>         System.setSecurityManager(new SecurityManager());
>         for (int i = 0; i < args.length; i++ ) {
>             long start_time = System.currentTimeMillis();
>             int amount = Integer.parseInt(args[i]);
>             run(amount);
>             long total_time = System.currentTimeMillis() - start_time;
>             System.out.println(amount + " " + total_time);
>         }
>    }
>    public static void run(int count) {
>        if ( count < 0 ) {
>            return;
>        }
>        //System.out.println("Runner: " +  count);
>        System.getProperty("os.name");
>        run(count - 1);
>    }
> }
> -----------------------------------------------------------------------
> where each recursive call of run() checks for security permissions
> to run it, issue the recursion depth list via command-line parameters like this:
> java SecurityPerfTest 50 100 150 300 350 400 450 500 
> on Jrockit/ia32 the time spent for each step depends linearly on the number of
> iterations:
> 50 107 // this line should be ignored
> 100 1
> 150 1
> 300 3
> 350 5
> 400 6
> 450 7
> 500 9
> on Harmony (DRLVM) the dependency looks like quadratic:
> 50 114
> 100 647
> 150 1931
> 300 13798
> 350 21171
> 400 31116
> 450 43786
> 500 59547
> I suspect too many stack unwindings performed on this microbenchmark

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


[jira] Resolved: (HARMONY-2815) [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames

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

Alexey Varlamov resolved HARMONY-2815.
--------------------------------------

    Resolution: Fixed

Fixed at r500190. 

Now DRLVM works much faster but still ~5-10x slower than JRockit 1.5 (on my T42 laptop): 

>build\win_ia32_msvc_release\deploy\jdk\jre\bin\java.exe SecurityPerfTest 50 100 150 300 350 400 450 500 1000 2000 3000 5000
50 20
100 40
150 90
300 70
350 70
400 91
450 100
500 120
1000 410
2000 1583
3000 3484
5000 10714

>java SecurityPerfTest 50 100 150 300 350 400 450 500 1000 2000 3000 5000
50 220
100 0
150 0
300 10
350 0
400 10
450 10
500 20
1000 50
2000 191
3000 440
5000 1202

> [classlib][security][drlvm][performance] very slow security checks with quadratical dependence on number of stack frames
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2815
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2815
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: any/ia32
>            Reporter: Egor Pasko
>         Assigned To: Alexey Varlamov
>            Priority: Minor
>
> consider the following test:
> -----------------------------------------------------------------------
> import java.security.Security;
> public class SecurityPerfTest {
>     public static void main(String[] args) {
>         System.setSecurityManager(new SecurityManager());
>         for (int i = 0; i < args.length; i++ ) {
>             long start_time = System.currentTimeMillis();
>             int amount = Integer.parseInt(args[i]);
>             run(amount);
>             long total_time = System.currentTimeMillis() - start_time;
>             System.out.println(amount + " " + total_time);
>         }
>    }
>    public static void run(int count) {
>        if ( count < 0 ) {
>            return;
>        }
>        //System.out.println("Runner: " +  count);
>        System.getProperty("os.name");
>        run(count - 1);
>    }
> }
> -----------------------------------------------------------------------
> where each recursive call of run() checks for security permissions
> to run it, issue the recursion depth list via command-line parameters like this:
> java SecurityPerfTest 50 100 150 300 350 400 450 500 
> on Jrockit/ia32 the time spent for each step depends linearly on the number of
> iterations:
> 50 107 // this line should be ignored
> 100 1
> 150 1
> 300 3
> 350 5
> 400 6
> 450 7
> 500 9
> on Harmony (DRLVM) the dependency looks like quadratic:
> 50 114
> 100 647
> 150 1931
> 300 13798
> 350 21171
> 400 31116
> 450 43786
> 500 59547
> I suspect too many stack unwindings performed on this microbenchmark

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