First, the EJB version _will_ be slower because of additional overhead
in transaction management, security etc. (even if you don't use security
- the interceptor is still there by default). In the case of an
application client, you also have the RMI layer to go through, which
imposes somewhere around 2-10 ms delay per call to the bean!

The transaction overhead is nothing to be sneazed at either - it's about
half of the overhead in the JBoss stack right now (if my measurements
are remotely accurate)


Michael Nowotny wrote:
> 
> 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
> 


>       startTime = System.currentTimeMillis();
> 
>       while(i.hasNext()) {
>         Order order = (Order)i.next();
> 
>         order.getCompany();
>         order.getFactory();
>         order.getCustomerID();
>         order.getID();
>       }
> 
>       stopTime = System.currentTimeMillis();
The biggest thing you can do here is begin to use a 'value object' in
the form of a group accessor . This is for more than to reduce network
traffic: it is also to reduce transaction load. In the worst case
scenario, the code above will cause each row to be fetched ~five times!
You're also getting the overhead of a transaction begin and commit with
every call into the bean. In your jboss.xml/standardjboss.xml, what is
your <commit-option> set to? If this is A (the default), it'll perform
better than the worst case I mention, but JBoss will assume that it is
the only writer to that database, and won't pick up external
modifications to an entity until after that entity gets booted out of
the cache.

> 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.
I love it when the trade rags give a good idea a cosmic name to draw
scorn!
The value objects are used to do much more than reduce network traffic.
They also reduce transaction load.

> 
> Our current results suggest that the performance penalty we are observing is
> imposed by the way JBoss handles the data provided by JDBC.
Is this a CMP bean, or BMP? If CMP, there might be something there, but
I thing that between RMI and transaction overhead, 

> 
> 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.
Again, use a value object. Putting a session bean around it (so that you
call that and get back an array of OrderData objects) would also help a
bit. The key is that if you're going to go through the overhead of
calling an EJB from a client, do a lot while you're in there, otherwise
the overhead becomes the dominant issue in the runtime.

> 
> 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
Confidential e-mail for addressee only.  Access to this e-mail by anyone else is 
unauthorized.
If you have received this message in error, please notify the sender immediately by 
reply e-mail 
and destroy the original communication.


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

Reply via email to