A thread in the Remoting user forum ("JBREM-877: New Socket Connection is being
Created for Every" -
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126382) has brought up an
interesting issue concerning the use of Remoting in EJB3.
In AS 4.0.4/4.0.5, when EJB3 was using Remoting 1.4.x, each call to
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke() created a new
org.jboss.remoting.Client, and when it returned, it left the underlying client invoker
intact in the org.jboss.remoting.InvokerRegistry. The next call found the existing client
invoker and reused its socket pool. (Simplifying somewhat, but basically true.)
Now, in AS 4.2.x/5.0.0, each call to InvokeRemoteInterceptor.invoke() calls
Client.disconnect() before returning, which, if the reference count of the underlying
client invoker goes to zero, leads to the destruction of the client invoker, along with
its socket pool. So, unless there are multiple proxies in the same JVM running
simultaneously and keeping the client invoker's reference count above zero, each
invocation will lead to the creation of a new socket. The guy that posted JBREM-877 says
that performance is 25% of what it was in AS 4.0.4.
One solution would be to add a feature which allows a delay in the destruction of the
client invoker. E.g., the invoker locator
| socket://${jboss.bind.address}:3873/?invokerdestructiondelay=5000
|
would introduce a 5 second delay before the client invoker gets destroyed, increasing the
probability that it would be reused. The default behavior would be to destroy the client
invoker immediately.
Any thoughts from the EJB3 team?
-Ron
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130313#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...