Apples and Oranges.

I am assuming that your test applications are executing in a separate VM (and
possibly machine).

In the JDBC example, your loop:
    String firm = rs.getString("K1FIRM");
    String wknr = rs.getString("K1WKNR");
is a local call, retrieving data from a local object. Very fast.

In your EJB example:
    order.getCompany();
    order.getFactory();
are each a remote network call. Very slow (relatively speaking).

Hence the reason for ValueObjects and SessionBean facades. Try this...move your
client EJB code into a stateless session bean deployed in the same jar file as
the entity bean. Use the <ejb-ref> tag. You will notice a tremendous
improvement.

EJB was not designed/intended to be used the way that you are.

jim


----- Original Message -----
From: "Michael Nowotny" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2001 12:25 PM
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