Remote EJB is 3x slower than WebService in 7.1 latest from git
willreichert Apr 7, 2012 1:14 AMWe are testing with the Specj application where the same bean is exposed as both an EJB and a Web Service. The benchmark results were showing the remote EJB calls took 3x longer than calls to the same bean via the web service. I created a sample application that returns the same object (to minimize gc overhead) and exposed it as both a Web Service and Remote EJB. The sample also demonstrates a 3x increase in response time when using the EJB interface. I am running on the latest build from git master and use a single threaded app to drive load so I doubt concurrency is part of the problem. I ran the test with OProfile and the highest sampled Java method was Ljava/io/DataOutputStream.write(). I unfortunately cannot get the full callstack because attaching byteman to that method results in an infinite loop (unless someone has a more sophisticated way to attach without capturing the logging for log files).
Sample Applicaiton
The payload for the test
public class CalendarPayload implements Serializable{
          private static final long serialVersionUID = 696756365558432253L;
          private int int1;
          private int int2;
          private Calendar calendar;
          public CalendarPayload(){
                    int1 = 1; int2 = 2; calendar = new GregorianCalendar());
          }
        public int getFirst(){return int1;}
        public int getSecond(){return int2;}
        public Calendar getCalendar(){return calendar;}
}
The service
@Stateless
@WebService
public class SimpleBean implements Simple {
          private CalendarPayload payload = new CalendarPayload();
          @Override @WebMethod
          public int getInt() {return 0;}
          @Override @WebMethod
          public Integer getInteger() {return new Integer(1);}
          @Override @WebMethod
          public Calendar getCalendar() {return new GregorianCalendar();}
          @Override @WebMethod
          public CalendarPayload getPayload() {return new CalendarPayload();}
          @Override
          public CalendarPayload getStaticPayload() {return payload;}
}
- 
            
                            
            StatelessCalendarEAR.ear 2.9 KB
 
     
    