harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Dmitriev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4141) [classlib][jndi] InitialContext.getURLOrDefaultInitCtx() optimization
Date Sat, 23 Jun 2007 13:23:26 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507608
] 

Sergey Dmitriev commented on HARMONY-4141:
------------------------------------------

Here is mini benchmark demonstrating the issue. It consists of 3 files (attached):
  1. lookup.java
  2. MyDefaultInitialContextFactory.java
  3. MyInitialContext.java

The following concrete usage case shows about 260X difference between SUN and HARMONY. Please
note the command line switches. This usage case is not just an invented one - similar stuff
can be observed in Oracle Application Server start up.

] boy@sun ~/tmp
] javac lookup.java MyDefaultInitialContextFactory.java MyInitialContext.java

] boy@sun ~/tmp
] java -showversion -Djava.naming.factory.initial=MyDefaultInitialContextFactory -Djava.naming.factory.url.pkgs=com.other:com.other2:com.other3
lookup
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
BEA JRockit(R) (build R26.3.0-32-58710-1.5.0_06-20060308-2022-linux-ia32, )

50 millis elapsed.

] boy@sun ~/tmp
] ~/jre/bin/java -showversion -Djava.naming.factory.initial=MyDefaultInitialContextFactory
-Djava.naming.factory.url.pkgs=com.other:com.other2:com.other3 lookup
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r549111, (Jun 22 2007), Linux/ia32/gcc 3.3.3, release build
http://harmony.apache.org
The GC did not provide gc_add_weak_root_set_entry()
13063 millis elapsed.


> [classlib][jndi] InitialContext.getURLOrDefaultInitCtx() optimization
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-4141
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4141
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>         Attachments: 6minutes.patch, lookup.java, MyDefaultInitialContextFactory.java,
MyInitialContext.java
>
>
> In process of enabling SPECjAppServer2004 on harmony on Oracle
> Application Server the following issue in JNDI has been discovered.
> While starting Oracle EJB Containers (OC4J) with SPECjAppServer2004
> onboard OC4J creates several thousands of beans. And for every such
> bean OC4J has to set the lookup context - corresponding class which is
> taken from InitialContext.getURLOrDefaultInitCtx(name).
> Actually the issue is in the way of finding the corresponding class in
> getURLOrDefaultInitCtx() method. The method searches for several
> patterns of context factory class name. Something like:
>   com.oracle.*.javaURLContextFactory
>   ...
>   com.sun.*.javaURLContextFactory
> where "java" in "javaURLContextFactory" is so called schema.
> (Please refer javax.naming.InitialContext javadoc for detailed information)
> So roughly speaking we have the following schema:
>   1 create bean
>   2 get the URL schema
>   3 get the corresponging context factory (Class.forName() for several patterns)
>   4 get the context from the factory
>   5 set the context for the bean
> So we have the 3rd step every time even if we have already found the
> factory for this schema for previous bean for example.
> The attached patch reduces triple the startup time of OC4J. Please note
> that this is NOT a fix but kind of hackish solution - just to show
> what's going on. ...and to reduce the startup time for enabling.
> Probably hash map can be one of the appropriate solutions here.

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


Mime
View raw message