On Tuesday 13 November 2001 16:49, Dain Sundstrom wrote:
> >
> > The first time I reference let's say 10 Entity Beans after a
> > JBoss restart it
> > takes approx. 5 seconds to retrieve data from them. The
> > second and subsequent
> > requests to return data from the same 10 EBs take ~20ms. 
>
> I was curious also, so I re-ran my test.  The second run always takes
> slightly less time ~1-2 sec.  The only thing I can think of that is
> different in the first execution is the bytecode generator.  On my machine,
> a 1.4 athalon, it doesn't take anywhere 1/2 second per bean.  I really
> haven't been focusing on this type of optimization, but I can easily add a
> line to the init or start method that creates an instance of the bean. 
> Then it will only happen during setup.  I look at it after the example code
> done (later today).
>

JProbe is really a nice tool. 

It appears that most of the time is spent by my bean calling 
Introspector.getBeanInfo(getClass()). I'm using introspection to collect the 
data from the EB. A single call to getBeanInfo() produces around 500 calls 
for ClassLoader.findClass() that in turn scan the filesystem for class files. 
Why is that so I don't know. Introspection is known to be slow but I didn't 
know that it can be of such a varying speed. getBeanInfo() on a simple Object 
subclass is quite fast. Not so on a JBoss generated subclass (proxy) of an EB 
class.

The other thing that was shown is that getBeanInfo() is fast the second time 
called on a particular Class, so this overhead should only be visible the 
first time called for a particular Entity type, but it is visible the first 
time called for a particular Bean instance regardless of Entity type. The 
only conclusion is therefore that each Bean instance (even though of the same 
type) is of different Class despite your claims that it is not.

The proof: This happens when accessing 3 instances of the same type using 
Introspector.getBeanInfo(getClass()) in the Bean's method:

Obtaining BeanInfo for class: class 
com.select.zaznamki.ejb.CustomerBean$Proxy, class.hashCode: 7674526, 
classLoader: org.jboss.proxy.ProxyCompiler$Runtime@651e95, 
classLoader.hashCode: 6626965
Obtaining BeanInfo took 985 milliseconds.

Obtaining BeanInfo for class: class 
com.select.zaznamki.ejb.CustomerBean$Proxy, class.hashCode: 3724384, 
classLoader: org.jboss.proxy.ProxyCompiler$Runtime@42fcc, 
classLoader.hashCode: 274380
Obtaining BeanInfo took 311 milliseconds.

Obtaining BeanInfo for class: class 
com.select.zaznamki.ejb.CustomerBean$Proxy, class.hashCode: 6004549, 
classLoader: org.jboss.proxy.ProxyCompiler$Runtime@6c5356, 
classLoader.hashCode: 7099222
Obtaining BeanInfo took 305 milliseconds.


It appears that each instance of the Bean is created with a different Class 
instance using different instance of the ClassLoader. Is this on purpose? 
Wouldn't it be better to use the same Class?


Peter

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to