简体   繁体   English

拆分Bean还是只在一个项目中制作所有Bean?

[英]Split Beans or Make all beans in just one project?

I have a software-web-project that use a lot of beans for differents things. 我有一个软件网络项目,该项目使用很多bean来处理不同的事情。 Example Project 1 use Beans 1 and Project 2 use Beans 2 and Project 3 use beans 3, beans 2 and beans 1. So the old teammate use all the beans in just one project(Netbeans Beans for entities and sessions) 示例项目1使用Bean 1,项目2使用Bean 2,项目3使用Bean 3,Bean 2和Bean1。因此,旧队友仅在一个项目中使用所有Bean(用于实体和会话的Netbeans Beans)

Just Like this 像这样

  • All-EJB 全EJB

    +---- EJB for project 1 + ----项目1的EJB

    +---- EJB for project 2 + ----项目2的EJB

    +---- EJB for project 3 + ----项目3的EJB

    +---- EJB for project 4 + ----项目4的EJB

    +---- EJB for project 5 + ----项目5的EJB

And they add to the web-Projects this big project of EJB. 他们将这个大型EJB项目添加到Web项目中。 All projects use the All-EJB, so I think the perfomance will just go really bad. 所有项目都使用All-EJB,因此我认为性能将非常糟糕。 I'm using glassfish server 3.1.2 and Java EE 6 with JSF and primefaces, I think splitting the EJB for each project will improve the perfomance, and use only the specific EJB for each project needed. 我正在使用带有JSF和primefaces的glassfish服务器3.1.2和Java EE 6,我认为为每个项目拆分EJB将提高性能,并且仅对每个所需项目使用特定的EJB。 Or am I wrong? 还是我错了?

Are projects 1-5 always running? 项目1-5是否一直在运行?

If yes, then you are unlikely to see better performance by splitting the EJB module into many, and you might actually get slightly worse startup performance since there is necessarily some (possibly negligible) per-module overhead in an EJB container. 如果是,那么通过将EJB模块拆分为多个模块,您不太可能看到更好的性能,并且由于EJB容器中每个模块的开销一定(可能可以忽略),因此启动性能实际上可能会稍差。

If no (and some subset of projects 1-5 might be running), then you might see a (possibly negligible) startup performance improvement by splitting the EJB module into many if you can avoid loading the unneeded EJB modules since the EJB container will have less metadata that it needs to process. 如果没有(并且可能正在运行项目1-5的某些子集),那么如果可以避免加载不需要的EJB模块,因为EJB容器具有需要处理的元数据更少。

I cannot think of a reason why there would be a performance difference at runtime (after the EJB modules have ben started), but as with all performance considerations, the only way to be sure is to measure. 我想不出运行时(在启动EJB模块之后)性能会有所不同的原因,但是考虑到所有性能考量,确保的唯一方法就是进行测量。

Of course, there might be other maintainability benefits to splitting the EJB module. 当然,拆分EJB模块可能还有其他可维护性好处。 I think these are much better reasons than performance to split the EJB module. 我认为这些是比拆分EJB模块的性能更好的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM