【问题标题】:ejb bean instance pool jboss EAP 6.1ejb bean 实例池 jboss EAP 6.1
【发布时间】:2014-02-14 10:49:58
【问题描述】:

在我们的项目中,我们正在从 JBoss5 迁移到 Jboss EAP 6.1。 当我在 Jboss EAP 6.1 中进行配置时,我偶然发现了以下内容:

<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="1" instance-acquisitiontimeout-unit="MILLISECONDS"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="1" instance-acquisitiontimeout-unit="MILLISECONDS"/>
</bean-instance-pools>
</pools>

我不清楚 max-pool-size 参数。这个限制是每个部署在 JBoss 上的无状态 EJB bean 20 个实例吗?无论无状态 EJB bean 的数量如何,池最多只能有 20 个实例。

【问题讨论】:

  • 从历史上看,我认为每个 bean 有 20 个池化实例。我同意它非常模糊,命名表明总共最多有 20 个池 bean,但这不可能是正确的,因为一旦你有超过 20 个 EJB,就会导致问题。这部分没有记录也非常有帮助:/

标签: java performance jakarta-ee jboss7.x


【解决方案1】:

我不同意 eis。 这是 Wildfly 8.2.1 的代码 StatelessSessionComponent.java

public StatelessSessionComponent(final StatelessSessionComponentCreateService slsbComponentCreateService) {
    super(slsbComponentCreateService);

    StatelessObjectFactory<StatelessSessionComponentInstance> factory = new StatelessObjectFactory<StatelessSessionComponentInstance>() {
        @Override
        public StatelessSessionComponentInstance create() {
            return (StatelessSessionComponentInstance) createInstance();
        }

        @Override
        public void destroy(StatelessSessionComponentInstance obj) {
            obj.destroy();
        }
    };
    final PoolConfig poolConfig = slsbComponentCreateService.getPoolConfig();
    if (poolConfig == null) {
        ROOT_LOGGER.debug("Pooling is disabled for Stateless EJB " + slsbComponentCreateService.getComponentName());
        this.pool = null;
        this.poolName = null;
    } else {
        ROOT_LOGGER.debug("Using pool config " + poolConfig + " to create pool for Stateless EJB " + slsbComponentCreateService.getComponentName());
        this.pool = poolConfig.createPool(factory);
        this.poolName = poolConfig.getPoolName();
    }

    this.timeoutMethod = slsbComponentCreateService.getTimeoutMethod();
    this.weakAffinity = slsbComponentCreateService.getWeakAffinity();
}

我看到池是非静态字段,是为每种类型的组件(ejb 类)创建的。

【讨论】:

    【解决方案2】:

    Red Hat documentation

    bean 池的最大大小。

    另外,如果您进入 EAP 的管理面板并进入 Profile -> Container -> EJB3 -> Bean Pools -> “需要帮助?”它说

    Max Pool Size:该池可以容纳的最大 bean 实例数 保持在给定的时间点

    我认为这意味着池最多只能有 20 个实例。


    编辑:回想起来,answer by Sergey Kosarev 说它是每个实例似乎很有说服力,你应该相信它。

    【讨论】:

    • 它如何决定哪些 bean 应该被实例化?
    • @Rips 取决于配置,bean 在应用程序启动或首次使用时被实例化。至于是否需要比池中允许的更多的 bean,我不知道首选哪些 bean。
    • 这个解释是错误的,谢尔盖的回答是正确的。如果将“org.jboss.as.ejb3”日志级别更改为 DEBUG 并启动 JBoss,您将看到类似“Using pool config StrictMaxPoolConfig{name=slsb-strict-max-pool, maxPoolSize=20, timeoutUnit= MINUTES, timeout=5} to create pool for Stateless EJB xxx" 这意味着 JBoss 正在为每个 SLSB 类型创建一个新池。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-25
    • 2014-02-28
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多