Go read those articles again.  As Santayana said, "Those who fail to learn
from history, are condemned to repeat it".

Invoking entity beans from a client in a different Java Virtual Machine,
especially ones that return a set of results will result in poor
performance.  Yes, EJB gives you transparent distributed components.  But,
when that client reference that set of entity beans it is going through a
whole remote invocation loop over and over.  It's convential wisdom in EJB
design to wrap entity beans in statelss session bean helpers that return a
collection of data rather than remote operations.  One thing that would give
you an immediate performance boost is to implement an aggregate method in
the entity bean that returns all of the data that you need in one
invocation. If you want acceptable performance, do not use individual
get/set operations of an entity bean in a remote client. The performance
you're seeing is not a JBoss characteristic, it is an EJB characteristic -
it is the result of a naive application design. 


-----Original Message-----
From: Michael Nowotny [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 12:25 PM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] performance question for production use


Hi JBoss users!

We have developed a web based order tracking system to be deployed in an IBM
AS/400 production environment.

Moving from the testing environment onto the production machine we
experienced a harsh performance reduction which renders our application
virtually
unusable.

During the investigation process we have written two small client programs
which are used for performance measurement.

The first application uses direct JDBC Database access while the second one
relies on EJB and JBoss, wherever both clients use the same database along
with the same data. By means of db tracing it has furthermore been shown
that
jboss executes exactly the same SQL statements as our client application it
"competes" against.

Please note that our JDBC example uses individual selects for each row in
order to emulate the behaviour exposed by EJB (where data is only read when
it
is needed) instead of reading a contigous result set.

The results are as follows (time measured in msecs):

                               | JDBC  | EJB
--------------------------------------------
complete time           | 1222  | 6229
time per bean / row   |      5  |    28

Here is the important part from the JDBC example:

      Vector v = new Vector();
      Statement stmt = con.createStatement();
      PreparedStatement pstmt = con.prepareStatement("SELECT
k1firm,k1wknr,k1afda,k1akdn,k1sach,k1aref,k1rfda,k1afnr FROM
rhdbd_162.afk101 WHERE
k1firm='1' AND k1wknr='000' AND k1afnr=?");

      ResultSet rs = stmt.executeQuery("select k1afnr from rhdbd_162.afk1
where k1akdn=271269");

      while(rs.next()) {
        v.addElement(new Integer(rs.getInt(1)));
      }
      rs.close();

      Iterator i = v.iterator();

      long startTime, stopTime;

      startTime = System.currentTimeMillis();
      while(i.hasNext()) {
        Integer afnr = (Integer)i.next();
        pstmt.setInt(1, afnr.intValue());
        rs = pstmt.executeQuery();

        while(rs.next()) {
          String firm = rs.getString("K1FIRM");
          String wknr = rs.getString("K1WKNR");
          String akdn = rs.getString("K1AKDN");
          String afnr2 = rs.getString("K1AFNR");
        }
        rs.close();
      }
      stopTime = System.currentTimeMillis();

      pstmt.close();
      stmt.close();
      con.close();

      System.out.println("Time required: " + (stopTime - startTime) + "
msecs. Average time per row: " + ((stopTime - startTime) / v.size()) + "
msecs");

And here is the important part from the EJB example:

      Collection c =
HomeManager.getInstance().getOrderHome().findByCustomerID(new
Integer(271269));
      Iterator i = c.iterator();

      startTime = System.currentTimeMillis();

      while(i.hasNext()) {
        Order order = (Order)i.next();

        order.getCompany();
        order.getFactory();
        order.getCustomerID();
        order.getID();
      }

      stopTime = System.currentTimeMillis();
      System.out.println("Time required: " + (stopTime - startTime) + "
msecs. Average time per row: " + ((stopTime - startTime) / c.size()) + "
msecs");

In closing I would like to emphasize that we don't use value objects or
"astral clones" (Java World) in order to reduce network traffic.

Our current results suggest that the performance penalty we are observing is
imposed by the way JBoss handles the data provided by JDBC.

As we do not have much experience concerning EJB development left alone know
internal JBoss mechanics we would be grateful if anyone could provide us
with a starting point for further optimization. 

Thanks for your help!

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to