Slow Search Time for Glassfish

I created an EJB3 test application running on the GlassFish Opensource Edition.

I connect to GlassFish from the same host (both the client and the application server are running on "localhost").

I retrieve the remote (stateful) object using InitialContext.lookup (), and then I interact with it like a regular Java object.

The only problem is that this single call takes 15 seconds :

FooRemoteService foors = (FooRemoteService) 
    context.lookup("java:global/FooApp/FooService!test.FooRemoteService");

I understand that there must be some kind of “handshake” and “initialization”, but this is so darn slower.

The rest of the interaction (several remote calls with many exchanged serial objects) takes only about 0.1 seconds!

How can I find out the reason why it took so long?

+3
source share
1 answer

I suggest that you configure your initial context by specifying your host IP address, because it is possible that you have the same application deployed on a different host and search it on the EJB for it over the network

Properties props = new Properties();
props.put(Context.PROVIDER_URL, "jnp://ip:1099");
InitialContext ctx = new InitialContext(props);

Sincerely.

0
source

All Articles