RE: EJB Performance Question.
At 14:48 14.11.00 , you wrote: Thanks Robert. I think I'll try running some benchmarks this week and post the results. I wonder.. is there a way for and EJB-EJB to be _forced_ to go through RMI? i.e. can I turn this optimization off? I don't think there is a documented way to to this. robert -tim -Original Message- From: Robert Krueger [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 14, 2000 1:36 PM To: Orion-Interest Subject: RE: EJB Performance Question. At 12:06 14.11.00 , you wrote: At 10:03 14.11.00 , you wrote: 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 well, with orion this is intra-vm so its not that bad ... Is there proof that Orion does this? I'm not trying to be a jerk, but I'd like to see some numbers on how long a set/get takes for a client-to-ejb call and an ejb-to-ejb (same vm) call. do a getClass().getName() on your ejbobject. will be the same wrapper class that implements the ejbobject (if you look into the generate code that's temporarily there on deployment). anyway, I've never benchmarked but it is orders of magnitude faster than any rmi stack I've seen. I think there's even an old mail in the archive from karl that confirms this otiomization because it was one of the first things I asked (must at least be 10 months ago now). regards, robert Not even Weblogic optimizes to pass-by-value for intra-vm ejb calls. You have to use TopLink to get that optimization. Funny though, Weblogic provides a tag in their deployment description but it doesn't do anything. -tim (-) Robert Krüger (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt, (-) Tel: 06151 665401, Fax: 06151 665373 (-) [EMAIL PROTECTED], www.signal7.de (-) Robert Krüger (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt, (-) Tel: 06151 665401, Fax: 06151 665373 (-) [EMAIL PROTECTED], www.signal7.de
RE: EJB Performance Question.
The idea behind a bulk accessor is to return a single object that holds all the data of your EJB. (Forgive me for any syntax mistakes. I'm doing this from heart and I've done so much EJB2.0 stuff that my 1.1 is a little rusty.) If you have an EJB like this: public class FooEJB implements EntityBean { public String data1; public String data2; public int data3; ... // this is a bulk accessor public FooView getFoo() { return new FooView(data1, data2, data3); } } You would create a "view" object that can hold all the EJB data. A view is a very thin "bean-like" object: public class FooView { String data1; String data2; int data3; public String getData1() { return data1; } public String getData2() { return data2; } public int getData3() { return data3; } public FooView(String data1, String data2, int data3) { this.data1 = data1; this.data2 = data2; this.data3 = data3; } } Now you client only need to call: FooView fv = fooejb.getFooView(); to get all the data within the Foo EJB. This reduces the RMI marshalling to a single call. Then, you use the FooView accessors to get to the data; since FooView is a local object, this will be fast. NOTE: if you followed this thread, you heard from others that Orion optimizes intra-VM EJB calls to "call-by-value" which doesn't use RMI. This is great for Orion, but is not specified in the spec, so if you were to port your application to another container, you aren't guaranteed this optimization. The above bulk accessor/View pattern will always work. -tim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 14, 2000 7:04 PM To: Orion-Interest Subject: Re: EJB Performance Question. Thank You for your kind reply. Can I get some pseudo-code an example? Thank you. - Original Message - From: Tim Drury To: Orion-Interest Sent: Wednesday, November 15, 2000 12:03 AM Subject: RE: EJB Performance Question. 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
RE: EJB Performance Question.
At 10:11 AM 11/15/2000 +0100, you wrote: At 14:48 14.11.00 , you wrote: Thanks Robert. I think I'll try running some benchmarks this week and post the results. I wonder.. is there a way for and EJB-EJB to be _forced_ to go through RMI? i.e. can I turn this optimization off? I don't think there is a documented way to to this. Not to be a jerk but to provide some constructive criticism to Orion ... I don't think there is a documented way to do many, many things. Considering that it is a closed-source product, I think documentation should be one of the most important things to accompany the actual binaries.
RE: EJB Performance Question.
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, createa 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 AMTo: Orion-InterestSubject: 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 EJBCollection 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
Re: EJB Performance Question.
Hi ±èöȸ, public Vector EJBToRow(Dir dir) throws Exception { [...] 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())); [...] What's the key problem? thats not a problem, thats a feature! (each remote call runs within an transaction...) study all the EJB-docs you can get and redesign your app. bye klaus -- Klaus Thiele - Personal Informatik AG mailto:[EMAIL PROTECTED] "There's got to be more to life than compile-and-go."
RE: EJB Performance Question.
At 10:03 14.11.00 , you wrote: 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 well, with orion this is intra-vm so its not that bad ... bulk accessor pattern. For example, create a new class called .. although a bulk accessor is generally a good thing to use in such situations. have you tried wrapping one usertransaction around your update operation or maybe even around the entire loop, depending on what you want to see as a transaction. this will improve performance significantly because you don't have all the tx overhead. if you don't know what a usertransaction is, read up on JTA. HTH robert 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 : mailto:[EMAIL PROTECTED][EMAIL PROTECTED] : www.javanuri.com ÀüÈ mobile : 02-6257-3002 : 019-255-2855 -- (-) Robert Krüger (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt, (-) Tel: 06151 665401, Fax: 06151 665373 (-) [EMAIL PROTECTED], www.signal7.de
RE: EJB Performance Question.
At 10:03 14.11.00 , you wrote: 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 well, with orion this is intra-vm so its not that bad ... Is there proof that Orion does this? I'm not trying to be a jerk, but I'd like to see some numbers on how long a set/get takes for a client-to-ejb call and an ejb-to-ejb (same vm) call. Not even Weblogic optimizes to pass-by-value for intra-vm ejb calls. You have to use TopLink to get that optimization. Funny though, Weblogic provides a tag in their deployment description but it doesn't do anything. -tim
RE: EJB Performance Question.
At 12:06 14.11.00 , you wrote: At 10:03 14.11.00 , you wrote: 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 well, with orion this is intra-vm so its not that bad ... Is there proof that Orion does this? I'm not trying to be a jerk, but I'd like to see some numbers on how long a set/get takes for a client-to-ejb call and an ejb-to-ejb (same vm) call. do a getClass().getName() on your ejbobject. will be the same wrapper class that implements the ejbobject (if you look into the generate code that's temporarily there on deployment). anyway, I've never benchmarked but it is orders of magnitude faster than any rmi stack I've seen. I think there's even an old mail in the archive from karl that confirms this otiomization because it was one of the first things I asked (must at least be 10 months ago now). regards, robert Not even Weblogic optimizes to pass-by-value for intra-vm ejb calls. You have to use TopLink to get that optimization. Funny though, Weblogic provides a tag in their deployment description but it doesn't do anything. -tim (-) Robert Krüger (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt, (-) Tel: 06151 665401, Fax: 06151 665373 (-) [EMAIL PROTECTED], www.signal7.de
RE: EJB Performance Question.
If you're referring to the enable-call-by-reference tag, then indeed it does do something (at lease in version 5.1). Setting this tag to true will effectively pass EJB method arguments and returned objects by reference when called within the same JVM, rather than by value in accordance with the EJB 1.1 specification. This obviously increases performance by eliminating the marshalling overhead, at the cost of being non-spec compliant. At any rate, for better or worse, in WebLogic call by reference is enabled by default. In other words, calls between servlets and EJBs in the same JVM are optimized. That said, don't let these optimizations pollute your EJB design. Having a well-defined and minimal remote contract is much more portable, and generally easier to maintain and manage. Moreover, you may at some point in the future decide to separate the web server and EJB container into separate JVMs. In general, EJB interface contracts are specifically important to design correctly, as the invocation of remote methods may in turn provoke life cycle methods, transactions, etc. Mike --- Tim Drury [EMAIL PROTECTED] wrote: At 10:03 14.11.00 , you wrote: 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 well, with orion this is intra-vm so its not that bad ... Is there proof that Orion does this? I'm not trying to be a jerk, but I'd like to see some numbers on how long a set/get takes for a client-to-ejb call and an ejb-to-ejb (same vm) call. Not even Weblogic optimizes to pass-by-value for intra-vm ejb calls. You have to use TopLink to get that optimization. Funny though, Weblogic provides a tag in their deployment description but it doesn't do anything. -tim __ Do You Yahoo!? Yahoo! Calendar - Get organized for the holidays! http://calendar.yahoo.com/
RE: EJB Performance Question.
Thanks Robert. I think I'll try running some benchmarks this week and post the results. I wonder.. is there a way for and EJB-EJB to be _forced_ to go through RMI? i.e. can I turn this optimization off? -tim -Original Message- From: Robert Krueger [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 14, 2000 1:36 PM To: Orion-Interest Subject: RE: EJB Performance Question. At 12:06 14.11.00 , you wrote: At 10:03 14.11.00 , you wrote: 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 well, with orion this is intra-vm so its not that bad ... Is there proof that Orion does this? I'm not trying to be a jerk, but I'd like to see some numbers on how long a set/get takes for a client-to-ejb call and an ejb-to-ejb (same vm) call. do a getClass().getName() on your ejbobject. will be the same wrapper class that implements the ejbobject (if you look into the generate code that's temporarily there on deployment). anyway, I've never benchmarked but it is orders of magnitude faster than any rmi stack I've seen. I think there's even an old mail in the archive from karl that confirms this otiomization because it was one of the first things I asked (must at least be 10 months ago now). regards, robert Not even Weblogic optimizes to pass-by-value for intra-vm ejb calls. You have to use TopLink to get that optimization. Funny though, Weblogic provides a tag in their deployment description but it doesn't do anything. -tim (-) Robert Krüger (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt, (-) Tel: 06151 665401, Fax: 06151 665373 (-) [EMAIL PROTECTED], www.signal7.de
Re: EJB Performance Question.
Thank You for your kind reply. Can I get some pseudo-code an example? Thank you. - Original Message - From: Tim Drury To: Orion-Interest Sent: Wednesday, November 15, 2000 12:03 AM Subject: RE: EJB Performance Question. 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, createa 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 AMTo: Orion-InterestSubject: 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 EJBCollection 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