In both cases the client and server are in the same JVM.  In case 1, the
server is an EJB.  In case 2, the server is a normal Java class.  Case 1 is
10000 times slower than case 2.

My code looks something like this:

public class PerformanceTestBean implements javax.ejb.SessionBean {
    public void empty() {
        return;
    }

    public void ejbCreate() { }
    public void ejbRemove() { }
    public void ejbActivate() { }
    public void ejbPassivate() { }
    public void setSessionContext( javax.ejb.SessionContext context) { }
}

public interface PerformanceTest extends javax.ejb.EJBObject {
    public void empty() throws java.rmi.RemoteException;
    public java.util.Map map( java.util.Map map) throws
java.rmi.RemoteException;
    public String xml( String xml) throws java.rmi.RemoteException;
}

public interface PerformanceTestHome extends javax.ejb.EJBHome {
    public PerformanceTest create() throws java.rmi.RemoteException,
javax.ejb.CreateException;
}

public class PerformanceTestLocal {
    static PerformanceTestLocal instance = new PerformanceTestLocal();

    static PerformanceTestLocal getInstance() {
        return instance;
    }

    public void empty() {
        return;
    }
}

public class Doit extends javax.servlet.http.HttpServlet {
    private static final int COUNT = 1;

    protected void service( javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) throws
javax.servlet.ServletException, java.io.IOException {
        java.io.PrintWriter out = response.getWriter();
        try {
            javax.naming.InitialContext initialContext = new
javax.naming.InitialContext();
            javax.naming.Context context =
(javax.naming.Context)initialContext.lookup("java:comp/env");
            PerformanceTestHome performanceTestHome =
(PerformanceTestHome)javax.rmi.PortableRemoteObject.narrow(
context.lookup("PerformanceTest"), PerformanceTestHome.class);
            PerformanceTest performanceTest = performanceTestHome.create();
            performanceTest.empty(); // TIME THIS
      }
        catch( Throwable exception) {
            exception.printStackTrace();
            out.println("Failure!");
        }
        try {
            PerformanceTestLocal performanceTest =
PerformanceTestLocal.getInstance();
          performanceTest.empty(); // TIME THIS
      }
        catch( Throwable exception) {
            exception.printStackTrace();
            out.println("Failure!");
        }
}

Mike

> -----Original Message-----
> From: Jason Westra [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 17, 2002 10:47 AM
> To: [EMAIL PROTECTED]
> Subject: Fwd: Re: Remote Interfaces Vs Local Interfaces
>
>
> Mike,
>
> Sorry for my confusion, but do you mean to say, the RMI call was
> 10000 times slower or faster than the local in-jvm calls in WAS 4?
>
> thanks!
> Jason

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to