• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Performance issues with respect to type of Bean

 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Another issue with respect to performance and scalability!!If we prefer Session Beans over Entity Beans, would it improve application performance?
Although, these beans address different requirements, I am considering this with respect to distrubution prospective.Am I correct to assume that Session Beans require less distribution than Entity Beans, hence performance would be better in the former case?
Thanks in advance.
Regards,
Sandeep

  • Sun Certified Programmer for Java 2 Platform Scored 93 per cent
  • Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  • IBM Enterprise Connectivity with J2EE Scored 72 per cent
  • Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  • [This message has been edited by Desai Sandeep (edited May 09, 2001).]
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i do not think that entity beans and session beans are replacements to each other. If you have an entity bean, to imporve performance you cannot say that you will convert it to a session bean.
On the aspects of performance however stateless beans provide the highest scalability.
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mahindrakar,
Thanks for your response.
Can we say this - Session Beans can improve application performance, since it requires less distribution as compared to Entity Beans?
Regards,
Sandeep

  • Sun Certified Programmer for Java 2 Platform Scored 93 per cent
  • Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  • IBM Enterprise Connectivity with J2EE Scored 72 per cent
  • Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  • [This message has been edited by Desai Sandeep (edited May 09, 2001).]
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you please elaborate on


Am I correct to assume that Session Beans require less distribution than Entity Beans, hence performance would be better in the former case?


 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on this issue of distribution: I think both session and entity beans are distributed objects, they are the same in this aspect. Both types have a Home and Remote interface, and both beans, when you call methods on them from clients, require a remote call.

on this issue of comparing session with entity: This is a false comparison. You cannot replace one with the other. To use a VERY overused expression, you are comparing apples and oranges. You cannot replace an entity bean with a session bean - so even if session beans are more 'efficient', they still cannot be used in place of entity beans.

something that can be said: a stateless session bean is more efficient than a stateful session bean. This is because the former supports multiple clients. So within the session bean 'type', and if your design can handle it, chose stateless session beans.

on improving entity beans: Most tutorials I've seen offer numerous ways to improve performance of these beans. The most common is "just in time" resource management
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Probably, I was not very clear on the distribution prospective.I am assuming, that multiple machines are collaborating across the network to solve my business problem.The business problem/logic includes Session Bean and Entity Beans.
Session Bean is an extended client view in the Application Server.Entity Beans usually represent business data in the DB, as Business Objects in the middle-tier.
Considering, many Application Servers and many Databases, which takes care of my EJB Business application, probably the Session Bean would be involved in a lesser degree of distribution (and travel across the network!) as compared to Entity Beans.
In general, Session Beans would be responsible to synchronize the data with the Client, whereas the Entity Beans would need to synchronize the data, with the DB tier, using two-phase commits.
In that case, can we say --
Session Beans can improve application performance, since it requires less distribution as compared to Entity Beans?
Hope this does make some sense!!
Regards,
Sandeep

  • Sun Certified Programmer for Java 2 Platform Scored 93 per cent
  • Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  • IBM Enterprise Connectivity with J2EE Scored 72 per cent
  • Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  • [This message has been edited by Desai Sandeep (edited May 10, 2001).]
 
Rahul Mahindrakar
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i finally got what is meant by distribution. I do not agree to the point that


Session Beans can improve application performance since it requires less distribution as compared to Entity Beans


I believe the opposite.
Let me explain.
First of all Let me state one General thing
Session and Entity beans are both Coarse grained Objects. This is a very important point to remember. You can move around Value Objects if you require fine grained objects like Address.
An Entity bean represents a record in a database. Its basic functionality is to update its state in database. As such is not much concerned with the outside world. People invoke businees methods on the enterprise bean and change its state. Thus the major "distribution" in an Entity bean is between it and the database. As long as the network between the Application Server and Database server is a good connection this activity is very fast.
Now Session Beans are there to communicate with a lot of entity beans as well as undertake connection to the database. Then they have to undertake lookup's communicate with entity beans as well as communicate with the databases.
This shows that Session beans so create a lot of traffic within a network
Hence Prooved!!
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mahindrakar,
I am almost convinced by your reasoning.However, there are still couple of issues, that needs to be considered.

  1. In general, Session Beans may serve as a front-end to Entity Beans (Facade Pattern).Session Beans would generally have responsibility of delegating the calls to respective Entity Beans methods.Enity Beans would take in all the processing load.In that respect, Entity Beans appears to be more coarse-grained than Session Beans to me.Since lot of work takes place in the Entity Beans compared to Session Beans, most likely we would get a better performance with the latter!!
  2. As we agree on the fact that Entity Beans has to constantly interact with the DB to maintain its state.Assuming a good connection along the network, Entity Beans has to share the burden of managing its state, using two-phase commits, which is usually associated with the distribution.Although, the Container and the DB Transaction/Resource Managers would do it for the Entity Bean, the Bean's state is heavily dependent on this aspect.Since many resources are involved, this may cause a performance hit, in the case of the Entity Bean.
    On the other hand, Session Beans state is synchronized, using SessionSyncronization interface.The Bean Developer manages the state of the client using the methods provided by the interface.The client's state change may not be as complicated as that involved with the change in state/information of Entity Beans in the DB - Unlike Entity Beans, not many resources are involved!!
  3. As regards, Session Bean, doing a lookup on the Entity Bean, I believe, it maynot be a costly affair.I had posted a seperate thread on "Singleton Pattern and EJB", with the discussion on lookup of HomeObject.I am almost convinced, that HomeObject are developed on Singleton Pattern (Please let me know your views on this in that thread!!).And if that is the case, only the first lookup would be expensive.
    As far as communication with the Databases is concerned, it would best be left to the Entity Beans.

  4. -- Sandeep
 
reply
    Bookmark Topic Watch Topic
  • New Topic