一般来说
使用JSP-SessionBean-CMP模式时
CMP一定是LocalEntityBean
这样可以提高一定的性能,因为性能的瓶颈在于数据库的存取,如果使用RemoteEntityBean的话,其中还会有一个根程序与骨架程序之间网络传输问题
而且这种模式中,一般还要使用值对象的设计模式
光是值对象,已经能提高不少性能了
这两个加起来应该会提高不少效率呢给你一个例子,使我的一个朋友做的实验:
------------------------------------------------------------
页面共需要读入16个值(两次循环,每次8个)。方案1:JSP直接调用EntityBean的remote的getXXX方法16次。
结果:顺序访问页面2000次,用时124秒。方案2:JSP调用EntityBean内自定义的remote方法:getValueObject
并用ValueObject返回包含的信息。其它均与方案1相同。
结果:顺序访问页面2000次,用时47秒。速度提高了将近3倍,确实可观!
------------------------------------------------------------
使用JSP-SessionBean-CMP模式时
CMP一定是LocalEntityBean
这样可以提高一定的性能,因为性能的瓶颈在于数据库的存取,如果使用RemoteEntityBean的话,其中还会有一个根程序与骨架程序之间网络传输问题
而且这种模式中,一般还要使用值对象的设计模式
光是值对象,已经能提高不少性能了
这两个加起来应该会提高不少效率呢给你一个例子,使我的一个朋友做的实验:
------------------------------------------------------------
页面共需要读入16个值(两次循环,每次8个)。方案1:JSP直接调用EntityBean的remote的getXXX方法16次。
结果:顺序访问页面2000次,用时124秒。方案2:JSP调用EntityBean内自定义的remote方法:getValueObject
并用ValueObject返回包含的信息。其它均与方案1相同。
结果:顺序访问页面2000次,用时47秒。速度提高了将近3倍,确实可观!
------------------------------------------------------------
One common design pattern is to route all entity bean access through session beans. EJB clients call methods on the session bean, which forwards the methods to one or more entity bean methods, as appropriate. This is called a session-entity facade.
The session-entity facade design pattern has many advantages, including the ability to streamline performance by using local access for session-entity bean communication