Every single one of those calls to dir.getXXX() has to go across
the network via RMI.  This is slow.  You are better off using a
bulk accessor pattern.  For example, create a new class called
DirView which contains all the attributes of your Dir EJB.  Then
make a single call to the Dir EJB to get a DirView.  This will cause
only 1 RMI call and save you a huge amount of time.
 
Do you understand?  I can probably pseudo-code an example
if necessary.
 
-tim
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 14, 2000 3:56 AM
To: Orion-Interest
Subject: EJB Performance Question.

Hi, every one. First i'm sorry for my english.
 
We use servlet that call EJB. Next is code fraction.
 
//---------------------------------------------------
public Vector findByFirstPage(DirHome home, Integer rowCount) throws Exception{
 
  Vector rows  = new Vector();
  Dir dir = null;
 
  System.out.println("step 11 time : " + (new java.util.Date()));       
  
  // call EJB
  Collection col = home.findByFirstPage(rowCount.intValue());
  Iterator iter = col.iterator();
 
  System.out.println("step 12 time : " + (new java.util.Date()));     
  
  while(iter.hasNext()) {
    dir = (Dir)iter.next();
    rows.add(EJBToRow(dir)); //<------- #### bottle neck #####
  }
  
  System.out.println("step 13 time : " + (new java.util.Date()));       
  
  return rows;
  
 } 
 //---------------------------------------------------
 
 
Simple code. In while loop, EJBToRow() method take 3 second each call.
 
Next code is EJBToRow(). Very Simple. Only call EJB Meber methods.
 
 //---------------------------------------------------
 public Vector EJBToRow(Dir dir) throws Exception {
 
  Vector row = new Vector();
 
System.out.println("step 21 time : " + (new java.util.Date()));     
  
  row.add(dir.getId());
  row.add(new Long(dir.getPId()));
  row.add(dir.getName());
  row.add(new Long(dir.getSerial()));
  row.add(new Long(dir.getChildCount()));
  row.add(new Long(dir.getDepth()));
  row.add(dir.getPMap());
  row.add(dir.getType());
  row.add(dir.getUserId());
  row.add(dir.getGroupId());
  row.add(dir.getOwnerPermR());
  row.add(dir.getOwnerPermW());
  row.add(dir.getOwnerPermX());
  row.add(dir.getGroupPermR());
  row.add(dir.getGroupPermW());
  row.add(dir.getGroupPermX());
  row.add(dir.getOtherPermR());
  row.add(dir.getOtherPermW());
  row.add(dir.getOtherPermX());
  row.add(dir.getCreateDate());
  row.add(dir.getUpdateDate());
  row.add(dir.getExpireDate());
  row.add(dir.getRemark());
 
System.out.println("step 22 time : " + (new java.util.Date()));       
  
  return row;
  
 }
 //---------------------------------------------------
 
What's the key problem?
 
 
 
 
 
 
 
 
 


e-mail

site

: [EMAIL PROTECTED]

: www.javanuri.com

ÀüÈ­

mobile

: 02-6257-3002

: 019-255-2855

       


 

Reply via email to