I fixed this one.

In the startup code I generate one bean the old way
(Proxy.newProxyInstance), and then I steal the constructor from the
generated object.  Then when a new bean instance is requested, I just use
the constructor.

I ran two sets of test cases and here is what I got: 

Relation test [4 runs in sec]
old: 28 21 20 20 21
new: 22 14 12 11 11

Commerce test [4 runs in sec]
old: 22 12 10 10  9
new: 15  9  7  7  6

Tell me what you see.  Run the profiler again.

Warning: I have made a lot of changes, so I may have broken something else. 

If none of this makes sense, I apologize.  I need to sleep now.

-dain

> -----Original Message-----
> From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 28, 2001 3:46 AM
> To: 'Peter Levart'; Dain Sundstrom; 
> [EMAIL PROTECTED]
> Subject: RE: [JBoss-dev] loading 10 EBs takes 5s 1st time called
> 
> 
> > 
> > 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?
> 
> You would think so.  
> 
> My use of the proxy generator is obviously broken.  I'll look 
> at it after
> some sleep.
> 
> -dain
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 

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

Reply via email to