Monday Aug 30, 2010

PRLB feature in GlassFish 2.1.1

Currently SGESv2.x supports RMI-IIOP loadbalancing. But this loadbalancing is based on the InitialContext:when a new InitialContext() is created, a load balancing decision is made, binding that InitialContext to a replica, until the replica fails, at which point all requests using that InitialContext fail over to a new replica.
Refer : http://docs.sun.com/app/docs/doc/820-4341/fxxqs?a=view

The PRLB feature aims at addressing the requirement, where for the same EJB object of a stateless session bean, the method calls to the bean needs to be loadbalanced. An EJB instance is represented (in GlassFish) by a dynamic stub, which contains a reference to the endpoints. The loadbalancing of the calls happens in a round robin fashion. The list has the lifetime of the stub and anything
that clears or resets the list starts the PRLB process all over again. Hence, ideally an ejb lookup() would reset the list and restarts the
PRLB process.

Configuration:
In sun-ejb-jar.xml, a new optional boolean child element for the ejb element "per-request-load-balancing" is introduced.If per-request-load-balancing is set to true for a stateless session bean, per request load balancing will be enabled for invocations made through Remote EJB 2.x and 3.x client invocations on that bean. If set to false or not set, per request load balancing will not be enabled for the bean. The per-request-load-balancing element only applies to stateless session beans. Use of the element on other bean types will result in
a deployment error.

For example :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.1.1 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-1.dtd">
<sun-ejb-jar>
<enterprise-beans>
<unique-id>1</unique-id>
<ejb>
.
.
<per-request-load-balancing>true</per-request-load-balancing>
.
.
</ejb>

The sun-ejb-jar.xml needs to be updated as above and EJB jar needs to be redeployed.

As a verification check, you can verify that this is configured properly by looking for the following (FINE, in the CORBA logger) log message when the EJB is loaded:

"Setting per-request-load-balancing policyfor EJB <EJBNAME>"

Important requisites for PRLB feature to work :

  •  The "per-request-load-balancing" property needs to be enabled in sun-ejb-jar.xml


Client Example:

public class EJBClient {
    public static void main(String args[]) {
    :
    :
    :
    try {
    // only one lookup

    Object objref = initContext.lookup("test.cluster.loadbalancing.ejb.TestSessionBeanRemote");
        myGreeterRemote = (TestSessionBeanRemote)PortableRemoteObject.narrow(objref,
                                            TestSessionBeanRemote.class);

    } catch (Exception e) {
    :
    }

    for (int i=0; i < 10; i++ ) {
    // method calls in a loop.
        String theMessage = myGreeterRemote.sayHello(Integer.toString(i));
        System.out.println("got"+": " + theMessage);
        }
    }
}

Sunday Aug 29, 2010

Admin Console very slow in OGS 3.0.1

I installed OGS 3.0.1 for a customer escalation. I accessed the admin console and found that its was terribly slow.

Goggled on the net and landed up with suggestions to reduce this slowness.. If you are experiencing slowness and seeing the following message in your server.log

"Cannot refresh Catalog : Connection timed out"

Here are the tips to help you :

 1. Add the following option in your domain.xml

<jvm-options>-Dcom.sun.enterprise.tools.admingui.NO_NETWORK=true</jvm-options>

2. UpdateTool functionality 

 As Admin Console moved to make use of the OSGi architecture, updatetool functionality is implemented as a plugin module. The application (console) itself shouldn't know what needs to be done in any plugin. So, all you need to do is remove the updatetool plugin module if you don't want any updatetool feature in the console. However, this plugin module is part of the "glassfish-gui" IPS package, and one cannot just remove this particular module. As a workaround for now, just remove console-updatecenter-plugin.jar. You can do this:

\* cd glassfishv3/glassfish

\* mv modules/console-updatecenter-plugin.jar modules/console-updatecenter-plugin.jar.ORIG

\* rm -r domains/domain1/osgi-cache

\* rm -r domains/domain1/generated

Restart the server.

Here you go ... the admin console is all old self :) ..


About

Kalpana Karunamurthi

Search

Categories
Archives
« August 2010
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
31
    
       
Today